app.js 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  1574. /*!***************************************************************************************************************************************************************************!*\
  1575. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  1576. \***************************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. //
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. //
  1596. //
  1597. /* harmony default export */ __webpack_exports__["default"] = ({
  1598. mounted: function mounted() {
  1599. console.log('Component mounted.');
  1600. }
  1601. });
  1602. /***/ }),
  1603. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  1604. /*!********************************************************************************************************************************************************************!*\
  1605. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  1606. \********************************************************************************************************************************************************************/
  1607. /*! exports provided: default */
  1608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1609. "use strict";
  1610. __webpack_require__.r(__webpack_exports__);
  1611. //
  1612. //
  1613. //
  1614. //
  1615. //
  1616. //
  1617. //
  1618. //
  1619. //
  1620. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. /* harmony default export */ __webpack_exports__["default"] = ({
  1668. props: ['asset', 'pcextraStart'],
  1669. data: function data() {
  1670. return {
  1671. data: JSON.parse(this.asset),
  1672. pcextra: JSON.parse(this.pcextraStart)
  1673. };
  1674. },
  1675. mounted: function mounted() {
  1676. var _this = this;
  1677. Echo.channel('assets').listen('AssetUpdated', function (e) {
  1678. _this.data = JSON.parse(e.data);
  1679. _this.pcextra = JSON.parse(e.pcextra);
  1680. });
  1681. },
  1682. methods: {
  1683. updateAsset: function updateAsset() {
  1684. this.data.pcextra = this.pcextra;
  1685. axios.put('/api/assets/' + this.data.pcid, this.data).then(function (response) {})["catch"](function (error) {});
  1686. $('#asseteditModal').modal('hide');
  1687. }
  1688. }
  1689. });
  1690. /***/ }),
  1691. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.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/credential-form-modal.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. //
  1721. //
  1722. /* harmony default export */ __webpack_exports__["default"] = ({
  1723. props: ['populateWith', 'modalId'],
  1724. data: function data() {
  1725. return {
  1726. data: JSON.parse(JSON.stringify(this.populateWith)),
  1727. id: this.modalId,
  1728. errors: []
  1729. };
  1730. },
  1731. methods: {
  1732. rndStr: function rndStr(len) {
  1733. var text = "";
  1734. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  1735. for (var i = 0; i < len; i++) {
  1736. text += chars.charAt(Math.floor(Math.random() * chars.length));
  1737. }
  1738. return text;
  1739. },
  1740. getRandomPassword: function getRandomPassword(id) {
  1741. this.data.credpass = this.rndStr(16);
  1742. },
  1743. updateCredential: function updateCredential() {
  1744. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {})["catch"](function (error) {
  1745. console.error(error);
  1746. });
  1747. $('#credential' + this.data.credid + 'editModal').modal('hide');
  1748. }
  1749. }
  1750. });
  1751. /***/ }),
  1752. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  1753. /*!*********************************************************************************************************************************************************************!*\
  1754. !*** ./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& ***!
  1755. \*********************************************************************************************************************************************************************/
  1756. /*! exports provided: default */
  1757. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1758. "use strict";
  1759. __webpack_require__.r(__webpack_exports__);
  1760. //
  1761. //
  1762. //
  1763. //
  1764. //
  1765. //
  1766. //
  1767. //
  1768. //
  1769. //
  1770. //
  1771. //
  1772. //
  1773. //
  1774. //
  1775. //
  1776. //
  1777. //
  1778. //
  1779. //
  1780. //
  1781. //
  1782. //
  1783. //
  1784. //
  1785. //
  1786. //
  1787. //
  1788. //
  1789. //
  1790. //
  1791. /* harmony default export */ __webpack_exports__["default"] = ({
  1792. props: ['credential'],
  1793. data: function data() {
  1794. return {
  1795. data: JSON.parse(this.credential)
  1796. };
  1797. },
  1798. mounted: function mounted() {
  1799. var _this = this;
  1800. Echo.channel('credentials').listen('CredentialUpdated', function (e) {
  1801. // This part could potentially use a refactor.
  1802. // Probably needs a credential list component to listen for this
  1803. // even and update the corresponding credential. Currently every
  1804. // credential on the page receives this event and checks whether it was intended
  1805. // for its credential or not. I would imagine this could cause a problem
  1806. // on the group page, which will potentially have a lot more credentials from
  1807. // various assets. Better solution may be to have a credentials list component
  1808. // That listens for credential update events and updates the appropriate credential.
  1809. // There would still be multiples of those on the group credentials page, but an
  1810. // order of magnitude less of those than of individual credentials.
  1811. // It also may not be a big deal performance wise to do it like this, not sure.
  1812. var eData = JSON.parse(e.data);
  1813. if (_this.data.credid === eData.credid) {
  1814. _this.data = eData;
  1815. }
  1816. });
  1817. }
  1818. });
  1819. /***/ }),
  1820. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  1821. /*!********************************************************************************************************************************************************************!*\
  1822. !*** ./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& ***!
  1823. \********************************************************************************************************************************************************************/
  1824. /*! exports provided: default */
  1825. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1826. "use strict";
  1827. __webpack_require__.r(__webpack_exports__);
  1828. //
  1829. //
  1830. //
  1831. //
  1832. //
  1833. /* harmony default export */ __webpack_exports__["default"] = ({
  1834. props: ['errors'],
  1835. data: function data() {
  1836. return {
  1837. errorList: this.errors
  1838. };
  1839. },
  1840. watch: {
  1841. errors: function errors(newErrors) {
  1842. this.errorList = newErrors;
  1843. }
  1844. }
  1845. });
  1846. /***/ }),
  1847. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  1848. /*!****************************************************************************************************************************************************************!*\
  1849. !*** ./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& ***!
  1850. \****************************************************************************************************************************************************************/
  1851. /*! exports provided: default */
  1852. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1853. "use strict";
  1854. __webpack_require__.r(__webpack_exports__);
  1855. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1856. //
  1857. //
  1858. //
  1859. //
  1860. //
  1861. //
  1862. //
  1863. //
  1864. //
  1865. //
  1866. //
  1867. //
  1868. //
  1869. //
  1870. //
  1871. //
  1872. //
  1873. //
  1874. //
  1875. //
  1876. //
  1877. //
  1878. //
  1879. //
  1880. //
  1881. //
  1882. //
  1883. //
  1884. //
  1885. //
  1886. //
  1887. //
  1888. //
  1889. //
  1890. //
  1891. //
  1892. //
  1893. //
  1894. //
  1895. /* harmony default export */ __webpack_exports__["default"] = ({
  1896. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1897. props: ['initialnotes', 'authusername'],
  1898. data: function data() {
  1899. return {
  1900. notes: this.initialnotes
  1901. };
  1902. }
  1903. });
  1904. /***/ }),
  1905. /***/ "./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&":
  1906. /*!****************************************************************************************************************************************************************************!*\
  1907. !*** ./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& ***!
  1908. \****************************************************************************************************************************************************************************/
  1909. /*! exports provided: default */
  1910. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1911. "use strict";
  1912. __webpack_require__.r(__webpack_exports__);
  1913. //
  1914. //
  1915. //
  1916. //
  1917. //
  1918. //
  1919. //
  1920. //
  1921. //
  1922. //
  1923. //
  1924. //
  1925. //
  1926. //
  1927. //
  1928. //
  1929. //
  1930. //
  1931. //
  1932. //
  1933. //
  1934. //
  1935. //
  1936. //
  1937. //
  1938. //
  1939. //
  1940. //
  1941. //
  1942. //
  1943. //
  1944. //
  1945. /* harmony default export */ __webpack_exports__["default"] = ({
  1946. props: ['populateWith', 'storeList', 'modalId'],
  1947. data: function data() {
  1948. return {
  1949. // Copies object from prop, so it doesn't mutate the object
  1950. // from the parent component. Parent component will be updated via
  1951. // Websocket if updateWorkOrder is successful.
  1952. data: JSON.parse(JSON.stringify(this.populateWith)),
  1953. storeArray: this.storeList,
  1954. id: this.modalId,
  1955. errors: []
  1956. };
  1957. },
  1958. methods: {
  1959. updateWorkOrder: function updateWorkOrder() {
  1960. var _this = this;
  1961. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  1962. $('#workordereditModal').modal('hide');
  1963. })["catch"](function (error) {
  1964. _this.errors = JSON.parse(error.response.request.response).errors;
  1965. });
  1966. }
  1967. }
  1968. });
  1969. /***/ }),
  1970. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  1971. /*!*****************************************************************************************************************************************************************!*\
  1972. !*** ./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& ***!
  1973. \*****************************************************************************************************************************************************************/
  1974. /*! exports provided: default */
  1975. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1976. "use strict";
  1977. __webpack_require__.r(__webpack_exports__);
  1978. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1979. //
  1980. //
  1981. //
  1982. //
  1983. //
  1984. //
  1985. //
  1986. //
  1987. //
  1988. //
  1989. //
  1990. //
  1991. //
  1992. //
  1993. //
  1994. //
  1995. //
  1996. //
  1997. //
  1998. //
  1999. /* harmony default export */ __webpack_exports__["default"] = ({
  2000. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2001. props: ['workOrder'],
  2002. data: function data() {
  2003. return {
  2004. data: JSON.parse(this.workOrder),
  2005. storeList: null
  2006. };
  2007. },
  2008. mounted: function mounted() {
  2009. var _this = this;
  2010. Echo.channel('work-orders').listen('WorkOrderUpdated', function (e) {
  2011. _this.data = JSON.parse(e.data);
  2012. });
  2013. axios.get('/api/stores').then(function (response) {
  2014. _this.storeList = {};
  2015. response.data.map(function (val) {
  2016. _this.storeList[val.storeid] = val;
  2017. });
  2018. })["catch"](function (error) {
  2019. console.error(error);
  2020. });
  2021. }
  2022. });
  2023. /***/ }),
  2024. /***/ "./node_modules/base64-js/index.js":
  2025. /*!*****************************************!*\
  2026. !*** ./node_modules/base64-js/index.js ***!
  2027. \*****************************************/
  2028. /*! no static exports found */
  2029. /***/ (function(module, exports, __webpack_require__) {
  2030. "use strict";
  2031. exports.byteLength = byteLength
  2032. exports.toByteArray = toByteArray
  2033. exports.fromByteArray = fromByteArray
  2034. var lookup = []
  2035. var revLookup = []
  2036. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2037. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2038. for (var i = 0, len = code.length; i < len; ++i) {
  2039. lookup[i] = code[i]
  2040. revLookup[code.charCodeAt(i)] = i
  2041. }
  2042. // Support decoding URL-safe base64 strings, as Node.js does.
  2043. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2044. revLookup['-'.charCodeAt(0)] = 62
  2045. revLookup['_'.charCodeAt(0)] = 63
  2046. function getLens (b64) {
  2047. var len = b64.length
  2048. if (len % 4 > 0) {
  2049. throw new Error('Invalid string. Length must be a multiple of 4')
  2050. }
  2051. // Trim off extra bytes after placeholder bytes are found
  2052. // See: https://github.com/beatgammit/base64-js/issues/42
  2053. var validLen = b64.indexOf('=')
  2054. if (validLen === -1) validLen = len
  2055. var placeHoldersLen = validLen === len
  2056. ? 0
  2057. : 4 - (validLen % 4)
  2058. return [validLen, placeHoldersLen]
  2059. }
  2060. // base64 is 4/3 + up to two characters of the original data
  2061. function byteLength (b64) {
  2062. var lens = getLens(b64)
  2063. var validLen = lens[0]
  2064. var placeHoldersLen = lens[1]
  2065. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2066. }
  2067. function _byteLength (b64, validLen, placeHoldersLen) {
  2068. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2069. }
  2070. function toByteArray (b64) {
  2071. var tmp
  2072. var lens = getLens(b64)
  2073. var validLen = lens[0]
  2074. var placeHoldersLen = lens[1]
  2075. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2076. var curByte = 0
  2077. // if there are placeholders, only get up to the last complete 4 chars
  2078. var len = placeHoldersLen > 0
  2079. ? validLen - 4
  2080. : validLen
  2081. var i
  2082. for (i = 0; i < len; i += 4) {
  2083. tmp =
  2084. (revLookup[b64.charCodeAt(i)] << 18) |
  2085. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2086. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2087. revLookup[b64.charCodeAt(i + 3)]
  2088. arr[curByte++] = (tmp >> 16) & 0xFF
  2089. arr[curByte++] = (tmp >> 8) & 0xFF
  2090. arr[curByte++] = tmp & 0xFF
  2091. }
  2092. if (placeHoldersLen === 2) {
  2093. tmp =
  2094. (revLookup[b64.charCodeAt(i)] << 2) |
  2095. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2096. arr[curByte++] = tmp & 0xFF
  2097. }
  2098. if (placeHoldersLen === 1) {
  2099. tmp =
  2100. (revLookup[b64.charCodeAt(i)] << 10) |
  2101. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2102. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2103. arr[curByte++] = (tmp >> 8) & 0xFF
  2104. arr[curByte++] = tmp & 0xFF
  2105. }
  2106. return arr
  2107. }
  2108. function tripletToBase64 (num) {
  2109. return lookup[num >> 18 & 0x3F] +
  2110. lookup[num >> 12 & 0x3F] +
  2111. lookup[num >> 6 & 0x3F] +
  2112. lookup[num & 0x3F]
  2113. }
  2114. function encodeChunk (uint8, start, end) {
  2115. var tmp
  2116. var output = []
  2117. for (var i = start; i < end; i += 3) {
  2118. tmp =
  2119. ((uint8[i] << 16) & 0xFF0000) +
  2120. ((uint8[i + 1] << 8) & 0xFF00) +
  2121. (uint8[i + 2] & 0xFF)
  2122. output.push(tripletToBase64(tmp))
  2123. }
  2124. return output.join('')
  2125. }
  2126. function fromByteArray (uint8) {
  2127. var tmp
  2128. var len = uint8.length
  2129. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2130. var parts = []
  2131. var maxChunkLength = 16383 // must be multiple of 3
  2132. // go through the array every three bytes, we'll deal with trailing stuff later
  2133. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2134. parts.push(encodeChunk(
  2135. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2136. ))
  2137. }
  2138. // pad the end with zeros, but make sure to not forget the extra bytes
  2139. if (extraBytes === 1) {
  2140. tmp = uint8[len - 1]
  2141. parts.push(
  2142. lookup[tmp >> 2] +
  2143. lookup[(tmp << 4) & 0x3F] +
  2144. '=='
  2145. )
  2146. } else if (extraBytes === 2) {
  2147. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2148. parts.push(
  2149. lookup[tmp >> 10] +
  2150. lookup[(tmp >> 4) & 0x3F] +
  2151. lookup[(tmp << 2) & 0x3F] +
  2152. '='
  2153. )
  2154. }
  2155. return parts.join('')
  2156. }
  2157. /***/ }),
  2158. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2159. /*!*****************************************************!*\
  2160. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2161. \*****************************************************/
  2162. /*! no static exports found */
  2163. /***/ (function(module, exports, __webpack_require__) {
  2164. /*!
  2165. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2166. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2167. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2168. */
  2169. (function (global, factory) {
  2170. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2171. undefined;
  2172. }(this, (function (exports, $, Popper) { 'use strict';
  2173. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2174. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2175. function _defineProperties(target, props) {
  2176. for (var i = 0; i < props.length; i++) {
  2177. var descriptor = props[i];
  2178. descriptor.enumerable = descriptor.enumerable || false;
  2179. descriptor.configurable = true;
  2180. if ("value" in descriptor) descriptor.writable = true;
  2181. Object.defineProperty(target, descriptor.key, descriptor);
  2182. }
  2183. }
  2184. function _createClass(Constructor, protoProps, staticProps) {
  2185. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2186. if (staticProps) _defineProperties(Constructor, staticProps);
  2187. return Constructor;
  2188. }
  2189. function _defineProperty(obj, key, value) {
  2190. if (key in obj) {
  2191. Object.defineProperty(obj, key, {
  2192. value: value,
  2193. enumerable: true,
  2194. configurable: true,
  2195. writable: true
  2196. });
  2197. } else {
  2198. obj[key] = value;
  2199. }
  2200. return obj;
  2201. }
  2202. function ownKeys(object, enumerableOnly) {
  2203. var keys = Object.keys(object);
  2204. if (Object.getOwnPropertySymbols) {
  2205. var symbols = Object.getOwnPropertySymbols(object);
  2206. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2207. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2208. });
  2209. keys.push.apply(keys, symbols);
  2210. }
  2211. return keys;
  2212. }
  2213. function _objectSpread2(target) {
  2214. for (var i = 1; i < arguments.length; i++) {
  2215. var source = arguments[i] != null ? arguments[i] : {};
  2216. if (i % 2) {
  2217. ownKeys(Object(source), true).forEach(function (key) {
  2218. _defineProperty(target, key, source[key]);
  2219. });
  2220. } else if (Object.getOwnPropertyDescriptors) {
  2221. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2222. } else {
  2223. ownKeys(Object(source)).forEach(function (key) {
  2224. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2225. });
  2226. }
  2227. }
  2228. return target;
  2229. }
  2230. function _inheritsLoose(subClass, superClass) {
  2231. subClass.prototype = Object.create(superClass.prototype);
  2232. subClass.prototype.constructor = subClass;
  2233. subClass.__proto__ = superClass;
  2234. }
  2235. /**
  2236. * --------------------------------------------------------------------------
  2237. * Bootstrap (v4.4.1): util.js
  2238. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2239. * --------------------------------------------------------------------------
  2240. */
  2241. /**
  2242. * ------------------------------------------------------------------------
  2243. * Private TransitionEnd Helpers
  2244. * ------------------------------------------------------------------------
  2245. */
  2246. var TRANSITION_END = 'transitionend';
  2247. var MAX_UID = 1000000;
  2248. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2249. function toType(obj) {
  2250. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2251. }
  2252. function getSpecialTransitionEndEvent() {
  2253. return {
  2254. bindType: TRANSITION_END,
  2255. delegateType: TRANSITION_END,
  2256. handle: function handle(event) {
  2257. if ($(event.target).is(this)) {
  2258. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2259. }
  2260. return undefined; // eslint-disable-line no-undefined
  2261. }
  2262. };
  2263. }
  2264. function transitionEndEmulator(duration) {
  2265. var _this = this;
  2266. var called = false;
  2267. $(this).one(Util.TRANSITION_END, function () {
  2268. called = true;
  2269. });
  2270. setTimeout(function () {
  2271. if (!called) {
  2272. Util.triggerTransitionEnd(_this);
  2273. }
  2274. }, duration);
  2275. return this;
  2276. }
  2277. function setTransitionEndSupport() {
  2278. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2279. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2280. }
  2281. /**
  2282. * --------------------------------------------------------------------------
  2283. * Public Util Api
  2284. * --------------------------------------------------------------------------
  2285. */
  2286. var Util = {
  2287. TRANSITION_END: 'bsTransitionEnd',
  2288. getUID: function getUID(prefix) {
  2289. do {
  2290. // eslint-disable-next-line no-bitwise
  2291. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2292. } while (document.getElementById(prefix));
  2293. return prefix;
  2294. },
  2295. getSelectorFromElement: function getSelectorFromElement(element) {
  2296. var selector = element.getAttribute('data-target');
  2297. if (!selector || selector === '#') {
  2298. var hrefAttr = element.getAttribute('href');
  2299. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2300. }
  2301. try {
  2302. return document.querySelector(selector) ? selector : null;
  2303. } catch (err) {
  2304. return null;
  2305. }
  2306. },
  2307. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2308. if (!element) {
  2309. return 0;
  2310. } // Get transition-duration of the element
  2311. var transitionDuration = $(element).css('transition-duration');
  2312. var transitionDelay = $(element).css('transition-delay');
  2313. var floatTransitionDuration = parseFloat(transitionDuration);
  2314. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2315. if (!floatTransitionDuration && !floatTransitionDelay) {
  2316. return 0;
  2317. } // If multiple durations are defined, take the first
  2318. transitionDuration = transitionDuration.split(',')[0];
  2319. transitionDelay = transitionDelay.split(',')[0];
  2320. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2321. },
  2322. reflow: function reflow(element) {
  2323. return element.offsetHeight;
  2324. },
  2325. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2326. $(element).trigger(TRANSITION_END);
  2327. },
  2328. // TODO: Remove in v5
  2329. supportsTransitionEnd: function supportsTransitionEnd() {
  2330. return Boolean(TRANSITION_END);
  2331. },
  2332. isElement: function isElement(obj) {
  2333. return (obj[0] || obj).nodeType;
  2334. },
  2335. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2336. for (var property in configTypes) {
  2337. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2338. var expectedTypes = configTypes[property];
  2339. var value = config[property];
  2340. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2341. if (!new RegExp(expectedTypes).test(valueType)) {
  2342. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2343. }
  2344. }
  2345. }
  2346. },
  2347. findShadowRoot: function findShadowRoot(element) {
  2348. if (!document.documentElement.attachShadow) {
  2349. return null;
  2350. } // Can find the shadow root otherwise it'll return the document
  2351. if (typeof element.getRootNode === 'function') {
  2352. var root = element.getRootNode();
  2353. return root instanceof ShadowRoot ? root : null;
  2354. }
  2355. if (element instanceof ShadowRoot) {
  2356. return element;
  2357. } // when we don't find a shadow root
  2358. if (!element.parentNode) {
  2359. return null;
  2360. }
  2361. return Util.findShadowRoot(element.parentNode);
  2362. },
  2363. jQueryDetection: function jQueryDetection() {
  2364. if (typeof $ === 'undefined') {
  2365. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2366. }
  2367. var version = $.fn.jquery.split(' ')[0].split('.');
  2368. var minMajor = 1;
  2369. var ltMajor = 2;
  2370. var minMinor = 9;
  2371. var minPatch = 1;
  2372. var maxMajor = 4;
  2373. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2374. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2375. }
  2376. }
  2377. };
  2378. Util.jQueryDetection();
  2379. setTransitionEndSupport();
  2380. /**
  2381. * ------------------------------------------------------------------------
  2382. * Constants
  2383. * ------------------------------------------------------------------------
  2384. */
  2385. var NAME = 'alert';
  2386. var VERSION = '4.4.1';
  2387. var DATA_KEY = 'bs.alert';
  2388. var EVENT_KEY = "." + DATA_KEY;
  2389. var DATA_API_KEY = '.data-api';
  2390. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2391. var Selector = {
  2392. DISMISS: '[data-dismiss="alert"]'
  2393. };
  2394. var Event = {
  2395. CLOSE: "close" + EVENT_KEY,
  2396. CLOSED: "closed" + EVENT_KEY,
  2397. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2398. };
  2399. var ClassName = {
  2400. ALERT: 'alert',
  2401. FADE: 'fade',
  2402. SHOW: 'show'
  2403. };
  2404. /**
  2405. * ------------------------------------------------------------------------
  2406. * Class Definition
  2407. * ------------------------------------------------------------------------
  2408. */
  2409. var Alert =
  2410. /*#__PURE__*/
  2411. function () {
  2412. function Alert(element) {
  2413. this._element = element;
  2414. } // Getters
  2415. var _proto = Alert.prototype;
  2416. // Public
  2417. _proto.close = function close(element) {
  2418. var rootElement = this._element;
  2419. if (element) {
  2420. rootElement = this._getRootElement(element);
  2421. }
  2422. var customEvent = this._triggerCloseEvent(rootElement);
  2423. if (customEvent.isDefaultPrevented()) {
  2424. return;
  2425. }
  2426. this._removeElement(rootElement);
  2427. };
  2428. _proto.dispose = function dispose() {
  2429. $.removeData(this._element, DATA_KEY);
  2430. this._element = null;
  2431. } // Private
  2432. ;
  2433. _proto._getRootElement = function _getRootElement(element) {
  2434. var selector = Util.getSelectorFromElement(element);
  2435. var parent = false;
  2436. if (selector) {
  2437. parent = document.querySelector(selector);
  2438. }
  2439. if (!parent) {
  2440. parent = $(element).closest("." + ClassName.ALERT)[0];
  2441. }
  2442. return parent;
  2443. };
  2444. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2445. var closeEvent = $.Event(Event.CLOSE);
  2446. $(element).trigger(closeEvent);
  2447. return closeEvent;
  2448. };
  2449. _proto._removeElement = function _removeElement(element) {
  2450. var _this = this;
  2451. $(element).removeClass(ClassName.SHOW);
  2452. if (!$(element).hasClass(ClassName.FADE)) {
  2453. this._destroyElement(element);
  2454. return;
  2455. }
  2456. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2457. $(element).one(Util.TRANSITION_END, function (event) {
  2458. return _this._destroyElement(element, event);
  2459. }).emulateTransitionEnd(transitionDuration);
  2460. };
  2461. _proto._destroyElement = function _destroyElement(element) {
  2462. $(element).detach().trigger(Event.CLOSED).remove();
  2463. } // Static
  2464. ;
  2465. Alert._jQueryInterface = function _jQueryInterface(config) {
  2466. return this.each(function () {
  2467. var $element = $(this);
  2468. var data = $element.data(DATA_KEY);
  2469. if (!data) {
  2470. data = new Alert(this);
  2471. $element.data(DATA_KEY, data);
  2472. }
  2473. if (config === 'close') {
  2474. data[config](this);
  2475. }
  2476. });
  2477. };
  2478. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2479. return function (event) {
  2480. if (event) {
  2481. event.preventDefault();
  2482. }
  2483. alertInstance.close(this);
  2484. };
  2485. };
  2486. _createClass(Alert, null, [{
  2487. key: "VERSION",
  2488. get: function get() {
  2489. return VERSION;
  2490. }
  2491. }]);
  2492. return Alert;
  2493. }();
  2494. /**
  2495. * ------------------------------------------------------------------------
  2496. * Data Api implementation
  2497. * ------------------------------------------------------------------------
  2498. */
  2499. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2500. /**
  2501. * ------------------------------------------------------------------------
  2502. * jQuery
  2503. * ------------------------------------------------------------------------
  2504. */
  2505. $.fn[NAME] = Alert._jQueryInterface;
  2506. $.fn[NAME].Constructor = Alert;
  2507. $.fn[NAME].noConflict = function () {
  2508. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2509. return Alert._jQueryInterface;
  2510. };
  2511. /**
  2512. * ------------------------------------------------------------------------
  2513. * Constants
  2514. * ------------------------------------------------------------------------
  2515. */
  2516. var NAME$1 = 'button';
  2517. var VERSION$1 = '4.4.1';
  2518. var DATA_KEY$1 = 'bs.button';
  2519. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2520. var DATA_API_KEY$1 = '.data-api';
  2521. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2522. var ClassName$1 = {
  2523. ACTIVE: 'active',
  2524. BUTTON: 'btn',
  2525. FOCUS: 'focus'
  2526. };
  2527. var Selector$1 = {
  2528. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2529. DATA_TOGGLES: '[data-toggle="buttons"]',
  2530. DATA_TOGGLE: '[data-toggle="button"]',
  2531. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2532. INPUT: 'input:not([type="hidden"])',
  2533. ACTIVE: '.active',
  2534. BUTTON: '.btn'
  2535. };
  2536. var Event$1 = {
  2537. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2538. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2539. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2540. };
  2541. /**
  2542. * ------------------------------------------------------------------------
  2543. * Class Definition
  2544. * ------------------------------------------------------------------------
  2545. */
  2546. var Button =
  2547. /*#__PURE__*/
  2548. function () {
  2549. function Button(element) {
  2550. this._element = element;
  2551. } // Getters
  2552. var _proto = Button.prototype;
  2553. // Public
  2554. _proto.toggle = function toggle() {
  2555. var triggerChangeEvent = true;
  2556. var addAriaPressed = true;
  2557. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2558. if (rootElement) {
  2559. var input = this._element.querySelector(Selector$1.INPUT);
  2560. if (input) {
  2561. if (input.type === 'radio') {
  2562. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2563. triggerChangeEvent = false;
  2564. } else {
  2565. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2566. if (activeElement) {
  2567. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2568. }
  2569. }
  2570. } else if (input.type === 'checkbox') {
  2571. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2572. triggerChangeEvent = false;
  2573. }
  2574. } else {
  2575. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2576. triggerChangeEvent = false;
  2577. }
  2578. if (triggerChangeEvent) {
  2579. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2580. $(input).trigger('change');
  2581. }
  2582. input.focus();
  2583. addAriaPressed = false;
  2584. }
  2585. }
  2586. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2587. if (addAriaPressed) {
  2588. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2589. }
  2590. if (triggerChangeEvent) {
  2591. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2592. }
  2593. }
  2594. };
  2595. _proto.dispose = function dispose() {
  2596. $.removeData(this._element, DATA_KEY$1);
  2597. this._element = null;
  2598. } // Static
  2599. ;
  2600. Button._jQueryInterface = function _jQueryInterface(config) {
  2601. return this.each(function () {
  2602. var data = $(this).data(DATA_KEY$1);
  2603. if (!data) {
  2604. data = new Button(this);
  2605. $(this).data(DATA_KEY$1, data);
  2606. }
  2607. if (config === 'toggle') {
  2608. data[config]();
  2609. }
  2610. });
  2611. };
  2612. _createClass(Button, null, [{
  2613. key: "VERSION",
  2614. get: function get() {
  2615. return VERSION$1;
  2616. }
  2617. }]);
  2618. return Button;
  2619. }();
  2620. /**
  2621. * ------------------------------------------------------------------------
  2622. * Data Api implementation
  2623. * ------------------------------------------------------------------------
  2624. */
  2625. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2626. var button = event.target;
  2627. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2628. button = $(button).closest(Selector$1.BUTTON)[0];
  2629. }
  2630. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2631. event.preventDefault(); // work around Firefox bug #1540995
  2632. } else {
  2633. var inputBtn = button.querySelector(Selector$1.INPUT);
  2634. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2635. event.preventDefault(); // work around Firefox bug #1540995
  2636. return;
  2637. }
  2638. Button._jQueryInterface.call($(button), 'toggle');
  2639. }
  2640. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2641. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2642. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2643. });
  2644. $(window).on(Event$1.LOAD_DATA_API, function () {
  2645. // ensure correct active class is set to match the controls' actual values/states
  2646. // find all checkboxes/readio buttons inside data-toggle groups
  2647. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2648. for (var i = 0, len = buttons.length; i < len; i++) {
  2649. var button = buttons[i];
  2650. var input = button.querySelector(Selector$1.INPUT);
  2651. if (input.checked || input.hasAttribute('checked')) {
  2652. button.classList.add(ClassName$1.ACTIVE);
  2653. } else {
  2654. button.classList.remove(ClassName$1.ACTIVE);
  2655. }
  2656. } // find all button toggles
  2657. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2658. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2659. var _button = buttons[_i];
  2660. if (_button.getAttribute('aria-pressed') === 'true') {
  2661. _button.classList.add(ClassName$1.ACTIVE);
  2662. } else {
  2663. _button.classList.remove(ClassName$1.ACTIVE);
  2664. }
  2665. }
  2666. });
  2667. /**
  2668. * ------------------------------------------------------------------------
  2669. * jQuery
  2670. * ------------------------------------------------------------------------
  2671. */
  2672. $.fn[NAME$1] = Button._jQueryInterface;
  2673. $.fn[NAME$1].Constructor = Button;
  2674. $.fn[NAME$1].noConflict = function () {
  2675. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2676. return Button._jQueryInterface;
  2677. };
  2678. /**
  2679. * ------------------------------------------------------------------------
  2680. * Constants
  2681. * ------------------------------------------------------------------------
  2682. */
  2683. var NAME$2 = 'carousel';
  2684. var VERSION$2 = '4.4.1';
  2685. var DATA_KEY$2 = 'bs.carousel';
  2686. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2687. var DATA_API_KEY$2 = '.data-api';
  2688. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2689. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2690. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2691. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2692. var SWIPE_THRESHOLD = 40;
  2693. var Default = {
  2694. interval: 5000,
  2695. keyboard: true,
  2696. slide: false,
  2697. pause: 'hover',
  2698. wrap: true,
  2699. touch: true
  2700. };
  2701. var DefaultType = {
  2702. interval: '(number|boolean)',
  2703. keyboard: 'boolean',
  2704. slide: '(boolean|string)',
  2705. pause: '(string|boolean)',
  2706. wrap: 'boolean',
  2707. touch: 'boolean'
  2708. };
  2709. var Direction = {
  2710. NEXT: 'next',
  2711. PREV: 'prev',
  2712. LEFT: 'left',
  2713. RIGHT: 'right'
  2714. };
  2715. var Event$2 = {
  2716. SLIDE: "slide" + EVENT_KEY$2,
  2717. SLID: "slid" + EVENT_KEY$2,
  2718. KEYDOWN: "keydown" + EVENT_KEY$2,
  2719. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2720. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2721. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2722. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2723. TOUCHEND: "touchend" + EVENT_KEY$2,
  2724. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2725. POINTERUP: "pointerup" + EVENT_KEY$2,
  2726. DRAG_START: "dragstart" + EVENT_KEY$2,
  2727. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2728. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2729. };
  2730. var ClassName$2 = {
  2731. CAROUSEL: 'carousel',
  2732. ACTIVE: 'active',
  2733. SLIDE: 'slide',
  2734. RIGHT: 'carousel-item-right',
  2735. LEFT: 'carousel-item-left',
  2736. NEXT: 'carousel-item-next',
  2737. PREV: 'carousel-item-prev',
  2738. ITEM: 'carousel-item',
  2739. POINTER_EVENT: 'pointer-event'
  2740. };
  2741. var Selector$2 = {
  2742. ACTIVE: '.active',
  2743. ACTIVE_ITEM: '.active.carousel-item',
  2744. ITEM: '.carousel-item',
  2745. ITEM_IMG: '.carousel-item img',
  2746. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2747. INDICATORS: '.carousel-indicators',
  2748. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2749. DATA_RIDE: '[data-ride="carousel"]'
  2750. };
  2751. var PointerType = {
  2752. TOUCH: 'touch',
  2753. PEN: 'pen'
  2754. };
  2755. /**
  2756. * ------------------------------------------------------------------------
  2757. * Class Definition
  2758. * ------------------------------------------------------------------------
  2759. */
  2760. var Carousel =
  2761. /*#__PURE__*/
  2762. function () {
  2763. function Carousel(element, config) {
  2764. this._items = null;
  2765. this._interval = null;
  2766. this._activeElement = null;
  2767. this._isPaused = false;
  2768. this._isSliding = false;
  2769. this.touchTimeout = null;
  2770. this.touchStartX = 0;
  2771. this.touchDeltaX = 0;
  2772. this._config = this._getConfig(config);
  2773. this._element = element;
  2774. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2775. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2776. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2777. this._addEventListeners();
  2778. } // Getters
  2779. var _proto = Carousel.prototype;
  2780. // Public
  2781. _proto.next = function next() {
  2782. if (!this._isSliding) {
  2783. this._slide(Direction.NEXT);
  2784. }
  2785. };
  2786. _proto.nextWhenVisible = function nextWhenVisible() {
  2787. // Don't call next when the page isn't visible
  2788. // or the carousel or its parent isn't visible
  2789. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2790. this.next();
  2791. }
  2792. };
  2793. _proto.prev = function prev() {
  2794. if (!this._isSliding) {
  2795. this._slide(Direction.PREV);
  2796. }
  2797. };
  2798. _proto.pause = function pause(event) {
  2799. if (!event) {
  2800. this._isPaused = true;
  2801. }
  2802. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2803. Util.triggerTransitionEnd(this._element);
  2804. this.cycle(true);
  2805. }
  2806. clearInterval(this._interval);
  2807. this._interval = null;
  2808. };
  2809. _proto.cycle = function cycle(event) {
  2810. if (!event) {
  2811. this._isPaused = false;
  2812. }
  2813. if (this._interval) {
  2814. clearInterval(this._interval);
  2815. this._interval = null;
  2816. }
  2817. if (this._config.interval && !this._isPaused) {
  2818. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2819. }
  2820. };
  2821. _proto.to = function to(index) {
  2822. var _this = this;
  2823. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2824. var activeIndex = this._getItemIndex(this._activeElement);
  2825. if (index > this._items.length - 1 || index < 0) {
  2826. return;
  2827. }
  2828. if (this._isSliding) {
  2829. $(this._element).one(Event$2.SLID, function () {
  2830. return _this.to(index);
  2831. });
  2832. return;
  2833. }
  2834. if (activeIndex === index) {
  2835. this.pause();
  2836. this.cycle();
  2837. return;
  2838. }
  2839. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  2840. this._slide(direction, this._items[index]);
  2841. };
  2842. _proto.dispose = function dispose() {
  2843. $(this._element).off(EVENT_KEY$2);
  2844. $.removeData(this._element, DATA_KEY$2);
  2845. this._items = null;
  2846. this._config = null;
  2847. this._element = null;
  2848. this._interval = null;
  2849. this._isPaused = null;
  2850. this._isSliding = null;
  2851. this._activeElement = null;
  2852. this._indicatorsElement = null;
  2853. } // Private
  2854. ;
  2855. _proto._getConfig = function _getConfig(config) {
  2856. config = _objectSpread2({}, Default, {}, config);
  2857. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2858. return config;
  2859. };
  2860. _proto._handleSwipe = function _handleSwipe() {
  2861. var absDeltax = Math.abs(this.touchDeltaX);
  2862. if (absDeltax <= SWIPE_THRESHOLD) {
  2863. return;
  2864. }
  2865. var direction = absDeltax / this.touchDeltaX;
  2866. this.touchDeltaX = 0; // swipe left
  2867. if (direction > 0) {
  2868. this.prev();
  2869. } // swipe right
  2870. if (direction < 0) {
  2871. this.next();
  2872. }
  2873. };
  2874. _proto._addEventListeners = function _addEventListeners() {
  2875. var _this2 = this;
  2876. if (this._config.keyboard) {
  2877. $(this._element).on(Event$2.KEYDOWN, function (event) {
  2878. return _this2._keydown(event);
  2879. });
  2880. }
  2881. if (this._config.pause === 'hover') {
  2882. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  2883. return _this2.pause(event);
  2884. }).on(Event$2.MOUSELEAVE, function (event) {
  2885. return _this2.cycle(event);
  2886. });
  2887. }
  2888. if (this._config.touch) {
  2889. this._addTouchEventListeners();
  2890. }
  2891. };
  2892. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2893. var _this3 = this;
  2894. if (!this._touchSupported) {
  2895. return;
  2896. }
  2897. var start = function start(event) {
  2898. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2899. _this3.touchStartX = event.originalEvent.clientX;
  2900. } else if (!_this3._pointerEvent) {
  2901. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2902. }
  2903. };
  2904. var move = function move(event) {
  2905. // ensure swiping with one touch and not pinching
  2906. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2907. _this3.touchDeltaX = 0;
  2908. } else {
  2909. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2910. }
  2911. };
  2912. var end = function end(event) {
  2913. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2914. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2915. }
  2916. _this3._handleSwipe();
  2917. if (_this3._config.pause === 'hover') {
  2918. // If it's a touch-enabled device, mouseenter/leave are fired as
  2919. // part of the mouse compatibility events on first tap - the carousel
  2920. // would stop cycling until user tapped out of it;
  2921. // here, we listen for touchend, explicitly pause the carousel
  2922. // (as if it's the second time we tap on it, mouseenter compat event
  2923. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2924. // events to fire) we explicitly restart cycling
  2925. _this3.pause();
  2926. if (_this3.touchTimeout) {
  2927. clearTimeout(_this3.touchTimeout);
  2928. }
  2929. _this3.touchTimeout = setTimeout(function (event) {
  2930. return _this3.cycle(event);
  2931. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2932. }
  2933. };
  2934. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  2935. return e.preventDefault();
  2936. });
  2937. if (this._pointerEvent) {
  2938. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  2939. return start(event);
  2940. });
  2941. $(this._element).on(Event$2.POINTERUP, function (event) {
  2942. return end(event);
  2943. });
  2944. this._element.classList.add(ClassName$2.POINTER_EVENT);
  2945. } else {
  2946. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  2947. return start(event);
  2948. });
  2949. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  2950. return move(event);
  2951. });
  2952. $(this._element).on(Event$2.TOUCHEND, function (event) {
  2953. return end(event);
  2954. });
  2955. }
  2956. };
  2957. _proto._keydown = function _keydown(event) {
  2958. if (/input|textarea/i.test(event.target.tagName)) {
  2959. return;
  2960. }
  2961. switch (event.which) {
  2962. case ARROW_LEFT_KEYCODE:
  2963. event.preventDefault();
  2964. this.prev();
  2965. break;
  2966. case ARROW_RIGHT_KEYCODE:
  2967. event.preventDefault();
  2968. this.next();
  2969. break;
  2970. }
  2971. };
  2972. _proto._getItemIndex = function _getItemIndex(element) {
  2973. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  2974. return this._items.indexOf(element);
  2975. };
  2976. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2977. var isNextDirection = direction === Direction.NEXT;
  2978. var isPrevDirection = direction === Direction.PREV;
  2979. var activeIndex = this._getItemIndex(activeElement);
  2980. var lastItemIndex = this._items.length - 1;
  2981. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2982. if (isGoingToWrap && !this._config.wrap) {
  2983. return activeElement;
  2984. }
  2985. var delta = direction === Direction.PREV ? -1 : 1;
  2986. var itemIndex = (activeIndex + delta) % this._items.length;
  2987. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2988. };
  2989. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2990. var targetIndex = this._getItemIndex(relatedTarget);
  2991. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  2992. var slideEvent = $.Event(Event$2.SLIDE, {
  2993. relatedTarget: relatedTarget,
  2994. direction: eventDirectionName,
  2995. from: fromIndex,
  2996. to: targetIndex
  2997. });
  2998. $(this._element).trigger(slideEvent);
  2999. return slideEvent;
  3000. };
  3001. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3002. if (this._indicatorsElement) {
  3003. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3004. $(indicators).removeClass(ClassName$2.ACTIVE);
  3005. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3006. if (nextIndicator) {
  3007. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3008. }
  3009. }
  3010. };
  3011. _proto._slide = function _slide(direction, element) {
  3012. var _this4 = this;
  3013. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3014. var activeElementIndex = this._getItemIndex(activeElement);
  3015. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3016. var nextElementIndex = this._getItemIndex(nextElement);
  3017. var isCycling = Boolean(this._interval);
  3018. var directionalClassName;
  3019. var orderClassName;
  3020. var eventDirectionName;
  3021. if (direction === Direction.NEXT) {
  3022. directionalClassName = ClassName$2.LEFT;
  3023. orderClassName = ClassName$2.NEXT;
  3024. eventDirectionName = Direction.LEFT;
  3025. } else {
  3026. directionalClassName = ClassName$2.RIGHT;
  3027. orderClassName = ClassName$2.PREV;
  3028. eventDirectionName = Direction.RIGHT;
  3029. }
  3030. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3031. this._isSliding = false;
  3032. return;
  3033. }
  3034. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3035. if (slideEvent.isDefaultPrevented()) {
  3036. return;
  3037. }
  3038. if (!activeElement || !nextElement) {
  3039. // Some weirdness is happening, so we bail
  3040. return;
  3041. }
  3042. this._isSliding = true;
  3043. if (isCycling) {
  3044. this.pause();
  3045. }
  3046. this._setActiveIndicatorElement(nextElement);
  3047. var slidEvent = $.Event(Event$2.SLID, {
  3048. relatedTarget: nextElement,
  3049. direction: eventDirectionName,
  3050. from: activeElementIndex,
  3051. to: nextElementIndex
  3052. });
  3053. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3054. $(nextElement).addClass(orderClassName);
  3055. Util.reflow(nextElement);
  3056. $(activeElement).addClass(directionalClassName);
  3057. $(nextElement).addClass(directionalClassName);
  3058. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3059. if (nextElementInterval) {
  3060. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3061. this._config.interval = nextElementInterval;
  3062. } else {
  3063. this._config.interval = this._config.defaultInterval || this._config.interval;
  3064. }
  3065. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3066. $(activeElement).one(Util.TRANSITION_END, function () {
  3067. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3068. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3069. _this4._isSliding = false;
  3070. setTimeout(function () {
  3071. return $(_this4._element).trigger(slidEvent);
  3072. }, 0);
  3073. }).emulateTransitionEnd(transitionDuration);
  3074. } else {
  3075. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3076. $(nextElement).addClass(ClassName$2.ACTIVE);
  3077. this._isSliding = false;
  3078. $(this._element).trigger(slidEvent);
  3079. }
  3080. if (isCycling) {
  3081. this.cycle();
  3082. }
  3083. } // Static
  3084. ;
  3085. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3086. return this.each(function () {
  3087. var data = $(this).data(DATA_KEY$2);
  3088. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3089. if (typeof config === 'object') {
  3090. _config = _objectSpread2({}, _config, {}, config);
  3091. }
  3092. var action = typeof config === 'string' ? config : _config.slide;
  3093. if (!data) {
  3094. data = new Carousel(this, _config);
  3095. $(this).data(DATA_KEY$2, data);
  3096. }
  3097. if (typeof config === 'number') {
  3098. data.to(config);
  3099. } else if (typeof action === 'string') {
  3100. if (typeof data[action] === 'undefined') {
  3101. throw new TypeError("No method named \"" + action + "\"");
  3102. }
  3103. data[action]();
  3104. } else if (_config.interval && _config.ride) {
  3105. data.pause();
  3106. data.cycle();
  3107. }
  3108. });
  3109. };
  3110. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3111. var selector = Util.getSelectorFromElement(this);
  3112. if (!selector) {
  3113. return;
  3114. }
  3115. var target = $(selector)[0];
  3116. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3117. return;
  3118. }
  3119. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3120. var slideIndex = this.getAttribute('data-slide-to');
  3121. if (slideIndex) {
  3122. config.interval = false;
  3123. }
  3124. Carousel._jQueryInterface.call($(target), config);
  3125. if (slideIndex) {
  3126. $(target).data(DATA_KEY$2).to(slideIndex);
  3127. }
  3128. event.preventDefault();
  3129. };
  3130. _createClass(Carousel, null, [{
  3131. key: "VERSION",
  3132. get: function get() {
  3133. return VERSION$2;
  3134. }
  3135. }, {
  3136. key: "Default",
  3137. get: function get() {
  3138. return Default;
  3139. }
  3140. }]);
  3141. return Carousel;
  3142. }();
  3143. /**
  3144. * ------------------------------------------------------------------------
  3145. * Data Api implementation
  3146. * ------------------------------------------------------------------------
  3147. */
  3148. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3149. $(window).on(Event$2.LOAD_DATA_API, function () {
  3150. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3151. for (var i = 0, len = carousels.length; i < len; i++) {
  3152. var $carousel = $(carousels[i]);
  3153. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3154. }
  3155. });
  3156. /**
  3157. * ------------------------------------------------------------------------
  3158. * jQuery
  3159. * ------------------------------------------------------------------------
  3160. */
  3161. $.fn[NAME$2] = Carousel._jQueryInterface;
  3162. $.fn[NAME$2].Constructor = Carousel;
  3163. $.fn[NAME$2].noConflict = function () {
  3164. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3165. return Carousel._jQueryInterface;
  3166. };
  3167. /**
  3168. * ------------------------------------------------------------------------
  3169. * Constants
  3170. * ------------------------------------------------------------------------
  3171. */
  3172. var NAME$3 = 'collapse';
  3173. var VERSION$3 = '4.4.1';
  3174. var DATA_KEY$3 = 'bs.collapse';
  3175. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3176. var DATA_API_KEY$3 = '.data-api';
  3177. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3178. var Default$1 = {
  3179. toggle: true,
  3180. parent: ''
  3181. };
  3182. var DefaultType$1 = {
  3183. toggle: 'boolean',
  3184. parent: '(string|element)'
  3185. };
  3186. var Event$3 = {
  3187. SHOW: "show" + EVENT_KEY$3,
  3188. SHOWN: "shown" + EVENT_KEY$3,
  3189. HIDE: "hide" + EVENT_KEY$3,
  3190. HIDDEN: "hidden" + EVENT_KEY$3,
  3191. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3192. };
  3193. var ClassName$3 = {
  3194. SHOW: 'show',
  3195. COLLAPSE: 'collapse',
  3196. COLLAPSING: 'collapsing',
  3197. COLLAPSED: 'collapsed'
  3198. };
  3199. var Dimension = {
  3200. WIDTH: 'width',
  3201. HEIGHT: 'height'
  3202. };
  3203. var Selector$3 = {
  3204. ACTIVES: '.show, .collapsing',
  3205. DATA_TOGGLE: '[data-toggle="collapse"]'
  3206. };
  3207. /**
  3208. * ------------------------------------------------------------------------
  3209. * Class Definition
  3210. * ------------------------------------------------------------------------
  3211. */
  3212. var Collapse =
  3213. /*#__PURE__*/
  3214. function () {
  3215. function Collapse(element, config) {
  3216. this._isTransitioning = false;
  3217. this._element = element;
  3218. this._config = this._getConfig(config);
  3219. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3220. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3221. for (var i = 0, len = toggleList.length; i < len; i++) {
  3222. var elem = toggleList[i];
  3223. var selector = Util.getSelectorFromElement(elem);
  3224. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3225. return foundElem === element;
  3226. });
  3227. if (selector !== null && filterElement.length > 0) {
  3228. this._selector = selector;
  3229. this._triggerArray.push(elem);
  3230. }
  3231. }
  3232. this._parent = this._config.parent ? this._getParent() : null;
  3233. if (!this._config.parent) {
  3234. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3235. }
  3236. if (this._config.toggle) {
  3237. this.toggle();
  3238. }
  3239. } // Getters
  3240. var _proto = Collapse.prototype;
  3241. // Public
  3242. _proto.toggle = function toggle() {
  3243. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3244. this.hide();
  3245. } else {
  3246. this.show();
  3247. }
  3248. };
  3249. _proto.show = function show() {
  3250. var _this = this;
  3251. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3252. return;
  3253. }
  3254. var actives;
  3255. var activesData;
  3256. if (this._parent) {
  3257. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3258. if (typeof _this._config.parent === 'string') {
  3259. return elem.getAttribute('data-parent') === _this._config.parent;
  3260. }
  3261. return elem.classList.contains(ClassName$3.COLLAPSE);
  3262. });
  3263. if (actives.length === 0) {
  3264. actives = null;
  3265. }
  3266. }
  3267. if (actives) {
  3268. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3269. if (activesData && activesData._isTransitioning) {
  3270. return;
  3271. }
  3272. }
  3273. var startEvent = $.Event(Event$3.SHOW);
  3274. $(this._element).trigger(startEvent);
  3275. if (startEvent.isDefaultPrevented()) {
  3276. return;
  3277. }
  3278. if (actives) {
  3279. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3280. if (!activesData) {
  3281. $(actives).data(DATA_KEY$3, null);
  3282. }
  3283. }
  3284. var dimension = this._getDimension();
  3285. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3286. this._element.style[dimension] = 0;
  3287. if (this._triggerArray.length) {
  3288. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3289. }
  3290. this.setTransitioning(true);
  3291. var complete = function complete() {
  3292. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3293. _this._element.style[dimension] = '';
  3294. _this.setTransitioning(false);
  3295. $(_this._element).trigger(Event$3.SHOWN);
  3296. };
  3297. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3298. var scrollSize = "scroll" + capitalizedDimension;
  3299. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3300. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3301. this._element.style[dimension] = this._element[scrollSize] + "px";
  3302. };
  3303. _proto.hide = function hide() {
  3304. var _this2 = this;
  3305. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3306. return;
  3307. }
  3308. var startEvent = $.Event(Event$3.HIDE);
  3309. $(this._element).trigger(startEvent);
  3310. if (startEvent.isDefaultPrevented()) {
  3311. return;
  3312. }
  3313. var dimension = this._getDimension();
  3314. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3315. Util.reflow(this._element);
  3316. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3317. var triggerArrayLength = this._triggerArray.length;
  3318. if (triggerArrayLength > 0) {
  3319. for (var i = 0; i < triggerArrayLength; i++) {
  3320. var trigger = this._triggerArray[i];
  3321. var selector = Util.getSelectorFromElement(trigger);
  3322. if (selector !== null) {
  3323. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3324. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3325. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3326. }
  3327. }
  3328. }
  3329. }
  3330. this.setTransitioning(true);
  3331. var complete = function complete() {
  3332. _this2.setTransitioning(false);
  3333. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3334. };
  3335. this._element.style[dimension] = '';
  3336. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3337. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3338. };
  3339. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3340. this._isTransitioning = isTransitioning;
  3341. };
  3342. _proto.dispose = function dispose() {
  3343. $.removeData(this._element, DATA_KEY$3);
  3344. this._config = null;
  3345. this._parent = null;
  3346. this._element = null;
  3347. this._triggerArray = null;
  3348. this._isTransitioning = null;
  3349. } // Private
  3350. ;
  3351. _proto._getConfig = function _getConfig(config) {
  3352. config = _objectSpread2({}, Default$1, {}, config);
  3353. config.toggle = Boolean(config.toggle); // Coerce string values
  3354. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3355. return config;
  3356. };
  3357. _proto._getDimension = function _getDimension() {
  3358. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3359. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3360. };
  3361. _proto._getParent = function _getParent() {
  3362. var _this3 = this;
  3363. var parent;
  3364. if (Util.isElement(this._config.parent)) {
  3365. parent = this._config.parent; // It's a jQuery object
  3366. if (typeof this._config.parent.jquery !== 'undefined') {
  3367. parent = this._config.parent[0];
  3368. }
  3369. } else {
  3370. parent = document.querySelector(this._config.parent);
  3371. }
  3372. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3373. var children = [].slice.call(parent.querySelectorAll(selector));
  3374. $(children).each(function (i, element) {
  3375. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3376. });
  3377. return parent;
  3378. };
  3379. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3380. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3381. if (triggerArray.length) {
  3382. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3383. }
  3384. } // Static
  3385. ;
  3386. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3387. var selector = Util.getSelectorFromElement(element);
  3388. return selector ? document.querySelector(selector) : null;
  3389. };
  3390. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3391. return this.each(function () {
  3392. var $this = $(this);
  3393. var data = $this.data(DATA_KEY$3);
  3394. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3395. if (!data && _config.toggle && /show|hide/.test(config)) {
  3396. _config.toggle = false;
  3397. }
  3398. if (!data) {
  3399. data = new Collapse(this, _config);
  3400. $this.data(DATA_KEY$3, data);
  3401. }
  3402. if (typeof config === 'string') {
  3403. if (typeof data[config] === 'undefined') {
  3404. throw new TypeError("No method named \"" + config + "\"");
  3405. }
  3406. data[config]();
  3407. }
  3408. });
  3409. };
  3410. _createClass(Collapse, null, [{
  3411. key: "VERSION",
  3412. get: function get() {
  3413. return VERSION$3;
  3414. }
  3415. }, {
  3416. key: "Default",
  3417. get: function get() {
  3418. return Default$1;
  3419. }
  3420. }]);
  3421. return Collapse;
  3422. }();
  3423. /**
  3424. * ------------------------------------------------------------------------
  3425. * Data Api implementation
  3426. * ------------------------------------------------------------------------
  3427. */
  3428. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3429. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3430. if (event.currentTarget.tagName === 'A') {
  3431. event.preventDefault();
  3432. }
  3433. var $trigger = $(this);
  3434. var selector = Util.getSelectorFromElement(this);
  3435. var selectors = [].slice.call(document.querySelectorAll(selector));
  3436. $(selectors).each(function () {
  3437. var $target = $(this);
  3438. var data = $target.data(DATA_KEY$3);
  3439. var config = data ? 'toggle' : $trigger.data();
  3440. Collapse._jQueryInterface.call($target, config);
  3441. });
  3442. });
  3443. /**
  3444. * ------------------------------------------------------------------------
  3445. * jQuery
  3446. * ------------------------------------------------------------------------
  3447. */
  3448. $.fn[NAME$3] = Collapse._jQueryInterface;
  3449. $.fn[NAME$3].Constructor = Collapse;
  3450. $.fn[NAME$3].noConflict = function () {
  3451. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3452. return Collapse._jQueryInterface;
  3453. };
  3454. /**
  3455. * ------------------------------------------------------------------------
  3456. * Constants
  3457. * ------------------------------------------------------------------------
  3458. */
  3459. var NAME$4 = 'dropdown';
  3460. var VERSION$4 = '4.4.1';
  3461. var DATA_KEY$4 = 'bs.dropdown';
  3462. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3463. var DATA_API_KEY$4 = '.data-api';
  3464. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3465. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3466. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3467. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3468. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3469. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3470. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3471. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3472. var Event$4 = {
  3473. HIDE: "hide" + EVENT_KEY$4,
  3474. HIDDEN: "hidden" + EVENT_KEY$4,
  3475. SHOW: "show" + EVENT_KEY$4,
  3476. SHOWN: "shown" + EVENT_KEY$4,
  3477. CLICK: "click" + EVENT_KEY$4,
  3478. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3479. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3480. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3481. };
  3482. var ClassName$4 = {
  3483. DISABLED: 'disabled',
  3484. SHOW: 'show',
  3485. DROPUP: 'dropup',
  3486. DROPRIGHT: 'dropright',
  3487. DROPLEFT: 'dropleft',
  3488. MENURIGHT: 'dropdown-menu-right',
  3489. MENULEFT: 'dropdown-menu-left',
  3490. POSITION_STATIC: 'position-static'
  3491. };
  3492. var Selector$4 = {
  3493. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3494. FORM_CHILD: '.dropdown form',
  3495. MENU: '.dropdown-menu',
  3496. NAVBAR_NAV: '.navbar-nav',
  3497. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3498. };
  3499. var AttachmentMap = {
  3500. TOP: 'top-start',
  3501. TOPEND: 'top-end',
  3502. BOTTOM: 'bottom-start',
  3503. BOTTOMEND: 'bottom-end',
  3504. RIGHT: 'right-start',
  3505. RIGHTEND: 'right-end',
  3506. LEFT: 'left-start',
  3507. LEFTEND: 'left-end'
  3508. };
  3509. var Default$2 = {
  3510. offset: 0,
  3511. flip: true,
  3512. boundary: 'scrollParent',
  3513. reference: 'toggle',
  3514. display: 'dynamic',
  3515. popperConfig: null
  3516. };
  3517. var DefaultType$2 = {
  3518. offset: '(number|string|function)',
  3519. flip: 'boolean',
  3520. boundary: '(string|element)',
  3521. reference: '(string|element)',
  3522. display: 'string',
  3523. popperConfig: '(null|object)'
  3524. };
  3525. /**
  3526. * ------------------------------------------------------------------------
  3527. * Class Definition
  3528. * ------------------------------------------------------------------------
  3529. */
  3530. var Dropdown =
  3531. /*#__PURE__*/
  3532. function () {
  3533. function Dropdown(element, config) {
  3534. this._element = element;
  3535. this._popper = null;
  3536. this._config = this._getConfig(config);
  3537. this._menu = this._getMenuElement();
  3538. this._inNavbar = this._detectNavbar();
  3539. this._addEventListeners();
  3540. } // Getters
  3541. var _proto = Dropdown.prototype;
  3542. // Public
  3543. _proto.toggle = function toggle() {
  3544. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3545. return;
  3546. }
  3547. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3548. Dropdown._clearMenus();
  3549. if (isActive) {
  3550. return;
  3551. }
  3552. this.show(true);
  3553. };
  3554. _proto.show = function show(usePopper) {
  3555. if (usePopper === void 0) {
  3556. usePopper = false;
  3557. }
  3558. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3559. return;
  3560. }
  3561. var relatedTarget = {
  3562. relatedTarget: this._element
  3563. };
  3564. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3565. var parent = Dropdown._getParentFromElement(this._element);
  3566. $(parent).trigger(showEvent);
  3567. if (showEvent.isDefaultPrevented()) {
  3568. return;
  3569. } // Disable totally Popper.js for Dropdown in Navbar
  3570. if (!this._inNavbar && usePopper) {
  3571. /**
  3572. * Check for Popper dependency
  3573. * Popper - https://popper.js.org
  3574. */
  3575. if (typeof Popper === 'undefined') {
  3576. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3577. }
  3578. var referenceElement = this._element;
  3579. if (this._config.reference === 'parent') {
  3580. referenceElement = parent;
  3581. } else if (Util.isElement(this._config.reference)) {
  3582. referenceElement = this._config.reference; // Check if it's jQuery element
  3583. if (typeof this._config.reference.jquery !== 'undefined') {
  3584. referenceElement = this._config.reference[0];
  3585. }
  3586. } // If boundary is not `scrollParent`, then set position to `static`
  3587. // to allow the menu to "escape" the scroll parent's boundaries
  3588. // https://github.com/twbs/bootstrap/issues/24251
  3589. if (this._config.boundary !== 'scrollParent') {
  3590. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3591. }
  3592. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3593. } // If this is a touch-enabled device we add extra
  3594. // empty mouseover listeners to the body's immediate children;
  3595. // only needed because of broken event delegation on iOS
  3596. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3597. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3598. $(document.body).children().on('mouseover', null, $.noop);
  3599. }
  3600. this._element.focus();
  3601. this._element.setAttribute('aria-expanded', true);
  3602. $(this._menu).toggleClass(ClassName$4.SHOW);
  3603. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3604. };
  3605. _proto.hide = function hide() {
  3606. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3607. return;
  3608. }
  3609. var relatedTarget = {
  3610. relatedTarget: this._element
  3611. };
  3612. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3613. var parent = Dropdown._getParentFromElement(this._element);
  3614. $(parent).trigger(hideEvent);
  3615. if (hideEvent.isDefaultPrevented()) {
  3616. return;
  3617. }
  3618. if (this._popper) {
  3619. this._popper.destroy();
  3620. }
  3621. $(this._menu).toggleClass(ClassName$4.SHOW);
  3622. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3623. };
  3624. _proto.dispose = function dispose() {
  3625. $.removeData(this._element, DATA_KEY$4);
  3626. $(this._element).off(EVENT_KEY$4);
  3627. this._element = null;
  3628. this._menu = null;
  3629. if (this._popper !== null) {
  3630. this._popper.destroy();
  3631. this._popper = null;
  3632. }
  3633. };
  3634. _proto.update = function update() {
  3635. this._inNavbar = this._detectNavbar();
  3636. if (this._popper !== null) {
  3637. this._popper.scheduleUpdate();
  3638. }
  3639. } // Private
  3640. ;
  3641. _proto._addEventListeners = function _addEventListeners() {
  3642. var _this = this;
  3643. $(this._element).on(Event$4.CLICK, function (event) {
  3644. event.preventDefault();
  3645. event.stopPropagation();
  3646. _this.toggle();
  3647. });
  3648. };
  3649. _proto._getConfig = function _getConfig(config) {
  3650. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3651. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3652. return config;
  3653. };
  3654. _proto._getMenuElement = function _getMenuElement() {
  3655. if (!this._menu) {
  3656. var parent = Dropdown._getParentFromElement(this._element);
  3657. if (parent) {
  3658. this._menu = parent.querySelector(Selector$4.MENU);
  3659. }
  3660. }
  3661. return this._menu;
  3662. };
  3663. _proto._getPlacement = function _getPlacement() {
  3664. var $parentDropdown = $(this._element.parentNode);
  3665. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3666. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3667. placement = AttachmentMap.TOP;
  3668. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3669. placement = AttachmentMap.TOPEND;
  3670. }
  3671. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3672. placement = AttachmentMap.RIGHT;
  3673. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3674. placement = AttachmentMap.LEFT;
  3675. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3676. placement = AttachmentMap.BOTTOMEND;
  3677. }
  3678. return placement;
  3679. };
  3680. _proto._detectNavbar = function _detectNavbar() {
  3681. return $(this._element).closest('.navbar').length > 0;
  3682. };
  3683. _proto._getOffset = function _getOffset() {
  3684. var _this2 = this;
  3685. var offset = {};
  3686. if (typeof this._config.offset === 'function') {
  3687. offset.fn = function (data) {
  3688. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3689. return data;
  3690. };
  3691. } else {
  3692. offset.offset = this._config.offset;
  3693. }
  3694. return offset;
  3695. };
  3696. _proto._getPopperConfig = function _getPopperConfig() {
  3697. var popperConfig = {
  3698. placement: this._getPlacement(),
  3699. modifiers: {
  3700. offset: this._getOffset(),
  3701. flip: {
  3702. enabled: this._config.flip
  3703. },
  3704. preventOverflow: {
  3705. boundariesElement: this._config.boundary
  3706. }
  3707. }
  3708. }; // Disable Popper.js if we have a static display
  3709. if (this._config.display === 'static') {
  3710. popperConfig.modifiers.applyStyle = {
  3711. enabled: false
  3712. };
  3713. }
  3714. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3715. } // Static
  3716. ;
  3717. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3718. return this.each(function () {
  3719. var data = $(this).data(DATA_KEY$4);
  3720. var _config = typeof config === 'object' ? config : null;
  3721. if (!data) {
  3722. data = new Dropdown(this, _config);
  3723. $(this).data(DATA_KEY$4, data);
  3724. }
  3725. if (typeof config === 'string') {
  3726. if (typeof data[config] === 'undefined') {
  3727. throw new TypeError("No method named \"" + config + "\"");
  3728. }
  3729. data[config]();
  3730. }
  3731. });
  3732. };
  3733. Dropdown._clearMenus = function _clearMenus(event) {
  3734. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3735. return;
  3736. }
  3737. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3738. for (var i = 0, len = toggles.length; i < len; i++) {
  3739. var parent = Dropdown._getParentFromElement(toggles[i]);
  3740. var context = $(toggles[i]).data(DATA_KEY$4);
  3741. var relatedTarget = {
  3742. relatedTarget: toggles[i]
  3743. };
  3744. if (event && event.type === 'click') {
  3745. relatedTarget.clickEvent = event;
  3746. }
  3747. if (!context) {
  3748. continue;
  3749. }
  3750. var dropdownMenu = context._menu;
  3751. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3752. continue;
  3753. }
  3754. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3755. continue;
  3756. }
  3757. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3758. $(parent).trigger(hideEvent);
  3759. if (hideEvent.isDefaultPrevented()) {
  3760. continue;
  3761. } // If this is a touch-enabled device we remove the extra
  3762. // empty mouseover listeners we added for iOS support
  3763. if ('ontouchstart' in document.documentElement) {
  3764. $(document.body).children().off('mouseover', null, $.noop);
  3765. }
  3766. toggles[i].setAttribute('aria-expanded', 'false');
  3767. if (context._popper) {
  3768. context._popper.destroy();
  3769. }
  3770. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3771. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3772. }
  3773. };
  3774. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3775. var parent;
  3776. var selector = Util.getSelectorFromElement(element);
  3777. if (selector) {
  3778. parent = document.querySelector(selector);
  3779. }
  3780. return parent || element.parentNode;
  3781. } // eslint-disable-next-line complexity
  3782. ;
  3783. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3784. // If not input/textarea:
  3785. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3786. // If input/textarea:
  3787. // - If space key => not a dropdown command
  3788. // - If key is other than escape
  3789. // - If key is not up or down => not a dropdown command
  3790. // - If trigger inside the menu => not a dropdown command
  3791. 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)) {
  3792. return;
  3793. }
  3794. event.preventDefault();
  3795. event.stopPropagation();
  3796. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3797. return;
  3798. }
  3799. var parent = Dropdown._getParentFromElement(this);
  3800. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3801. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3802. return;
  3803. }
  3804. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3805. if (event.which === ESCAPE_KEYCODE) {
  3806. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3807. $(toggle).trigger('focus');
  3808. }
  3809. $(this).trigger('click');
  3810. return;
  3811. }
  3812. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3813. return $(item).is(':visible');
  3814. });
  3815. if (items.length === 0) {
  3816. return;
  3817. }
  3818. var index = items.indexOf(event.target);
  3819. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3820. // Up
  3821. index--;
  3822. }
  3823. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3824. // Down
  3825. index++;
  3826. }
  3827. if (index < 0) {
  3828. index = 0;
  3829. }
  3830. items[index].focus();
  3831. };
  3832. _createClass(Dropdown, null, [{
  3833. key: "VERSION",
  3834. get: function get() {
  3835. return VERSION$4;
  3836. }
  3837. }, {
  3838. key: "Default",
  3839. get: function get() {
  3840. return Default$2;
  3841. }
  3842. }, {
  3843. key: "DefaultType",
  3844. get: function get() {
  3845. return DefaultType$2;
  3846. }
  3847. }]);
  3848. return Dropdown;
  3849. }();
  3850. /**
  3851. * ------------------------------------------------------------------------
  3852. * Data Api implementation
  3853. * ------------------------------------------------------------------------
  3854. */
  3855. $(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) {
  3856. event.preventDefault();
  3857. event.stopPropagation();
  3858. Dropdown._jQueryInterface.call($(this), 'toggle');
  3859. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3860. e.stopPropagation();
  3861. });
  3862. /**
  3863. * ------------------------------------------------------------------------
  3864. * jQuery
  3865. * ------------------------------------------------------------------------
  3866. */
  3867. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3868. $.fn[NAME$4].Constructor = Dropdown;
  3869. $.fn[NAME$4].noConflict = function () {
  3870. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3871. return Dropdown._jQueryInterface;
  3872. };
  3873. /**
  3874. * ------------------------------------------------------------------------
  3875. * Constants
  3876. * ------------------------------------------------------------------------
  3877. */
  3878. var NAME$5 = 'modal';
  3879. var VERSION$5 = '4.4.1';
  3880. var DATA_KEY$5 = 'bs.modal';
  3881. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3882. var DATA_API_KEY$5 = '.data-api';
  3883. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3884. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3885. var Default$3 = {
  3886. backdrop: true,
  3887. keyboard: true,
  3888. focus: true,
  3889. show: true
  3890. };
  3891. var DefaultType$3 = {
  3892. backdrop: '(boolean|string)',
  3893. keyboard: 'boolean',
  3894. focus: 'boolean',
  3895. show: 'boolean'
  3896. };
  3897. var Event$5 = {
  3898. HIDE: "hide" + EVENT_KEY$5,
  3899. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  3900. HIDDEN: "hidden" + EVENT_KEY$5,
  3901. SHOW: "show" + EVENT_KEY$5,
  3902. SHOWN: "shown" + EVENT_KEY$5,
  3903. FOCUSIN: "focusin" + EVENT_KEY$5,
  3904. RESIZE: "resize" + EVENT_KEY$5,
  3905. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3906. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3907. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3908. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3909. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3910. };
  3911. var ClassName$5 = {
  3912. SCROLLABLE: 'modal-dialog-scrollable',
  3913. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3914. BACKDROP: 'modal-backdrop',
  3915. OPEN: 'modal-open',
  3916. FADE: 'fade',
  3917. SHOW: 'show',
  3918. STATIC: 'modal-static'
  3919. };
  3920. var Selector$5 = {
  3921. DIALOG: '.modal-dialog',
  3922. MODAL_BODY: '.modal-body',
  3923. DATA_TOGGLE: '[data-toggle="modal"]',
  3924. DATA_DISMISS: '[data-dismiss="modal"]',
  3925. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3926. STICKY_CONTENT: '.sticky-top'
  3927. };
  3928. /**
  3929. * ------------------------------------------------------------------------
  3930. * Class Definition
  3931. * ------------------------------------------------------------------------
  3932. */
  3933. var Modal =
  3934. /*#__PURE__*/
  3935. function () {
  3936. function Modal(element, config) {
  3937. this._config = this._getConfig(config);
  3938. this._element = element;
  3939. this._dialog = element.querySelector(Selector$5.DIALOG);
  3940. this._backdrop = null;
  3941. this._isShown = false;
  3942. this._isBodyOverflowing = false;
  3943. this._ignoreBackdropClick = false;
  3944. this._isTransitioning = false;
  3945. this._scrollbarWidth = 0;
  3946. } // Getters
  3947. var _proto = Modal.prototype;
  3948. // Public
  3949. _proto.toggle = function toggle(relatedTarget) {
  3950. return this._isShown ? this.hide() : this.show(relatedTarget);
  3951. };
  3952. _proto.show = function show(relatedTarget) {
  3953. var _this = this;
  3954. if (this._isShown || this._isTransitioning) {
  3955. return;
  3956. }
  3957. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3958. this._isTransitioning = true;
  3959. }
  3960. var showEvent = $.Event(Event$5.SHOW, {
  3961. relatedTarget: relatedTarget
  3962. });
  3963. $(this._element).trigger(showEvent);
  3964. if (this._isShown || showEvent.isDefaultPrevented()) {
  3965. return;
  3966. }
  3967. this._isShown = true;
  3968. this._checkScrollbar();
  3969. this._setScrollbar();
  3970. this._adjustDialog();
  3971. this._setEscapeEvent();
  3972. this._setResizeEvent();
  3973. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3974. return _this.hide(event);
  3975. });
  3976. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3977. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3978. if ($(event.target).is(_this._element)) {
  3979. _this._ignoreBackdropClick = true;
  3980. }
  3981. });
  3982. });
  3983. this._showBackdrop(function () {
  3984. return _this._showElement(relatedTarget);
  3985. });
  3986. };
  3987. _proto.hide = function hide(event) {
  3988. var _this2 = this;
  3989. if (event) {
  3990. event.preventDefault();
  3991. }
  3992. if (!this._isShown || this._isTransitioning) {
  3993. return;
  3994. }
  3995. var hideEvent = $.Event(Event$5.HIDE);
  3996. $(this._element).trigger(hideEvent);
  3997. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3998. return;
  3999. }
  4000. this._isShown = false;
  4001. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4002. if (transition) {
  4003. this._isTransitioning = true;
  4004. }
  4005. this._setEscapeEvent();
  4006. this._setResizeEvent();
  4007. $(document).off(Event$5.FOCUSIN);
  4008. $(this._element).removeClass(ClassName$5.SHOW);
  4009. $(this._element).off(Event$5.CLICK_DISMISS);
  4010. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4011. if (transition) {
  4012. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4013. $(this._element).one(Util.TRANSITION_END, function (event) {
  4014. return _this2._hideModal(event);
  4015. }).emulateTransitionEnd(transitionDuration);
  4016. } else {
  4017. this._hideModal();
  4018. }
  4019. };
  4020. _proto.dispose = function dispose() {
  4021. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4022. return $(htmlElement).off(EVENT_KEY$5);
  4023. });
  4024. /**
  4025. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4026. * Do not move `document` in `htmlElements` array
  4027. * It will remove `Event.CLICK_DATA_API` event that should remain
  4028. */
  4029. $(document).off(Event$5.FOCUSIN);
  4030. $.removeData(this._element, DATA_KEY$5);
  4031. this._config = null;
  4032. this._element = null;
  4033. this._dialog = null;
  4034. this._backdrop = null;
  4035. this._isShown = null;
  4036. this._isBodyOverflowing = null;
  4037. this._ignoreBackdropClick = null;
  4038. this._isTransitioning = null;
  4039. this._scrollbarWidth = null;
  4040. };
  4041. _proto.handleUpdate = function handleUpdate() {
  4042. this._adjustDialog();
  4043. } // Private
  4044. ;
  4045. _proto._getConfig = function _getConfig(config) {
  4046. config = _objectSpread2({}, Default$3, {}, config);
  4047. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4048. return config;
  4049. };
  4050. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4051. var _this3 = this;
  4052. if (this._config.backdrop === 'static') {
  4053. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4054. $(this._element).trigger(hideEventPrevented);
  4055. if (hideEventPrevented.defaultPrevented) {
  4056. return;
  4057. }
  4058. this._element.classList.add(ClassName$5.STATIC);
  4059. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4060. $(this._element).one(Util.TRANSITION_END, function () {
  4061. _this3._element.classList.remove(ClassName$5.STATIC);
  4062. }).emulateTransitionEnd(modalTransitionDuration);
  4063. this._element.focus();
  4064. } else {
  4065. this.hide();
  4066. }
  4067. };
  4068. _proto._showElement = function _showElement(relatedTarget) {
  4069. var _this4 = this;
  4070. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4071. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4072. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4073. // Don't move modal's DOM position
  4074. document.body.appendChild(this._element);
  4075. }
  4076. this._element.style.display = 'block';
  4077. this._element.removeAttribute('aria-hidden');
  4078. this._element.setAttribute('aria-modal', true);
  4079. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4080. modalBody.scrollTop = 0;
  4081. } else {
  4082. this._element.scrollTop = 0;
  4083. }
  4084. if (transition) {
  4085. Util.reflow(this._element);
  4086. }
  4087. $(this._element).addClass(ClassName$5.SHOW);
  4088. if (this._config.focus) {
  4089. this._enforceFocus();
  4090. }
  4091. var shownEvent = $.Event(Event$5.SHOWN, {
  4092. relatedTarget: relatedTarget
  4093. });
  4094. var transitionComplete = function transitionComplete() {
  4095. if (_this4._config.focus) {
  4096. _this4._element.focus();
  4097. }
  4098. _this4._isTransitioning = false;
  4099. $(_this4._element).trigger(shownEvent);
  4100. };
  4101. if (transition) {
  4102. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4103. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4104. } else {
  4105. transitionComplete();
  4106. }
  4107. };
  4108. _proto._enforceFocus = function _enforceFocus() {
  4109. var _this5 = this;
  4110. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4111. .on(Event$5.FOCUSIN, function (event) {
  4112. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4113. _this5._element.focus();
  4114. }
  4115. });
  4116. };
  4117. _proto._setEscapeEvent = function _setEscapeEvent() {
  4118. var _this6 = this;
  4119. if (this._isShown && this._config.keyboard) {
  4120. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4121. if (event.which === ESCAPE_KEYCODE$1) {
  4122. _this6._triggerBackdropTransition();
  4123. }
  4124. });
  4125. } else if (!this._isShown) {
  4126. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4127. }
  4128. };
  4129. _proto._setResizeEvent = function _setResizeEvent() {
  4130. var _this7 = this;
  4131. if (this._isShown) {
  4132. $(window).on(Event$5.RESIZE, function (event) {
  4133. return _this7.handleUpdate(event);
  4134. });
  4135. } else {
  4136. $(window).off(Event$5.RESIZE);
  4137. }
  4138. };
  4139. _proto._hideModal = function _hideModal() {
  4140. var _this8 = this;
  4141. this._element.style.display = 'none';
  4142. this._element.setAttribute('aria-hidden', true);
  4143. this._element.removeAttribute('aria-modal');
  4144. this._isTransitioning = false;
  4145. this._showBackdrop(function () {
  4146. $(document.body).removeClass(ClassName$5.OPEN);
  4147. _this8._resetAdjustments();
  4148. _this8._resetScrollbar();
  4149. $(_this8._element).trigger(Event$5.HIDDEN);
  4150. });
  4151. };
  4152. _proto._removeBackdrop = function _removeBackdrop() {
  4153. if (this._backdrop) {
  4154. $(this._backdrop).remove();
  4155. this._backdrop = null;
  4156. }
  4157. };
  4158. _proto._showBackdrop = function _showBackdrop(callback) {
  4159. var _this9 = this;
  4160. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4161. if (this._isShown && this._config.backdrop) {
  4162. this._backdrop = document.createElement('div');
  4163. this._backdrop.className = ClassName$5.BACKDROP;
  4164. if (animate) {
  4165. this._backdrop.classList.add(animate);
  4166. }
  4167. $(this._backdrop).appendTo(document.body);
  4168. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4169. if (_this9._ignoreBackdropClick) {
  4170. _this9._ignoreBackdropClick = false;
  4171. return;
  4172. }
  4173. if (event.target !== event.currentTarget) {
  4174. return;
  4175. }
  4176. _this9._triggerBackdropTransition();
  4177. });
  4178. if (animate) {
  4179. Util.reflow(this._backdrop);
  4180. }
  4181. $(this._backdrop).addClass(ClassName$5.SHOW);
  4182. if (!callback) {
  4183. return;
  4184. }
  4185. if (!animate) {
  4186. callback();
  4187. return;
  4188. }
  4189. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4190. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4191. } else if (!this._isShown && this._backdrop) {
  4192. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4193. var callbackRemove = function callbackRemove() {
  4194. _this9._removeBackdrop();
  4195. if (callback) {
  4196. callback();
  4197. }
  4198. };
  4199. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4200. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4201. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4202. } else {
  4203. callbackRemove();
  4204. }
  4205. } else if (callback) {
  4206. callback();
  4207. }
  4208. } // ----------------------------------------------------------------------
  4209. // the following methods are used to handle overflowing modals
  4210. // todo (fat): these should probably be refactored out of modal.js
  4211. // ----------------------------------------------------------------------
  4212. ;
  4213. _proto._adjustDialog = function _adjustDialog() {
  4214. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4215. if (!this._isBodyOverflowing && isModalOverflowing) {
  4216. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4217. }
  4218. if (this._isBodyOverflowing && !isModalOverflowing) {
  4219. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4220. }
  4221. };
  4222. _proto._resetAdjustments = function _resetAdjustments() {
  4223. this._element.style.paddingLeft = '';
  4224. this._element.style.paddingRight = '';
  4225. };
  4226. _proto._checkScrollbar = function _checkScrollbar() {
  4227. var rect = document.body.getBoundingClientRect();
  4228. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4229. this._scrollbarWidth = this._getScrollbarWidth();
  4230. };
  4231. _proto._setScrollbar = function _setScrollbar() {
  4232. var _this10 = this;
  4233. if (this._isBodyOverflowing) {
  4234. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4235. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4236. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4237. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4238. $(fixedContent).each(function (index, element) {
  4239. var actualPadding = element.style.paddingRight;
  4240. var calculatedPadding = $(element).css('padding-right');
  4241. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4242. }); // Adjust sticky content margin
  4243. $(stickyContent).each(function (index, element) {
  4244. var actualMargin = element.style.marginRight;
  4245. var calculatedMargin = $(element).css('margin-right');
  4246. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4247. }); // Adjust body padding
  4248. var actualPadding = document.body.style.paddingRight;
  4249. var calculatedPadding = $(document.body).css('padding-right');
  4250. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4251. }
  4252. $(document.body).addClass(ClassName$5.OPEN);
  4253. };
  4254. _proto._resetScrollbar = function _resetScrollbar() {
  4255. // Restore fixed content padding
  4256. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4257. $(fixedContent).each(function (index, element) {
  4258. var padding = $(element).data('padding-right');
  4259. $(element).removeData('padding-right');
  4260. element.style.paddingRight = padding ? padding : '';
  4261. }); // Restore sticky content
  4262. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4263. $(elements).each(function (index, element) {
  4264. var margin = $(element).data('margin-right');
  4265. if (typeof margin !== 'undefined') {
  4266. $(element).css('margin-right', margin).removeData('margin-right');
  4267. }
  4268. }); // Restore body padding
  4269. var padding = $(document.body).data('padding-right');
  4270. $(document.body).removeData('padding-right');
  4271. document.body.style.paddingRight = padding ? padding : '';
  4272. };
  4273. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4274. // thx d.walsh
  4275. var scrollDiv = document.createElement('div');
  4276. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4277. document.body.appendChild(scrollDiv);
  4278. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4279. document.body.removeChild(scrollDiv);
  4280. return scrollbarWidth;
  4281. } // Static
  4282. ;
  4283. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4284. return this.each(function () {
  4285. var data = $(this).data(DATA_KEY$5);
  4286. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4287. if (!data) {
  4288. data = new Modal(this, _config);
  4289. $(this).data(DATA_KEY$5, data);
  4290. }
  4291. if (typeof config === 'string') {
  4292. if (typeof data[config] === 'undefined') {
  4293. throw new TypeError("No method named \"" + config + "\"");
  4294. }
  4295. data[config](relatedTarget);
  4296. } else if (_config.show) {
  4297. data.show(relatedTarget);
  4298. }
  4299. });
  4300. };
  4301. _createClass(Modal, null, [{
  4302. key: "VERSION",
  4303. get: function get() {
  4304. return VERSION$5;
  4305. }
  4306. }, {
  4307. key: "Default",
  4308. get: function get() {
  4309. return Default$3;
  4310. }
  4311. }]);
  4312. return Modal;
  4313. }();
  4314. /**
  4315. * ------------------------------------------------------------------------
  4316. * Data Api implementation
  4317. * ------------------------------------------------------------------------
  4318. */
  4319. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4320. var _this11 = this;
  4321. var target;
  4322. var selector = Util.getSelectorFromElement(this);
  4323. if (selector) {
  4324. target = document.querySelector(selector);
  4325. }
  4326. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4327. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4328. event.preventDefault();
  4329. }
  4330. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4331. if (showEvent.isDefaultPrevented()) {
  4332. // Only register focus restorer if modal will actually get shown
  4333. return;
  4334. }
  4335. $target.one(Event$5.HIDDEN, function () {
  4336. if ($(_this11).is(':visible')) {
  4337. _this11.focus();
  4338. }
  4339. });
  4340. });
  4341. Modal._jQueryInterface.call($(target), config, this);
  4342. });
  4343. /**
  4344. * ------------------------------------------------------------------------
  4345. * jQuery
  4346. * ------------------------------------------------------------------------
  4347. */
  4348. $.fn[NAME$5] = Modal._jQueryInterface;
  4349. $.fn[NAME$5].Constructor = Modal;
  4350. $.fn[NAME$5].noConflict = function () {
  4351. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4352. return Modal._jQueryInterface;
  4353. };
  4354. /**
  4355. * --------------------------------------------------------------------------
  4356. * Bootstrap (v4.4.1): tools/sanitizer.js
  4357. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4358. * --------------------------------------------------------------------------
  4359. */
  4360. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4361. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4362. var DefaultWhitelist = {
  4363. // Global attributes allowed on any supplied element below.
  4364. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4365. a: ['target', 'href', 'title', 'rel'],
  4366. area: [],
  4367. b: [],
  4368. br: [],
  4369. col: [],
  4370. code: [],
  4371. div: [],
  4372. em: [],
  4373. hr: [],
  4374. h1: [],
  4375. h2: [],
  4376. h3: [],
  4377. h4: [],
  4378. h5: [],
  4379. h6: [],
  4380. i: [],
  4381. img: ['src', 'alt', 'title', 'width', 'height'],
  4382. li: [],
  4383. ol: [],
  4384. p: [],
  4385. pre: [],
  4386. s: [],
  4387. small: [],
  4388. span: [],
  4389. sub: [],
  4390. sup: [],
  4391. strong: [],
  4392. u: [],
  4393. ul: []
  4394. };
  4395. /**
  4396. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4397. *
  4398. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4399. */
  4400. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4401. /**
  4402. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4403. *
  4404. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4405. */
  4406. 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;
  4407. function allowedAttribute(attr, allowedAttributeList) {
  4408. var attrName = attr.nodeName.toLowerCase();
  4409. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4410. if (uriAttrs.indexOf(attrName) !== -1) {
  4411. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4412. }
  4413. return true;
  4414. }
  4415. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4416. return attrRegex instanceof RegExp;
  4417. }); // Check if a regular expression validates the attribute.
  4418. for (var i = 0, l = regExp.length; i < l; i++) {
  4419. if (attrName.match(regExp[i])) {
  4420. return true;
  4421. }
  4422. }
  4423. return false;
  4424. }
  4425. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4426. if (unsafeHtml.length === 0) {
  4427. return unsafeHtml;
  4428. }
  4429. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4430. return sanitizeFn(unsafeHtml);
  4431. }
  4432. var domParser = new window.DOMParser();
  4433. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4434. var whitelistKeys = Object.keys(whiteList);
  4435. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4436. var _loop = function _loop(i, len) {
  4437. var el = elements[i];
  4438. var elName = el.nodeName.toLowerCase();
  4439. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4440. el.parentNode.removeChild(el);
  4441. return "continue";
  4442. }
  4443. var attributeList = [].slice.call(el.attributes);
  4444. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4445. attributeList.forEach(function (attr) {
  4446. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4447. el.removeAttribute(attr.nodeName);
  4448. }
  4449. });
  4450. };
  4451. for (var i = 0, len = elements.length; i < len; i++) {
  4452. var _ret = _loop(i);
  4453. if (_ret === "continue") continue;
  4454. }
  4455. return createdDocument.body.innerHTML;
  4456. }
  4457. /**
  4458. * ------------------------------------------------------------------------
  4459. * Constants
  4460. * ------------------------------------------------------------------------
  4461. */
  4462. var NAME$6 = 'tooltip';
  4463. var VERSION$6 = '4.4.1';
  4464. var DATA_KEY$6 = 'bs.tooltip';
  4465. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4466. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4467. var CLASS_PREFIX = 'bs-tooltip';
  4468. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4469. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4470. var DefaultType$4 = {
  4471. animation: 'boolean',
  4472. template: 'string',
  4473. title: '(string|element|function)',
  4474. trigger: 'string',
  4475. delay: '(number|object)',
  4476. html: 'boolean',
  4477. selector: '(string|boolean)',
  4478. placement: '(string|function)',
  4479. offset: '(number|string|function)',
  4480. container: '(string|element|boolean)',
  4481. fallbackPlacement: '(string|array)',
  4482. boundary: '(string|element)',
  4483. sanitize: 'boolean',
  4484. sanitizeFn: '(null|function)',
  4485. whiteList: 'object',
  4486. popperConfig: '(null|object)'
  4487. };
  4488. var AttachmentMap$1 = {
  4489. AUTO: 'auto',
  4490. TOP: 'top',
  4491. RIGHT: 'right',
  4492. BOTTOM: 'bottom',
  4493. LEFT: 'left'
  4494. };
  4495. var Default$4 = {
  4496. animation: true,
  4497. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4498. trigger: 'hover focus',
  4499. title: '',
  4500. delay: 0,
  4501. html: false,
  4502. selector: false,
  4503. placement: 'top',
  4504. offset: 0,
  4505. container: false,
  4506. fallbackPlacement: 'flip',
  4507. boundary: 'scrollParent',
  4508. sanitize: true,
  4509. sanitizeFn: null,
  4510. whiteList: DefaultWhitelist,
  4511. popperConfig: null
  4512. };
  4513. var HoverState = {
  4514. SHOW: 'show',
  4515. OUT: 'out'
  4516. };
  4517. var Event$6 = {
  4518. HIDE: "hide" + EVENT_KEY$6,
  4519. HIDDEN: "hidden" + EVENT_KEY$6,
  4520. SHOW: "show" + EVENT_KEY$6,
  4521. SHOWN: "shown" + EVENT_KEY$6,
  4522. INSERTED: "inserted" + EVENT_KEY$6,
  4523. CLICK: "click" + EVENT_KEY$6,
  4524. FOCUSIN: "focusin" + EVENT_KEY$6,
  4525. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4526. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4527. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4528. };
  4529. var ClassName$6 = {
  4530. FADE: 'fade',
  4531. SHOW: 'show'
  4532. };
  4533. var Selector$6 = {
  4534. TOOLTIP: '.tooltip',
  4535. TOOLTIP_INNER: '.tooltip-inner',
  4536. ARROW: '.arrow'
  4537. };
  4538. var Trigger = {
  4539. HOVER: 'hover',
  4540. FOCUS: 'focus',
  4541. CLICK: 'click',
  4542. MANUAL: 'manual'
  4543. };
  4544. /**
  4545. * ------------------------------------------------------------------------
  4546. * Class Definition
  4547. * ------------------------------------------------------------------------
  4548. */
  4549. var Tooltip =
  4550. /*#__PURE__*/
  4551. function () {
  4552. function Tooltip(element, config) {
  4553. if (typeof Popper === 'undefined') {
  4554. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4555. } // private
  4556. this._isEnabled = true;
  4557. this._timeout = 0;
  4558. this._hoverState = '';
  4559. this._activeTrigger = {};
  4560. this._popper = null; // Protected
  4561. this.element = element;
  4562. this.config = this._getConfig(config);
  4563. this.tip = null;
  4564. this._setListeners();
  4565. } // Getters
  4566. var _proto = Tooltip.prototype;
  4567. // Public
  4568. _proto.enable = function enable() {
  4569. this._isEnabled = true;
  4570. };
  4571. _proto.disable = function disable() {
  4572. this._isEnabled = false;
  4573. };
  4574. _proto.toggleEnabled = function toggleEnabled() {
  4575. this._isEnabled = !this._isEnabled;
  4576. };
  4577. _proto.toggle = function toggle(event) {
  4578. if (!this._isEnabled) {
  4579. return;
  4580. }
  4581. if (event) {
  4582. var dataKey = this.constructor.DATA_KEY;
  4583. var context = $(event.currentTarget).data(dataKey);
  4584. if (!context) {
  4585. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4586. $(event.currentTarget).data(dataKey, context);
  4587. }
  4588. context._activeTrigger.click = !context._activeTrigger.click;
  4589. if (context._isWithActiveTrigger()) {
  4590. context._enter(null, context);
  4591. } else {
  4592. context._leave(null, context);
  4593. }
  4594. } else {
  4595. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4596. this._leave(null, this);
  4597. return;
  4598. }
  4599. this._enter(null, this);
  4600. }
  4601. };
  4602. _proto.dispose = function dispose() {
  4603. clearTimeout(this._timeout);
  4604. $.removeData(this.element, this.constructor.DATA_KEY);
  4605. $(this.element).off(this.constructor.EVENT_KEY);
  4606. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4607. if (this.tip) {
  4608. $(this.tip).remove();
  4609. }
  4610. this._isEnabled = null;
  4611. this._timeout = null;
  4612. this._hoverState = null;
  4613. this._activeTrigger = null;
  4614. if (this._popper) {
  4615. this._popper.destroy();
  4616. }
  4617. this._popper = null;
  4618. this.element = null;
  4619. this.config = null;
  4620. this.tip = null;
  4621. };
  4622. _proto.show = function show() {
  4623. var _this = this;
  4624. if ($(this.element).css('display') === 'none') {
  4625. throw new Error('Please use show on visible elements');
  4626. }
  4627. var showEvent = $.Event(this.constructor.Event.SHOW);
  4628. if (this.isWithContent() && this._isEnabled) {
  4629. $(this.element).trigger(showEvent);
  4630. var shadowRoot = Util.findShadowRoot(this.element);
  4631. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4632. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4633. return;
  4634. }
  4635. var tip = this.getTipElement();
  4636. var tipId = Util.getUID(this.constructor.NAME);
  4637. tip.setAttribute('id', tipId);
  4638. this.element.setAttribute('aria-describedby', tipId);
  4639. this.setContent();
  4640. if (this.config.animation) {
  4641. $(tip).addClass(ClassName$6.FADE);
  4642. }
  4643. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4644. var attachment = this._getAttachment(placement);
  4645. this.addAttachmentClass(attachment);
  4646. var container = this._getContainer();
  4647. $(tip).data(this.constructor.DATA_KEY, this);
  4648. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4649. $(tip).appendTo(container);
  4650. }
  4651. $(this.element).trigger(this.constructor.Event.INSERTED);
  4652. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4653. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4654. // empty mouseover listeners to the body's immediate children;
  4655. // only needed because of broken event delegation on iOS
  4656. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4657. if ('ontouchstart' in document.documentElement) {
  4658. $(document.body).children().on('mouseover', null, $.noop);
  4659. }
  4660. var complete = function complete() {
  4661. if (_this.config.animation) {
  4662. _this._fixTransition();
  4663. }
  4664. var prevHoverState = _this._hoverState;
  4665. _this._hoverState = null;
  4666. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4667. if (prevHoverState === HoverState.OUT) {
  4668. _this._leave(null, _this);
  4669. }
  4670. };
  4671. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4672. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4673. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4674. } else {
  4675. complete();
  4676. }
  4677. }
  4678. };
  4679. _proto.hide = function hide(callback) {
  4680. var _this2 = this;
  4681. var tip = this.getTipElement();
  4682. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4683. var complete = function complete() {
  4684. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4685. tip.parentNode.removeChild(tip);
  4686. }
  4687. _this2._cleanTipClass();
  4688. _this2.element.removeAttribute('aria-describedby');
  4689. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4690. if (_this2._popper !== null) {
  4691. _this2._popper.destroy();
  4692. }
  4693. if (callback) {
  4694. callback();
  4695. }
  4696. };
  4697. $(this.element).trigger(hideEvent);
  4698. if (hideEvent.isDefaultPrevented()) {
  4699. return;
  4700. }
  4701. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4702. // empty mouseover listeners we added for iOS support
  4703. if ('ontouchstart' in document.documentElement) {
  4704. $(document.body).children().off('mouseover', null, $.noop);
  4705. }
  4706. this._activeTrigger[Trigger.CLICK] = false;
  4707. this._activeTrigger[Trigger.FOCUS] = false;
  4708. this._activeTrigger[Trigger.HOVER] = false;
  4709. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4710. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4711. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4712. } else {
  4713. complete();
  4714. }
  4715. this._hoverState = '';
  4716. };
  4717. _proto.update = function update() {
  4718. if (this._popper !== null) {
  4719. this._popper.scheduleUpdate();
  4720. }
  4721. } // Protected
  4722. ;
  4723. _proto.isWithContent = function isWithContent() {
  4724. return Boolean(this.getTitle());
  4725. };
  4726. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4727. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4728. };
  4729. _proto.getTipElement = function getTipElement() {
  4730. this.tip = this.tip || $(this.config.template)[0];
  4731. return this.tip;
  4732. };
  4733. _proto.setContent = function setContent() {
  4734. var tip = this.getTipElement();
  4735. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4736. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4737. };
  4738. _proto.setElementContent = function setElementContent($element, content) {
  4739. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4740. // Content is a DOM node or a jQuery
  4741. if (this.config.html) {
  4742. if (!$(content).parent().is($element)) {
  4743. $element.empty().append(content);
  4744. }
  4745. } else {
  4746. $element.text($(content).text());
  4747. }
  4748. return;
  4749. }
  4750. if (this.config.html) {
  4751. if (this.config.sanitize) {
  4752. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4753. }
  4754. $element.html(content);
  4755. } else {
  4756. $element.text(content);
  4757. }
  4758. };
  4759. _proto.getTitle = function getTitle() {
  4760. var title = this.element.getAttribute('data-original-title');
  4761. if (!title) {
  4762. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4763. }
  4764. return title;
  4765. } // Private
  4766. ;
  4767. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4768. var _this3 = this;
  4769. var defaultBsConfig = {
  4770. placement: attachment,
  4771. modifiers: {
  4772. offset: this._getOffset(),
  4773. flip: {
  4774. behavior: this.config.fallbackPlacement
  4775. },
  4776. arrow: {
  4777. element: Selector$6.ARROW
  4778. },
  4779. preventOverflow: {
  4780. boundariesElement: this.config.boundary
  4781. }
  4782. },
  4783. onCreate: function onCreate(data) {
  4784. if (data.originalPlacement !== data.placement) {
  4785. _this3._handlePopperPlacementChange(data);
  4786. }
  4787. },
  4788. onUpdate: function onUpdate(data) {
  4789. return _this3._handlePopperPlacementChange(data);
  4790. }
  4791. };
  4792. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4793. };
  4794. _proto._getOffset = function _getOffset() {
  4795. var _this4 = this;
  4796. var offset = {};
  4797. if (typeof this.config.offset === 'function') {
  4798. offset.fn = function (data) {
  4799. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4800. return data;
  4801. };
  4802. } else {
  4803. offset.offset = this.config.offset;
  4804. }
  4805. return offset;
  4806. };
  4807. _proto._getContainer = function _getContainer() {
  4808. if (this.config.container === false) {
  4809. return document.body;
  4810. }
  4811. if (Util.isElement(this.config.container)) {
  4812. return $(this.config.container);
  4813. }
  4814. return $(document).find(this.config.container);
  4815. };
  4816. _proto._getAttachment = function _getAttachment(placement) {
  4817. return AttachmentMap$1[placement.toUpperCase()];
  4818. };
  4819. _proto._setListeners = function _setListeners() {
  4820. var _this5 = this;
  4821. var triggers = this.config.trigger.split(' ');
  4822. triggers.forEach(function (trigger) {
  4823. if (trigger === 'click') {
  4824. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4825. return _this5.toggle(event);
  4826. });
  4827. } else if (trigger !== Trigger.MANUAL) {
  4828. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4829. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4830. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4831. return _this5._enter(event);
  4832. }).on(eventOut, _this5.config.selector, function (event) {
  4833. return _this5._leave(event);
  4834. });
  4835. }
  4836. });
  4837. this._hideModalHandler = function () {
  4838. if (_this5.element) {
  4839. _this5.hide();
  4840. }
  4841. };
  4842. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4843. if (this.config.selector) {
  4844. this.config = _objectSpread2({}, this.config, {
  4845. trigger: 'manual',
  4846. selector: ''
  4847. });
  4848. } else {
  4849. this._fixTitle();
  4850. }
  4851. };
  4852. _proto._fixTitle = function _fixTitle() {
  4853. var titleType = typeof this.element.getAttribute('data-original-title');
  4854. if (this.element.getAttribute('title') || titleType !== 'string') {
  4855. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4856. this.element.setAttribute('title', '');
  4857. }
  4858. };
  4859. _proto._enter = function _enter(event, context) {
  4860. var dataKey = this.constructor.DATA_KEY;
  4861. context = context || $(event.currentTarget).data(dataKey);
  4862. if (!context) {
  4863. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4864. $(event.currentTarget).data(dataKey, context);
  4865. }
  4866. if (event) {
  4867. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4868. }
  4869. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4870. context._hoverState = HoverState.SHOW;
  4871. return;
  4872. }
  4873. clearTimeout(context._timeout);
  4874. context._hoverState = HoverState.SHOW;
  4875. if (!context.config.delay || !context.config.delay.show) {
  4876. context.show();
  4877. return;
  4878. }
  4879. context._timeout = setTimeout(function () {
  4880. if (context._hoverState === HoverState.SHOW) {
  4881. context.show();
  4882. }
  4883. }, context.config.delay.show);
  4884. };
  4885. _proto._leave = function _leave(event, context) {
  4886. var dataKey = this.constructor.DATA_KEY;
  4887. context = context || $(event.currentTarget).data(dataKey);
  4888. if (!context) {
  4889. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4890. $(event.currentTarget).data(dataKey, context);
  4891. }
  4892. if (event) {
  4893. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4894. }
  4895. if (context._isWithActiveTrigger()) {
  4896. return;
  4897. }
  4898. clearTimeout(context._timeout);
  4899. context._hoverState = HoverState.OUT;
  4900. if (!context.config.delay || !context.config.delay.hide) {
  4901. context.hide();
  4902. return;
  4903. }
  4904. context._timeout = setTimeout(function () {
  4905. if (context._hoverState === HoverState.OUT) {
  4906. context.hide();
  4907. }
  4908. }, context.config.delay.hide);
  4909. };
  4910. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4911. for (var trigger in this._activeTrigger) {
  4912. if (this._activeTrigger[trigger]) {
  4913. return true;
  4914. }
  4915. }
  4916. return false;
  4917. };
  4918. _proto._getConfig = function _getConfig(config) {
  4919. var dataAttributes = $(this.element).data();
  4920. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4921. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4922. delete dataAttributes[dataAttr];
  4923. }
  4924. });
  4925. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  4926. if (typeof config.delay === 'number') {
  4927. config.delay = {
  4928. show: config.delay,
  4929. hide: config.delay
  4930. };
  4931. }
  4932. if (typeof config.title === 'number') {
  4933. config.title = config.title.toString();
  4934. }
  4935. if (typeof config.content === 'number') {
  4936. config.content = config.content.toString();
  4937. }
  4938. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4939. if (config.sanitize) {
  4940. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4941. }
  4942. return config;
  4943. };
  4944. _proto._getDelegateConfig = function _getDelegateConfig() {
  4945. var config = {};
  4946. if (this.config) {
  4947. for (var key in this.config) {
  4948. if (this.constructor.Default[key] !== this.config[key]) {
  4949. config[key] = this.config[key];
  4950. }
  4951. }
  4952. }
  4953. return config;
  4954. };
  4955. _proto._cleanTipClass = function _cleanTipClass() {
  4956. var $tip = $(this.getTipElement());
  4957. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4958. if (tabClass !== null && tabClass.length) {
  4959. $tip.removeClass(tabClass.join(''));
  4960. }
  4961. };
  4962. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4963. var popperInstance = popperData.instance;
  4964. this.tip = popperInstance.popper;
  4965. this._cleanTipClass();
  4966. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4967. };
  4968. _proto._fixTransition = function _fixTransition() {
  4969. var tip = this.getTipElement();
  4970. var initConfigAnimation = this.config.animation;
  4971. if (tip.getAttribute('x-placement') !== null) {
  4972. return;
  4973. }
  4974. $(tip).removeClass(ClassName$6.FADE);
  4975. this.config.animation = false;
  4976. this.hide();
  4977. this.show();
  4978. this.config.animation = initConfigAnimation;
  4979. } // Static
  4980. ;
  4981. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4982. return this.each(function () {
  4983. var data = $(this).data(DATA_KEY$6);
  4984. var _config = typeof config === 'object' && config;
  4985. if (!data && /dispose|hide/.test(config)) {
  4986. return;
  4987. }
  4988. if (!data) {
  4989. data = new Tooltip(this, _config);
  4990. $(this).data(DATA_KEY$6, data);
  4991. }
  4992. if (typeof config === 'string') {
  4993. if (typeof data[config] === 'undefined') {
  4994. throw new TypeError("No method named \"" + config + "\"");
  4995. }
  4996. data[config]();
  4997. }
  4998. });
  4999. };
  5000. _createClass(Tooltip, null, [{
  5001. key: "VERSION",
  5002. get: function get() {
  5003. return VERSION$6;
  5004. }
  5005. }, {
  5006. key: "Default",
  5007. get: function get() {
  5008. return Default$4;
  5009. }
  5010. }, {
  5011. key: "NAME",
  5012. get: function get() {
  5013. return NAME$6;
  5014. }
  5015. }, {
  5016. key: "DATA_KEY",
  5017. get: function get() {
  5018. return DATA_KEY$6;
  5019. }
  5020. }, {
  5021. key: "Event",
  5022. get: function get() {
  5023. return Event$6;
  5024. }
  5025. }, {
  5026. key: "EVENT_KEY",
  5027. get: function get() {
  5028. return EVENT_KEY$6;
  5029. }
  5030. }, {
  5031. key: "DefaultType",
  5032. get: function get() {
  5033. return DefaultType$4;
  5034. }
  5035. }]);
  5036. return Tooltip;
  5037. }();
  5038. /**
  5039. * ------------------------------------------------------------------------
  5040. * jQuery
  5041. * ------------------------------------------------------------------------
  5042. */
  5043. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5044. $.fn[NAME$6].Constructor = Tooltip;
  5045. $.fn[NAME$6].noConflict = function () {
  5046. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5047. return Tooltip._jQueryInterface;
  5048. };
  5049. /**
  5050. * ------------------------------------------------------------------------
  5051. * Constants
  5052. * ------------------------------------------------------------------------
  5053. */
  5054. var NAME$7 = 'popover';
  5055. var VERSION$7 = '4.4.1';
  5056. var DATA_KEY$7 = 'bs.popover';
  5057. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5058. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5059. var CLASS_PREFIX$1 = 'bs-popover';
  5060. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5061. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5062. placement: 'right',
  5063. trigger: 'click',
  5064. content: '',
  5065. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5066. });
  5067. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5068. content: '(string|element|function)'
  5069. });
  5070. var ClassName$7 = {
  5071. FADE: 'fade',
  5072. SHOW: 'show'
  5073. };
  5074. var Selector$7 = {
  5075. TITLE: '.popover-header',
  5076. CONTENT: '.popover-body'
  5077. };
  5078. var Event$7 = {
  5079. HIDE: "hide" + EVENT_KEY$7,
  5080. HIDDEN: "hidden" + EVENT_KEY$7,
  5081. SHOW: "show" + EVENT_KEY$7,
  5082. SHOWN: "shown" + EVENT_KEY$7,
  5083. INSERTED: "inserted" + EVENT_KEY$7,
  5084. CLICK: "click" + EVENT_KEY$7,
  5085. FOCUSIN: "focusin" + EVENT_KEY$7,
  5086. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5087. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5088. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5089. };
  5090. /**
  5091. * ------------------------------------------------------------------------
  5092. * Class Definition
  5093. * ------------------------------------------------------------------------
  5094. */
  5095. var Popover =
  5096. /*#__PURE__*/
  5097. function (_Tooltip) {
  5098. _inheritsLoose(Popover, _Tooltip);
  5099. function Popover() {
  5100. return _Tooltip.apply(this, arguments) || this;
  5101. }
  5102. var _proto = Popover.prototype;
  5103. // Overrides
  5104. _proto.isWithContent = function isWithContent() {
  5105. return this.getTitle() || this._getContent();
  5106. };
  5107. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5108. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5109. };
  5110. _proto.getTipElement = function getTipElement() {
  5111. this.tip = this.tip || $(this.config.template)[0];
  5112. return this.tip;
  5113. };
  5114. _proto.setContent = function setContent() {
  5115. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5116. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5117. var content = this._getContent();
  5118. if (typeof content === 'function') {
  5119. content = content.call(this.element);
  5120. }
  5121. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5122. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5123. } // Private
  5124. ;
  5125. _proto._getContent = function _getContent() {
  5126. return this.element.getAttribute('data-content') || this.config.content;
  5127. };
  5128. _proto._cleanTipClass = function _cleanTipClass() {
  5129. var $tip = $(this.getTipElement());
  5130. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5131. if (tabClass !== null && tabClass.length > 0) {
  5132. $tip.removeClass(tabClass.join(''));
  5133. }
  5134. } // Static
  5135. ;
  5136. Popover._jQueryInterface = function _jQueryInterface(config) {
  5137. return this.each(function () {
  5138. var data = $(this).data(DATA_KEY$7);
  5139. var _config = typeof config === 'object' ? config : null;
  5140. if (!data && /dispose|hide/.test(config)) {
  5141. return;
  5142. }
  5143. if (!data) {
  5144. data = new Popover(this, _config);
  5145. $(this).data(DATA_KEY$7, data);
  5146. }
  5147. if (typeof config === 'string') {
  5148. if (typeof data[config] === 'undefined') {
  5149. throw new TypeError("No method named \"" + config + "\"");
  5150. }
  5151. data[config]();
  5152. }
  5153. });
  5154. };
  5155. _createClass(Popover, null, [{
  5156. key: "VERSION",
  5157. // Getters
  5158. get: function get() {
  5159. return VERSION$7;
  5160. }
  5161. }, {
  5162. key: "Default",
  5163. get: function get() {
  5164. return Default$5;
  5165. }
  5166. }, {
  5167. key: "NAME",
  5168. get: function get() {
  5169. return NAME$7;
  5170. }
  5171. }, {
  5172. key: "DATA_KEY",
  5173. get: function get() {
  5174. return DATA_KEY$7;
  5175. }
  5176. }, {
  5177. key: "Event",
  5178. get: function get() {
  5179. return Event$7;
  5180. }
  5181. }, {
  5182. key: "EVENT_KEY",
  5183. get: function get() {
  5184. return EVENT_KEY$7;
  5185. }
  5186. }, {
  5187. key: "DefaultType",
  5188. get: function get() {
  5189. return DefaultType$5;
  5190. }
  5191. }]);
  5192. return Popover;
  5193. }(Tooltip);
  5194. /**
  5195. * ------------------------------------------------------------------------
  5196. * jQuery
  5197. * ------------------------------------------------------------------------
  5198. */
  5199. $.fn[NAME$7] = Popover._jQueryInterface;
  5200. $.fn[NAME$7].Constructor = Popover;
  5201. $.fn[NAME$7].noConflict = function () {
  5202. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5203. return Popover._jQueryInterface;
  5204. };
  5205. /**
  5206. * ------------------------------------------------------------------------
  5207. * Constants
  5208. * ------------------------------------------------------------------------
  5209. */
  5210. var NAME$8 = 'scrollspy';
  5211. var VERSION$8 = '4.4.1';
  5212. var DATA_KEY$8 = 'bs.scrollspy';
  5213. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5214. var DATA_API_KEY$6 = '.data-api';
  5215. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5216. var Default$6 = {
  5217. offset: 10,
  5218. method: 'auto',
  5219. target: ''
  5220. };
  5221. var DefaultType$6 = {
  5222. offset: 'number',
  5223. method: 'string',
  5224. target: '(string|element)'
  5225. };
  5226. var Event$8 = {
  5227. ACTIVATE: "activate" + EVENT_KEY$8,
  5228. SCROLL: "scroll" + EVENT_KEY$8,
  5229. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5230. };
  5231. var ClassName$8 = {
  5232. DROPDOWN_ITEM: 'dropdown-item',
  5233. DROPDOWN_MENU: 'dropdown-menu',
  5234. ACTIVE: 'active'
  5235. };
  5236. var Selector$8 = {
  5237. DATA_SPY: '[data-spy="scroll"]',
  5238. ACTIVE: '.active',
  5239. NAV_LIST_GROUP: '.nav, .list-group',
  5240. NAV_LINKS: '.nav-link',
  5241. NAV_ITEMS: '.nav-item',
  5242. LIST_ITEMS: '.list-group-item',
  5243. DROPDOWN: '.dropdown',
  5244. DROPDOWN_ITEMS: '.dropdown-item',
  5245. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5246. };
  5247. var OffsetMethod = {
  5248. OFFSET: 'offset',
  5249. POSITION: 'position'
  5250. };
  5251. /**
  5252. * ------------------------------------------------------------------------
  5253. * Class Definition
  5254. * ------------------------------------------------------------------------
  5255. */
  5256. var ScrollSpy =
  5257. /*#__PURE__*/
  5258. function () {
  5259. function ScrollSpy(element, config) {
  5260. var _this = this;
  5261. this._element = element;
  5262. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5263. this._config = this._getConfig(config);
  5264. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5265. this._offsets = [];
  5266. this._targets = [];
  5267. this._activeTarget = null;
  5268. this._scrollHeight = 0;
  5269. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5270. return _this._process(event);
  5271. });
  5272. this.refresh();
  5273. this._process();
  5274. } // Getters
  5275. var _proto = ScrollSpy.prototype;
  5276. // Public
  5277. _proto.refresh = function refresh() {
  5278. var _this2 = this;
  5279. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5280. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5281. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5282. this._offsets = [];
  5283. this._targets = [];
  5284. this._scrollHeight = this._getScrollHeight();
  5285. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5286. targets.map(function (element) {
  5287. var target;
  5288. var targetSelector = Util.getSelectorFromElement(element);
  5289. if (targetSelector) {
  5290. target = document.querySelector(targetSelector);
  5291. }
  5292. if (target) {
  5293. var targetBCR = target.getBoundingClientRect();
  5294. if (targetBCR.width || targetBCR.height) {
  5295. // TODO (fat): remove sketch reliance on jQuery position/offset
  5296. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5297. }
  5298. }
  5299. return null;
  5300. }).filter(function (item) {
  5301. return item;
  5302. }).sort(function (a, b) {
  5303. return a[0] - b[0];
  5304. }).forEach(function (item) {
  5305. _this2._offsets.push(item[0]);
  5306. _this2._targets.push(item[1]);
  5307. });
  5308. };
  5309. _proto.dispose = function dispose() {
  5310. $.removeData(this._element, DATA_KEY$8);
  5311. $(this._scrollElement).off(EVENT_KEY$8);
  5312. this._element = null;
  5313. this._scrollElement = null;
  5314. this._config = null;
  5315. this._selector = null;
  5316. this._offsets = null;
  5317. this._targets = null;
  5318. this._activeTarget = null;
  5319. this._scrollHeight = null;
  5320. } // Private
  5321. ;
  5322. _proto._getConfig = function _getConfig(config) {
  5323. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5324. if (typeof config.target !== 'string') {
  5325. var id = $(config.target).attr('id');
  5326. if (!id) {
  5327. id = Util.getUID(NAME$8);
  5328. $(config.target).attr('id', id);
  5329. }
  5330. config.target = "#" + id;
  5331. }
  5332. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5333. return config;
  5334. };
  5335. _proto._getScrollTop = function _getScrollTop() {
  5336. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5337. };
  5338. _proto._getScrollHeight = function _getScrollHeight() {
  5339. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5340. };
  5341. _proto._getOffsetHeight = function _getOffsetHeight() {
  5342. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5343. };
  5344. _proto._process = function _process() {
  5345. var scrollTop = this._getScrollTop() + this._config.offset;
  5346. var scrollHeight = this._getScrollHeight();
  5347. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5348. if (this._scrollHeight !== scrollHeight) {
  5349. this.refresh();
  5350. }
  5351. if (scrollTop >= maxScroll) {
  5352. var target = this._targets[this._targets.length - 1];
  5353. if (this._activeTarget !== target) {
  5354. this._activate(target);
  5355. }
  5356. return;
  5357. }
  5358. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5359. this._activeTarget = null;
  5360. this._clear();
  5361. return;
  5362. }
  5363. var offsetLength = this._offsets.length;
  5364. for (var i = offsetLength; i--;) {
  5365. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5366. if (isActiveTarget) {
  5367. this._activate(this._targets[i]);
  5368. }
  5369. }
  5370. };
  5371. _proto._activate = function _activate(target) {
  5372. this._activeTarget = target;
  5373. this._clear();
  5374. var queries = this._selector.split(',').map(function (selector) {
  5375. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5376. });
  5377. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5378. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5379. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5380. $link.addClass(ClassName$8.ACTIVE);
  5381. } else {
  5382. // Set triggered link as active
  5383. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5384. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5385. $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
  5386. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5387. }
  5388. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5389. relatedTarget: target
  5390. });
  5391. };
  5392. _proto._clear = function _clear() {
  5393. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5394. return node.classList.contains(ClassName$8.ACTIVE);
  5395. }).forEach(function (node) {
  5396. return node.classList.remove(ClassName$8.ACTIVE);
  5397. });
  5398. } // Static
  5399. ;
  5400. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5401. return this.each(function () {
  5402. var data = $(this).data(DATA_KEY$8);
  5403. var _config = typeof config === 'object' && config;
  5404. if (!data) {
  5405. data = new ScrollSpy(this, _config);
  5406. $(this).data(DATA_KEY$8, data);
  5407. }
  5408. if (typeof config === 'string') {
  5409. if (typeof data[config] === 'undefined') {
  5410. throw new TypeError("No method named \"" + config + "\"");
  5411. }
  5412. data[config]();
  5413. }
  5414. });
  5415. };
  5416. _createClass(ScrollSpy, null, [{
  5417. key: "VERSION",
  5418. get: function get() {
  5419. return VERSION$8;
  5420. }
  5421. }, {
  5422. key: "Default",
  5423. get: function get() {
  5424. return Default$6;
  5425. }
  5426. }]);
  5427. return ScrollSpy;
  5428. }();
  5429. /**
  5430. * ------------------------------------------------------------------------
  5431. * Data Api implementation
  5432. * ------------------------------------------------------------------------
  5433. */
  5434. $(window).on(Event$8.LOAD_DATA_API, function () {
  5435. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5436. var scrollSpysLength = scrollSpys.length;
  5437. for (var i = scrollSpysLength; i--;) {
  5438. var $spy = $(scrollSpys[i]);
  5439. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5440. }
  5441. });
  5442. /**
  5443. * ------------------------------------------------------------------------
  5444. * jQuery
  5445. * ------------------------------------------------------------------------
  5446. */
  5447. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5448. $.fn[NAME$8].Constructor = ScrollSpy;
  5449. $.fn[NAME$8].noConflict = function () {
  5450. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5451. return ScrollSpy._jQueryInterface;
  5452. };
  5453. /**
  5454. * ------------------------------------------------------------------------
  5455. * Constants
  5456. * ------------------------------------------------------------------------
  5457. */
  5458. var NAME$9 = 'tab';
  5459. var VERSION$9 = '4.4.1';
  5460. var DATA_KEY$9 = 'bs.tab';
  5461. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5462. var DATA_API_KEY$7 = '.data-api';
  5463. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5464. var Event$9 = {
  5465. HIDE: "hide" + EVENT_KEY$9,
  5466. HIDDEN: "hidden" + EVENT_KEY$9,
  5467. SHOW: "show" + EVENT_KEY$9,
  5468. SHOWN: "shown" + EVENT_KEY$9,
  5469. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5470. };
  5471. var ClassName$9 = {
  5472. DROPDOWN_MENU: 'dropdown-menu',
  5473. ACTIVE: 'active',
  5474. DISABLED: 'disabled',
  5475. FADE: 'fade',
  5476. SHOW: 'show'
  5477. };
  5478. var Selector$9 = {
  5479. DROPDOWN: '.dropdown',
  5480. NAV_LIST_GROUP: '.nav, .list-group',
  5481. ACTIVE: '.active',
  5482. ACTIVE_UL: '> li > .active',
  5483. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5484. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5485. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5486. };
  5487. /**
  5488. * ------------------------------------------------------------------------
  5489. * Class Definition
  5490. * ------------------------------------------------------------------------
  5491. */
  5492. var Tab =
  5493. /*#__PURE__*/
  5494. function () {
  5495. function Tab(element) {
  5496. this._element = element;
  5497. } // Getters
  5498. var _proto = Tab.prototype;
  5499. // Public
  5500. _proto.show = function show() {
  5501. var _this = this;
  5502. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5503. return;
  5504. }
  5505. var target;
  5506. var previous;
  5507. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5508. var selector = Util.getSelectorFromElement(this._element);
  5509. if (listElement) {
  5510. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5511. previous = $.makeArray($(listElement).find(itemSelector));
  5512. previous = previous[previous.length - 1];
  5513. }
  5514. var hideEvent = $.Event(Event$9.HIDE, {
  5515. relatedTarget: this._element
  5516. });
  5517. var showEvent = $.Event(Event$9.SHOW, {
  5518. relatedTarget: previous
  5519. });
  5520. if (previous) {
  5521. $(previous).trigger(hideEvent);
  5522. }
  5523. $(this._element).trigger(showEvent);
  5524. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5525. return;
  5526. }
  5527. if (selector) {
  5528. target = document.querySelector(selector);
  5529. }
  5530. this._activate(this._element, listElement);
  5531. var complete = function complete() {
  5532. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5533. relatedTarget: _this._element
  5534. });
  5535. var shownEvent = $.Event(Event$9.SHOWN, {
  5536. relatedTarget: previous
  5537. });
  5538. $(previous).trigger(hiddenEvent);
  5539. $(_this._element).trigger(shownEvent);
  5540. };
  5541. if (target) {
  5542. this._activate(target, target.parentNode, complete);
  5543. } else {
  5544. complete();
  5545. }
  5546. };
  5547. _proto.dispose = function dispose() {
  5548. $.removeData(this._element, DATA_KEY$9);
  5549. this._element = null;
  5550. } // Private
  5551. ;
  5552. _proto._activate = function _activate(element, container, callback) {
  5553. var _this2 = this;
  5554. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5555. var active = activeElements[0];
  5556. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5557. var complete = function complete() {
  5558. return _this2._transitionComplete(element, active, callback);
  5559. };
  5560. if (active && isTransitioning) {
  5561. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5562. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5563. } else {
  5564. complete();
  5565. }
  5566. };
  5567. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5568. if (active) {
  5569. $(active).removeClass(ClassName$9.ACTIVE);
  5570. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5571. if (dropdownChild) {
  5572. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5573. }
  5574. if (active.getAttribute('role') === 'tab') {
  5575. active.setAttribute('aria-selected', false);
  5576. }
  5577. }
  5578. $(element).addClass(ClassName$9.ACTIVE);
  5579. if (element.getAttribute('role') === 'tab') {
  5580. element.setAttribute('aria-selected', true);
  5581. }
  5582. Util.reflow(element);
  5583. if (element.classList.contains(ClassName$9.FADE)) {
  5584. element.classList.add(ClassName$9.SHOW);
  5585. }
  5586. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5587. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5588. if (dropdownElement) {
  5589. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5590. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5591. }
  5592. element.setAttribute('aria-expanded', true);
  5593. }
  5594. if (callback) {
  5595. callback();
  5596. }
  5597. } // Static
  5598. ;
  5599. Tab._jQueryInterface = function _jQueryInterface(config) {
  5600. return this.each(function () {
  5601. var $this = $(this);
  5602. var data = $this.data(DATA_KEY$9);
  5603. if (!data) {
  5604. data = new Tab(this);
  5605. $this.data(DATA_KEY$9, data);
  5606. }
  5607. if (typeof config === 'string') {
  5608. if (typeof data[config] === 'undefined') {
  5609. throw new TypeError("No method named \"" + config + "\"");
  5610. }
  5611. data[config]();
  5612. }
  5613. });
  5614. };
  5615. _createClass(Tab, null, [{
  5616. key: "VERSION",
  5617. get: function get() {
  5618. return VERSION$9;
  5619. }
  5620. }]);
  5621. return Tab;
  5622. }();
  5623. /**
  5624. * ------------------------------------------------------------------------
  5625. * Data Api implementation
  5626. * ------------------------------------------------------------------------
  5627. */
  5628. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5629. event.preventDefault();
  5630. Tab._jQueryInterface.call($(this), 'show');
  5631. });
  5632. /**
  5633. * ------------------------------------------------------------------------
  5634. * jQuery
  5635. * ------------------------------------------------------------------------
  5636. */
  5637. $.fn[NAME$9] = Tab._jQueryInterface;
  5638. $.fn[NAME$9].Constructor = Tab;
  5639. $.fn[NAME$9].noConflict = function () {
  5640. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5641. return Tab._jQueryInterface;
  5642. };
  5643. /**
  5644. * ------------------------------------------------------------------------
  5645. * Constants
  5646. * ------------------------------------------------------------------------
  5647. */
  5648. var NAME$a = 'toast';
  5649. var VERSION$a = '4.4.1';
  5650. var DATA_KEY$a = 'bs.toast';
  5651. var EVENT_KEY$a = "." + DATA_KEY$a;
  5652. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5653. var Event$a = {
  5654. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5655. HIDE: "hide" + EVENT_KEY$a,
  5656. HIDDEN: "hidden" + EVENT_KEY$a,
  5657. SHOW: "show" + EVENT_KEY$a,
  5658. SHOWN: "shown" + EVENT_KEY$a
  5659. };
  5660. var ClassName$a = {
  5661. FADE: 'fade',
  5662. HIDE: 'hide',
  5663. SHOW: 'show',
  5664. SHOWING: 'showing'
  5665. };
  5666. var DefaultType$7 = {
  5667. animation: 'boolean',
  5668. autohide: 'boolean',
  5669. delay: 'number'
  5670. };
  5671. var Default$7 = {
  5672. animation: true,
  5673. autohide: true,
  5674. delay: 500
  5675. };
  5676. var Selector$a = {
  5677. DATA_DISMISS: '[data-dismiss="toast"]'
  5678. };
  5679. /**
  5680. * ------------------------------------------------------------------------
  5681. * Class Definition
  5682. * ------------------------------------------------------------------------
  5683. */
  5684. var Toast =
  5685. /*#__PURE__*/
  5686. function () {
  5687. function Toast(element, config) {
  5688. this._element = element;
  5689. this._config = this._getConfig(config);
  5690. this._timeout = null;
  5691. this._setListeners();
  5692. } // Getters
  5693. var _proto = Toast.prototype;
  5694. // Public
  5695. _proto.show = function show() {
  5696. var _this = this;
  5697. var showEvent = $.Event(Event$a.SHOW);
  5698. $(this._element).trigger(showEvent);
  5699. if (showEvent.isDefaultPrevented()) {
  5700. return;
  5701. }
  5702. if (this._config.animation) {
  5703. this._element.classList.add(ClassName$a.FADE);
  5704. }
  5705. var complete = function complete() {
  5706. _this._element.classList.remove(ClassName$a.SHOWING);
  5707. _this._element.classList.add(ClassName$a.SHOW);
  5708. $(_this._element).trigger(Event$a.SHOWN);
  5709. if (_this._config.autohide) {
  5710. _this._timeout = setTimeout(function () {
  5711. _this.hide();
  5712. }, _this._config.delay);
  5713. }
  5714. };
  5715. this._element.classList.remove(ClassName$a.HIDE);
  5716. Util.reflow(this._element);
  5717. this._element.classList.add(ClassName$a.SHOWING);
  5718. if (this._config.animation) {
  5719. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5720. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5721. } else {
  5722. complete();
  5723. }
  5724. };
  5725. _proto.hide = function hide() {
  5726. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5727. return;
  5728. }
  5729. var hideEvent = $.Event(Event$a.HIDE);
  5730. $(this._element).trigger(hideEvent);
  5731. if (hideEvent.isDefaultPrevented()) {
  5732. return;
  5733. }
  5734. this._close();
  5735. };
  5736. _proto.dispose = function dispose() {
  5737. clearTimeout(this._timeout);
  5738. this._timeout = null;
  5739. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5740. this._element.classList.remove(ClassName$a.SHOW);
  5741. }
  5742. $(this._element).off(Event$a.CLICK_DISMISS);
  5743. $.removeData(this._element, DATA_KEY$a);
  5744. this._element = null;
  5745. this._config = null;
  5746. } // Private
  5747. ;
  5748. _proto._getConfig = function _getConfig(config) {
  5749. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5750. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5751. return config;
  5752. };
  5753. _proto._setListeners = function _setListeners() {
  5754. var _this2 = this;
  5755. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5756. return _this2.hide();
  5757. });
  5758. };
  5759. _proto._close = function _close() {
  5760. var _this3 = this;
  5761. var complete = function complete() {
  5762. _this3._element.classList.add(ClassName$a.HIDE);
  5763. $(_this3._element).trigger(Event$a.HIDDEN);
  5764. };
  5765. this._element.classList.remove(ClassName$a.SHOW);
  5766. if (this._config.animation) {
  5767. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5768. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5769. } else {
  5770. complete();
  5771. }
  5772. } // Static
  5773. ;
  5774. Toast._jQueryInterface = function _jQueryInterface(config) {
  5775. return this.each(function () {
  5776. var $element = $(this);
  5777. var data = $element.data(DATA_KEY$a);
  5778. var _config = typeof config === 'object' && config;
  5779. if (!data) {
  5780. data = new Toast(this, _config);
  5781. $element.data(DATA_KEY$a, data);
  5782. }
  5783. if (typeof config === 'string') {
  5784. if (typeof data[config] === 'undefined') {
  5785. throw new TypeError("No method named \"" + config + "\"");
  5786. }
  5787. data[config](this);
  5788. }
  5789. });
  5790. };
  5791. _createClass(Toast, null, [{
  5792. key: "VERSION",
  5793. get: function get() {
  5794. return VERSION$a;
  5795. }
  5796. }, {
  5797. key: "DefaultType",
  5798. get: function get() {
  5799. return DefaultType$7;
  5800. }
  5801. }, {
  5802. key: "Default",
  5803. get: function get() {
  5804. return Default$7;
  5805. }
  5806. }]);
  5807. return Toast;
  5808. }();
  5809. /**
  5810. * ------------------------------------------------------------------------
  5811. * jQuery
  5812. * ------------------------------------------------------------------------
  5813. */
  5814. $.fn[NAME$a] = Toast._jQueryInterface;
  5815. $.fn[NAME$a].Constructor = Toast;
  5816. $.fn[NAME$a].noConflict = function () {
  5817. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5818. return Toast._jQueryInterface;
  5819. };
  5820. exports.Alert = Alert;
  5821. exports.Button = Button;
  5822. exports.Carousel = Carousel;
  5823. exports.Collapse = Collapse;
  5824. exports.Dropdown = Dropdown;
  5825. exports.Modal = Modal;
  5826. exports.Popover = Popover;
  5827. exports.Scrollspy = ScrollSpy;
  5828. exports.Tab = Tab;
  5829. exports.Toast = Toast;
  5830. exports.Tooltip = Tooltip;
  5831. exports.Util = Util;
  5832. Object.defineProperty(exports, '__esModule', { value: true });
  5833. })));
  5834. //# sourceMappingURL=bootstrap.js.map
  5835. /***/ }),
  5836. /***/ "./node_modules/buffer/index.js":
  5837. /*!**************************************!*\
  5838. !*** ./node_modules/buffer/index.js ***!
  5839. \**************************************/
  5840. /*! no static exports found */
  5841. /***/ (function(module, exports, __webpack_require__) {
  5842. "use strict";
  5843. /* WEBPACK VAR INJECTION */(function(global) {/*!
  5844. * The buffer module from node.js, for the browser.
  5845. *
  5846. * @author Feross Aboukhadijeh <http://feross.org>
  5847. * @license MIT
  5848. */
  5849. /* eslint-disable no-proto */
  5850. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  5851. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  5852. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  5853. exports.Buffer = Buffer
  5854. exports.SlowBuffer = SlowBuffer
  5855. exports.INSPECT_MAX_BYTES = 50
  5856. /**
  5857. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  5858. * === true Use Uint8Array implementation (fastest)
  5859. * === false Use Object implementation (most compatible, even IE6)
  5860. *
  5861. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  5862. * Opera 11.6+, iOS 4.2+.
  5863. *
  5864. * Due to various browser bugs, sometimes the Object implementation will be used even
  5865. * when the browser supports typed arrays.
  5866. *
  5867. * Note:
  5868. *
  5869. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  5870. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  5871. *
  5872. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  5873. *
  5874. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  5875. * incorrect length in some situations.
  5876. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  5877. * get the Object implementation, which is slower but behaves correctly.
  5878. */
  5879. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  5880. ? global.TYPED_ARRAY_SUPPORT
  5881. : typedArraySupport()
  5882. /*
  5883. * Export kMaxLength after typed array support is determined.
  5884. */
  5885. exports.kMaxLength = kMaxLength()
  5886. function typedArraySupport () {
  5887. try {
  5888. var arr = new Uint8Array(1)
  5889. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  5890. return arr.foo() === 42 && // typed array instances can be augmented
  5891. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  5892. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  5893. } catch (e) {
  5894. return false
  5895. }
  5896. }
  5897. function kMaxLength () {
  5898. return Buffer.TYPED_ARRAY_SUPPORT
  5899. ? 0x7fffffff
  5900. : 0x3fffffff
  5901. }
  5902. function createBuffer (that, length) {
  5903. if (kMaxLength() < length) {
  5904. throw new RangeError('Invalid typed array length')
  5905. }
  5906. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5907. // Return an augmented `Uint8Array` instance, for best performance
  5908. that = new Uint8Array(length)
  5909. that.__proto__ = Buffer.prototype
  5910. } else {
  5911. // Fallback: Return an object instance of the Buffer class
  5912. if (that === null) {
  5913. that = new Buffer(length)
  5914. }
  5915. that.length = length
  5916. }
  5917. return that
  5918. }
  5919. /**
  5920. * The Buffer constructor returns instances of `Uint8Array` that have their
  5921. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  5922. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  5923. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  5924. * returns a single octet.
  5925. *
  5926. * The `Uint8Array` prototype remains unmodified.
  5927. */
  5928. function Buffer (arg, encodingOrOffset, length) {
  5929. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  5930. return new Buffer(arg, encodingOrOffset, length)
  5931. }
  5932. // Common case.
  5933. if (typeof arg === 'number') {
  5934. if (typeof encodingOrOffset === 'string') {
  5935. throw new Error(
  5936. 'If encoding is specified then the first argument must be a string'
  5937. )
  5938. }
  5939. return allocUnsafe(this, arg)
  5940. }
  5941. return from(this, arg, encodingOrOffset, length)
  5942. }
  5943. Buffer.poolSize = 8192 // not used by this implementation
  5944. // TODO: Legacy, not needed anymore. Remove in next major version.
  5945. Buffer._augment = function (arr) {
  5946. arr.__proto__ = Buffer.prototype
  5947. return arr
  5948. }
  5949. function from (that, value, encodingOrOffset, length) {
  5950. if (typeof value === 'number') {
  5951. throw new TypeError('"value" argument must not be a number')
  5952. }
  5953. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  5954. return fromArrayBuffer(that, value, encodingOrOffset, length)
  5955. }
  5956. if (typeof value === 'string') {
  5957. return fromString(that, value, encodingOrOffset)
  5958. }
  5959. return fromObject(that, value)
  5960. }
  5961. /**
  5962. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  5963. * if value is a number.
  5964. * Buffer.from(str[, encoding])
  5965. * Buffer.from(array)
  5966. * Buffer.from(buffer)
  5967. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  5968. **/
  5969. Buffer.from = function (value, encodingOrOffset, length) {
  5970. return from(null, value, encodingOrOffset, length)
  5971. }
  5972. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5973. Buffer.prototype.__proto__ = Uint8Array.prototype
  5974. Buffer.__proto__ = Uint8Array
  5975. if (typeof Symbol !== 'undefined' && Symbol.species &&
  5976. Buffer[Symbol.species] === Buffer) {
  5977. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  5978. Object.defineProperty(Buffer, Symbol.species, {
  5979. value: null,
  5980. configurable: true
  5981. })
  5982. }
  5983. }
  5984. function assertSize (size) {
  5985. if (typeof size !== 'number') {
  5986. throw new TypeError('"size" argument must be a number')
  5987. } else if (size < 0) {
  5988. throw new RangeError('"size" argument must not be negative')
  5989. }
  5990. }
  5991. function alloc (that, size, fill, encoding) {
  5992. assertSize(size)
  5993. if (size <= 0) {
  5994. return createBuffer(that, size)
  5995. }
  5996. if (fill !== undefined) {
  5997. // Only pay attention to encoding if it's a string. This
  5998. // prevents accidentally sending in a number that would
  5999. // be interpretted as a start offset.
  6000. return typeof encoding === 'string'
  6001. ? createBuffer(that, size).fill(fill, encoding)
  6002. : createBuffer(that, size).fill(fill)
  6003. }
  6004. return createBuffer(that, size)
  6005. }
  6006. /**
  6007. * Creates a new filled Buffer instance.
  6008. * alloc(size[, fill[, encoding]])
  6009. **/
  6010. Buffer.alloc = function (size, fill, encoding) {
  6011. return alloc(null, size, fill, encoding)
  6012. }
  6013. function allocUnsafe (that, size) {
  6014. assertSize(size)
  6015. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6016. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6017. for (var i = 0; i < size; ++i) {
  6018. that[i] = 0
  6019. }
  6020. }
  6021. return that
  6022. }
  6023. /**
  6024. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6025. * */
  6026. Buffer.allocUnsafe = function (size) {
  6027. return allocUnsafe(null, size)
  6028. }
  6029. /**
  6030. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6031. */
  6032. Buffer.allocUnsafeSlow = function (size) {
  6033. return allocUnsafe(null, size)
  6034. }
  6035. function fromString (that, string, encoding) {
  6036. if (typeof encoding !== 'string' || encoding === '') {
  6037. encoding = 'utf8'
  6038. }
  6039. if (!Buffer.isEncoding(encoding)) {
  6040. throw new TypeError('"encoding" must be a valid string encoding')
  6041. }
  6042. var length = byteLength(string, encoding) | 0
  6043. that = createBuffer(that, length)
  6044. var actual = that.write(string, encoding)
  6045. if (actual !== length) {
  6046. // Writing a hex string, for example, that contains invalid characters will
  6047. // cause everything after the first invalid character to be ignored. (e.g.
  6048. // 'abxxcd' will be treated as 'ab')
  6049. that = that.slice(0, actual)
  6050. }
  6051. return that
  6052. }
  6053. function fromArrayLike (that, array) {
  6054. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6055. that = createBuffer(that, length)
  6056. for (var i = 0; i < length; i += 1) {
  6057. that[i] = array[i] & 255
  6058. }
  6059. return that
  6060. }
  6061. function fromArrayBuffer (that, array, byteOffset, length) {
  6062. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6063. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6064. throw new RangeError('\'offset\' is out of bounds')
  6065. }
  6066. if (array.byteLength < byteOffset + (length || 0)) {
  6067. throw new RangeError('\'length\' is out of bounds')
  6068. }
  6069. if (byteOffset === undefined && length === undefined) {
  6070. array = new Uint8Array(array)
  6071. } else if (length === undefined) {
  6072. array = new Uint8Array(array, byteOffset)
  6073. } else {
  6074. array = new Uint8Array(array, byteOffset, length)
  6075. }
  6076. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6077. // Return an augmented `Uint8Array` instance, for best performance
  6078. that = array
  6079. that.__proto__ = Buffer.prototype
  6080. } else {
  6081. // Fallback: Return an object instance of the Buffer class
  6082. that = fromArrayLike(that, array)
  6083. }
  6084. return that
  6085. }
  6086. function fromObject (that, obj) {
  6087. if (Buffer.isBuffer(obj)) {
  6088. var len = checked(obj.length) | 0
  6089. that = createBuffer(that, len)
  6090. if (that.length === 0) {
  6091. return that
  6092. }
  6093. obj.copy(that, 0, 0, len)
  6094. return that
  6095. }
  6096. if (obj) {
  6097. if ((typeof ArrayBuffer !== 'undefined' &&
  6098. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6099. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6100. return createBuffer(that, 0)
  6101. }
  6102. return fromArrayLike(that, obj)
  6103. }
  6104. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6105. return fromArrayLike(that, obj.data)
  6106. }
  6107. }
  6108. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6109. }
  6110. function checked (length) {
  6111. // Note: cannot use `length < kMaxLength()` here because that fails when
  6112. // length is NaN (which is otherwise coerced to zero.)
  6113. if (length >= kMaxLength()) {
  6114. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6115. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6116. }
  6117. return length | 0
  6118. }
  6119. function SlowBuffer (length) {
  6120. if (+length != length) { // eslint-disable-line eqeqeq
  6121. length = 0
  6122. }
  6123. return Buffer.alloc(+length)
  6124. }
  6125. Buffer.isBuffer = function isBuffer (b) {
  6126. return !!(b != null && b._isBuffer)
  6127. }
  6128. Buffer.compare = function compare (a, b) {
  6129. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6130. throw new TypeError('Arguments must be Buffers')
  6131. }
  6132. if (a === b) return 0
  6133. var x = a.length
  6134. var y = b.length
  6135. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6136. if (a[i] !== b[i]) {
  6137. x = a[i]
  6138. y = b[i]
  6139. break
  6140. }
  6141. }
  6142. if (x < y) return -1
  6143. if (y < x) return 1
  6144. return 0
  6145. }
  6146. Buffer.isEncoding = function isEncoding (encoding) {
  6147. switch (String(encoding).toLowerCase()) {
  6148. case 'hex':
  6149. case 'utf8':
  6150. case 'utf-8':
  6151. case 'ascii':
  6152. case 'latin1':
  6153. case 'binary':
  6154. case 'base64':
  6155. case 'ucs2':
  6156. case 'ucs-2':
  6157. case 'utf16le':
  6158. case 'utf-16le':
  6159. return true
  6160. default:
  6161. return false
  6162. }
  6163. }
  6164. Buffer.concat = function concat (list, length) {
  6165. if (!isArray(list)) {
  6166. throw new TypeError('"list" argument must be an Array of Buffers')
  6167. }
  6168. if (list.length === 0) {
  6169. return Buffer.alloc(0)
  6170. }
  6171. var i
  6172. if (length === undefined) {
  6173. length = 0
  6174. for (i = 0; i < list.length; ++i) {
  6175. length += list[i].length
  6176. }
  6177. }
  6178. var buffer = Buffer.allocUnsafe(length)
  6179. var pos = 0
  6180. for (i = 0; i < list.length; ++i) {
  6181. var buf = list[i]
  6182. if (!Buffer.isBuffer(buf)) {
  6183. throw new TypeError('"list" argument must be an Array of Buffers')
  6184. }
  6185. buf.copy(buffer, pos)
  6186. pos += buf.length
  6187. }
  6188. return buffer
  6189. }
  6190. function byteLength (string, encoding) {
  6191. if (Buffer.isBuffer(string)) {
  6192. return string.length
  6193. }
  6194. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6195. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6196. return string.byteLength
  6197. }
  6198. if (typeof string !== 'string') {
  6199. string = '' + string
  6200. }
  6201. var len = string.length
  6202. if (len === 0) return 0
  6203. // Use a for loop to avoid recursion
  6204. var loweredCase = false
  6205. for (;;) {
  6206. switch (encoding) {
  6207. case 'ascii':
  6208. case 'latin1':
  6209. case 'binary':
  6210. return len
  6211. case 'utf8':
  6212. case 'utf-8':
  6213. case undefined:
  6214. return utf8ToBytes(string).length
  6215. case 'ucs2':
  6216. case 'ucs-2':
  6217. case 'utf16le':
  6218. case 'utf-16le':
  6219. return len * 2
  6220. case 'hex':
  6221. return len >>> 1
  6222. case 'base64':
  6223. return base64ToBytes(string).length
  6224. default:
  6225. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6226. encoding = ('' + encoding).toLowerCase()
  6227. loweredCase = true
  6228. }
  6229. }
  6230. }
  6231. Buffer.byteLength = byteLength
  6232. function slowToString (encoding, start, end) {
  6233. var loweredCase = false
  6234. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6235. // property of a typed array.
  6236. // This behaves neither like String nor Uint8Array in that we set start/end
  6237. // to their upper/lower bounds if the value passed is out of range.
  6238. // undefined is handled specially as per ECMA-262 6th Edition,
  6239. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6240. if (start === undefined || start < 0) {
  6241. start = 0
  6242. }
  6243. // Return early if start > this.length. Done here to prevent potential uint32
  6244. // coercion fail below.
  6245. if (start > this.length) {
  6246. return ''
  6247. }
  6248. if (end === undefined || end > this.length) {
  6249. end = this.length
  6250. }
  6251. if (end <= 0) {
  6252. return ''
  6253. }
  6254. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6255. end >>>= 0
  6256. start >>>= 0
  6257. if (end <= start) {
  6258. return ''
  6259. }
  6260. if (!encoding) encoding = 'utf8'
  6261. while (true) {
  6262. switch (encoding) {
  6263. case 'hex':
  6264. return hexSlice(this, start, end)
  6265. case 'utf8':
  6266. case 'utf-8':
  6267. return utf8Slice(this, start, end)
  6268. case 'ascii':
  6269. return asciiSlice(this, start, end)
  6270. case 'latin1':
  6271. case 'binary':
  6272. return latin1Slice(this, start, end)
  6273. case 'base64':
  6274. return base64Slice(this, start, end)
  6275. case 'ucs2':
  6276. case 'ucs-2':
  6277. case 'utf16le':
  6278. case 'utf-16le':
  6279. return utf16leSlice(this, start, end)
  6280. default:
  6281. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6282. encoding = (encoding + '').toLowerCase()
  6283. loweredCase = true
  6284. }
  6285. }
  6286. }
  6287. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6288. // Buffer instances.
  6289. Buffer.prototype._isBuffer = true
  6290. function swap (b, n, m) {
  6291. var i = b[n]
  6292. b[n] = b[m]
  6293. b[m] = i
  6294. }
  6295. Buffer.prototype.swap16 = function swap16 () {
  6296. var len = this.length
  6297. if (len % 2 !== 0) {
  6298. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6299. }
  6300. for (var i = 0; i < len; i += 2) {
  6301. swap(this, i, i + 1)
  6302. }
  6303. return this
  6304. }
  6305. Buffer.prototype.swap32 = function swap32 () {
  6306. var len = this.length
  6307. if (len % 4 !== 0) {
  6308. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6309. }
  6310. for (var i = 0; i < len; i += 4) {
  6311. swap(this, i, i + 3)
  6312. swap(this, i + 1, i + 2)
  6313. }
  6314. return this
  6315. }
  6316. Buffer.prototype.swap64 = function swap64 () {
  6317. var len = this.length
  6318. if (len % 8 !== 0) {
  6319. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6320. }
  6321. for (var i = 0; i < len; i += 8) {
  6322. swap(this, i, i + 7)
  6323. swap(this, i + 1, i + 6)
  6324. swap(this, i + 2, i + 5)
  6325. swap(this, i + 3, i + 4)
  6326. }
  6327. return this
  6328. }
  6329. Buffer.prototype.toString = function toString () {
  6330. var length = this.length | 0
  6331. if (length === 0) return ''
  6332. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6333. return slowToString.apply(this, arguments)
  6334. }
  6335. Buffer.prototype.equals = function equals (b) {
  6336. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6337. if (this === b) return true
  6338. return Buffer.compare(this, b) === 0
  6339. }
  6340. Buffer.prototype.inspect = function inspect () {
  6341. var str = ''
  6342. var max = exports.INSPECT_MAX_BYTES
  6343. if (this.length > 0) {
  6344. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6345. if (this.length > max) str += ' ... '
  6346. }
  6347. return '<Buffer ' + str + '>'
  6348. }
  6349. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6350. if (!Buffer.isBuffer(target)) {
  6351. throw new TypeError('Argument must be a Buffer')
  6352. }
  6353. if (start === undefined) {
  6354. start = 0
  6355. }
  6356. if (end === undefined) {
  6357. end = target ? target.length : 0
  6358. }
  6359. if (thisStart === undefined) {
  6360. thisStart = 0
  6361. }
  6362. if (thisEnd === undefined) {
  6363. thisEnd = this.length
  6364. }
  6365. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6366. throw new RangeError('out of range index')
  6367. }
  6368. if (thisStart >= thisEnd && start >= end) {
  6369. return 0
  6370. }
  6371. if (thisStart >= thisEnd) {
  6372. return -1
  6373. }
  6374. if (start >= end) {
  6375. return 1
  6376. }
  6377. start >>>= 0
  6378. end >>>= 0
  6379. thisStart >>>= 0
  6380. thisEnd >>>= 0
  6381. if (this === target) return 0
  6382. var x = thisEnd - thisStart
  6383. var y = end - start
  6384. var len = Math.min(x, y)
  6385. var thisCopy = this.slice(thisStart, thisEnd)
  6386. var targetCopy = target.slice(start, end)
  6387. for (var i = 0; i < len; ++i) {
  6388. if (thisCopy[i] !== targetCopy[i]) {
  6389. x = thisCopy[i]
  6390. y = targetCopy[i]
  6391. break
  6392. }
  6393. }
  6394. if (x < y) return -1
  6395. if (y < x) return 1
  6396. return 0
  6397. }
  6398. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6399. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6400. //
  6401. // Arguments:
  6402. // - buffer - a Buffer to search
  6403. // - val - a string, Buffer, or number
  6404. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6405. // - encoding - an optional encoding, relevant is val is a string
  6406. // - dir - true for indexOf, false for lastIndexOf
  6407. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6408. // Empty buffer means no match
  6409. if (buffer.length === 0) return -1
  6410. // Normalize byteOffset
  6411. if (typeof byteOffset === 'string') {
  6412. encoding = byteOffset
  6413. byteOffset = 0
  6414. } else if (byteOffset > 0x7fffffff) {
  6415. byteOffset = 0x7fffffff
  6416. } else if (byteOffset < -0x80000000) {
  6417. byteOffset = -0x80000000
  6418. }
  6419. byteOffset = +byteOffset // Coerce to Number.
  6420. if (isNaN(byteOffset)) {
  6421. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6422. byteOffset = dir ? 0 : (buffer.length - 1)
  6423. }
  6424. // Normalize byteOffset: negative offsets start from the end of the buffer
  6425. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6426. if (byteOffset >= buffer.length) {
  6427. if (dir) return -1
  6428. else byteOffset = buffer.length - 1
  6429. } else if (byteOffset < 0) {
  6430. if (dir) byteOffset = 0
  6431. else return -1
  6432. }
  6433. // Normalize val
  6434. if (typeof val === 'string') {
  6435. val = Buffer.from(val, encoding)
  6436. }
  6437. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6438. if (Buffer.isBuffer(val)) {
  6439. // Special case: looking for empty string/buffer always fails
  6440. if (val.length === 0) {
  6441. return -1
  6442. }
  6443. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6444. } else if (typeof val === 'number') {
  6445. val = val & 0xFF // Search for a byte value [0-255]
  6446. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6447. typeof Uint8Array.prototype.indexOf === 'function') {
  6448. if (dir) {
  6449. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6450. } else {
  6451. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6452. }
  6453. }
  6454. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6455. }
  6456. throw new TypeError('val must be string, number or Buffer')
  6457. }
  6458. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6459. var indexSize = 1
  6460. var arrLength = arr.length
  6461. var valLength = val.length
  6462. if (encoding !== undefined) {
  6463. encoding = String(encoding).toLowerCase()
  6464. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6465. encoding === 'utf16le' || encoding === 'utf-16le') {
  6466. if (arr.length < 2 || val.length < 2) {
  6467. return -1
  6468. }
  6469. indexSize = 2
  6470. arrLength /= 2
  6471. valLength /= 2
  6472. byteOffset /= 2
  6473. }
  6474. }
  6475. function read (buf, i) {
  6476. if (indexSize === 1) {
  6477. return buf[i]
  6478. } else {
  6479. return buf.readUInt16BE(i * indexSize)
  6480. }
  6481. }
  6482. var i
  6483. if (dir) {
  6484. var foundIndex = -1
  6485. for (i = byteOffset; i < arrLength; i++) {
  6486. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6487. if (foundIndex === -1) foundIndex = i
  6488. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6489. } else {
  6490. if (foundIndex !== -1) i -= i - foundIndex
  6491. foundIndex = -1
  6492. }
  6493. }
  6494. } else {
  6495. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6496. for (i = byteOffset; i >= 0; i--) {
  6497. var found = true
  6498. for (var j = 0; j < valLength; j++) {
  6499. if (read(arr, i + j) !== read(val, j)) {
  6500. found = false
  6501. break
  6502. }
  6503. }
  6504. if (found) return i
  6505. }
  6506. }
  6507. return -1
  6508. }
  6509. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6510. return this.indexOf(val, byteOffset, encoding) !== -1
  6511. }
  6512. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6513. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6514. }
  6515. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6516. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6517. }
  6518. function hexWrite (buf, string, offset, length) {
  6519. offset = Number(offset) || 0
  6520. var remaining = buf.length - offset
  6521. if (!length) {
  6522. length = remaining
  6523. } else {
  6524. length = Number(length)
  6525. if (length > remaining) {
  6526. length = remaining
  6527. }
  6528. }
  6529. // must be an even number of digits
  6530. var strLen = string.length
  6531. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6532. if (length > strLen / 2) {
  6533. length = strLen / 2
  6534. }
  6535. for (var i = 0; i < length; ++i) {
  6536. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6537. if (isNaN(parsed)) return i
  6538. buf[offset + i] = parsed
  6539. }
  6540. return i
  6541. }
  6542. function utf8Write (buf, string, offset, length) {
  6543. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6544. }
  6545. function asciiWrite (buf, string, offset, length) {
  6546. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6547. }
  6548. function latin1Write (buf, string, offset, length) {
  6549. return asciiWrite(buf, string, offset, length)
  6550. }
  6551. function base64Write (buf, string, offset, length) {
  6552. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6553. }
  6554. function ucs2Write (buf, string, offset, length) {
  6555. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6556. }
  6557. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6558. // Buffer#write(string)
  6559. if (offset === undefined) {
  6560. encoding = 'utf8'
  6561. length = this.length
  6562. offset = 0
  6563. // Buffer#write(string, encoding)
  6564. } else if (length === undefined && typeof offset === 'string') {
  6565. encoding = offset
  6566. length = this.length
  6567. offset = 0
  6568. // Buffer#write(string, offset[, length][, encoding])
  6569. } else if (isFinite(offset)) {
  6570. offset = offset | 0
  6571. if (isFinite(length)) {
  6572. length = length | 0
  6573. if (encoding === undefined) encoding = 'utf8'
  6574. } else {
  6575. encoding = length
  6576. length = undefined
  6577. }
  6578. // legacy write(string, encoding, offset, length) - remove in v0.13
  6579. } else {
  6580. throw new Error(
  6581. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6582. )
  6583. }
  6584. var remaining = this.length - offset
  6585. if (length === undefined || length > remaining) length = remaining
  6586. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6587. throw new RangeError('Attempt to write outside buffer bounds')
  6588. }
  6589. if (!encoding) encoding = 'utf8'
  6590. var loweredCase = false
  6591. for (;;) {
  6592. switch (encoding) {
  6593. case 'hex':
  6594. return hexWrite(this, string, offset, length)
  6595. case 'utf8':
  6596. case 'utf-8':
  6597. return utf8Write(this, string, offset, length)
  6598. case 'ascii':
  6599. return asciiWrite(this, string, offset, length)
  6600. case 'latin1':
  6601. case 'binary':
  6602. return latin1Write(this, string, offset, length)
  6603. case 'base64':
  6604. // Warning: maxLength not taken into account in base64Write
  6605. return base64Write(this, string, offset, length)
  6606. case 'ucs2':
  6607. case 'ucs-2':
  6608. case 'utf16le':
  6609. case 'utf-16le':
  6610. return ucs2Write(this, string, offset, length)
  6611. default:
  6612. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6613. encoding = ('' + encoding).toLowerCase()
  6614. loweredCase = true
  6615. }
  6616. }
  6617. }
  6618. Buffer.prototype.toJSON = function toJSON () {
  6619. return {
  6620. type: 'Buffer',
  6621. data: Array.prototype.slice.call(this._arr || this, 0)
  6622. }
  6623. }
  6624. function base64Slice (buf, start, end) {
  6625. if (start === 0 && end === buf.length) {
  6626. return base64.fromByteArray(buf)
  6627. } else {
  6628. return base64.fromByteArray(buf.slice(start, end))
  6629. }
  6630. }
  6631. function utf8Slice (buf, start, end) {
  6632. end = Math.min(buf.length, end)
  6633. var res = []
  6634. var i = start
  6635. while (i < end) {
  6636. var firstByte = buf[i]
  6637. var codePoint = null
  6638. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6639. : (firstByte > 0xDF) ? 3
  6640. : (firstByte > 0xBF) ? 2
  6641. : 1
  6642. if (i + bytesPerSequence <= end) {
  6643. var secondByte, thirdByte, fourthByte, tempCodePoint
  6644. switch (bytesPerSequence) {
  6645. case 1:
  6646. if (firstByte < 0x80) {
  6647. codePoint = firstByte
  6648. }
  6649. break
  6650. case 2:
  6651. secondByte = buf[i + 1]
  6652. if ((secondByte & 0xC0) === 0x80) {
  6653. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6654. if (tempCodePoint > 0x7F) {
  6655. codePoint = tempCodePoint
  6656. }
  6657. }
  6658. break
  6659. case 3:
  6660. secondByte = buf[i + 1]
  6661. thirdByte = buf[i + 2]
  6662. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6663. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6664. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6665. codePoint = tempCodePoint
  6666. }
  6667. }
  6668. break
  6669. case 4:
  6670. secondByte = buf[i + 1]
  6671. thirdByte = buf[i + 2]
  6672. fourthByte = buf[i + 3]
  6673. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6674. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6675. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6676. codePoint = tempCodePoint
  6677. }
  6678. }
  6679. }
  6680. }
  6681. if (codePoint === null) {
  6682. // we did not generate a valid codePoint so insert a
  6683. // replacement char (U+FFFD) and advance only 1 byte
  6684. codePoint = 0xFFFD
  6685. bytesPerSequence = 1
  6686. } else if (codePoint > 0xFFFF) {
  6687. // encode to utf16 (surrogate pair dance)
  6688. codePoint -= 0x10000
  6689. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6690. codePoint = 0xDC00 | codePoint & 0x3FF
  6691. }
  6692. res.push(codePoint)
  6693. i += bytesPerSequence
  6694. }
  6695. return decodeCodePointsArray(res)
  6696. }
  6697. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6698. // the lowest limit is Chrome, with 0x10000 args.
  6699. // We go 1 magnitude less, for safety
  6700. var MAX_ARGUMENTS_LENGTH = 0x1000
  6701. function decodeCodePointsArray (codePoints) {
  6702. var len = codePoints.length
  6703. if (len <= MAX_ARGUMENTS_LENGTH) {
  6704. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6705. }
  6706. // Decode in chunks to avoid "call stack size exceeded".
  6707. var res = ''
  6708. var i = 0
  6709. while (i < len) {
  6710. res += String.fromCharCode.apply(
  6711. String,
  6712. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6713. )
  6714. }
  6715. return res
  6716. }
  6717. function asciiSlice (buf, start, end) {
  6718. var ret = ''
  6719. end = Math.min(buf.length, end)
  6720. for (var i = start; i < end; ++i) {
  6721. ret += String.fromCharCode(buf[i] & 0x7F)
  6722. }
  6723. return ret
  6724. }
  6725. function latin1Slice (buf, start, end) {
  6726. var ret = ''
  6727. end = Math.min(buf.length, end)
  6728. for (var i = start; i < end; ++i) {
  6729. ret += String.fromCharCode(buf[i])
  6730. }
  6731. return ret
  6732. }
  6733. function hexSlice (buf, start, end) {
  6734. var len = buf.length
  6735. if (!start || start < 0) start = 0
  6736. if (!end || end < 0 || end > len) end = len
  6737. var out = ''
  6738. for (var i = start; i < end; ++i) {
  6739. out += toHex(buf[i])
  6740. }
  6741. return out
  6742. }
  6743. function utf16leSlice (buf, start, end) {
  6744. var bytes = buf.slice(start, end)
  6745. var res = ''
  6746. for (var i = 0; i < bytes.length; i += 2) {
  6747. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6748. }
  6749. return res
  6750. }
  6751. Buffer.prototype.slice = function slice (start, end) {
  6752. var len = this.length
  6753. start = ~~start
  6754. end = end === undefined ? len : ~~end
  6755. if (start < 0) {
  6756. start += len
  6757. if (start < 0) start = 0
  6758. } else if (start > len) {
  6759. start = len
  6760. }
  6761. if (end < 0) {
  6762. end += len
  6763. if (end < 0) end = 0
  6764. } else if (end > len) {
  6765. end = len
  6766. }
  6767. if (end < start) end = start
  6768. var newBuf
  6769. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6770. newBuf = this.subarray(start, end)
  6771. newBuf.__proto__ = Buffer.prototype
  6772. } else {
  6773. var sliceLen = end - start
  6774. newBuf = new Buffer(sliceLen, undefined)
  6775. for (var i = 0; i < sliceLen; ++i) {
  6776. newBuf[i] = this[i + start]
  6777. }
  6778. }
  6779. return newBuf
  6780. }
  6781. /*
  6782. * Need to make sure that buffer isn't trying to write out of bounds.
  6783. */
  6784. function checkOffset (offset, ext, length) {
  6785. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  6786. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  6787. }
  6788. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  6789. offset = offset | 0
  6790. byteLength = byteLength | 0
  6791. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6792. var val = this[offset]
  6793. var mul = 1
  6794. var i = 0
  6795. while (++i < byteLength && (mul *= 0x100)) {
  6796. val += this[offset + i] * mul
  6797. }
  6798. return val
  6799. }
  6800. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  6801. offset = offset | 0
  6802. byteLength = byteLength | 0
  6803. if (!noAssert) {
  6804. checkOffset(offset, byteLength, this.length)
  6805. }
  6806. var val = this[offset + --byteLength]
  6807. var mul = 1
  6808. while (byteLength > 0 && (mul *= 0x100)) {
  6809. val += this[offset + --byteLength] * mul
  6810. }
  6811. return val
  6812. }
  6813. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  6814. if (!noAssert) checkOffset(offset, 1, this.length)
  6815. return this[offset]
  6816. }
  6817. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  6818. if (!noAssert) checkOffset(offset, 2, this.length)
  6819. return this[offset] | (this[offset + 1] << 8)
  6820. }
  6821. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  6822. if (!noAssert) checkOffset(offset, 2, this.length)
  6823. return (this[offset] << 8) | this[offset + 1]
  6824. }
  6825. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  6826. if (!noAssert) checkOffset(offset, 4, this.length)
  6827. return ((this[offset]) |
  6828. (this[offset + 1] << 8) |
  6829. (this[offset + 2] << 16)) +
  6830. (this[offset + 3] * 0x1000000)
  6831. }
  6832. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  6833. if (!noAssert) checkOffset(offset, 4, this.length)
  6834. return (this[offset] * 0x1000000) +
  6835. ((this[offset + 1] << 16) |
  6836. (this[offset + 2] << 8) |
  6837. this[offset + 3])
  6838. }
  6839. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  6840. offset = offset | 0
  6841. byteLength = byteLength | 0
  6842. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6843. var val = this[offset]
  6844. var mul = 1
  6845. var i = 0
  6846. while (++i < byteLength && (mul *= 0x100)) {
  6847. val += this[offset + i] * mul
  6848. }
  6849. mul *= 0x80
  6850. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6851. return val
  6852. }
  6853. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  6854. offset = offset | 0
  6855. byteLength = byteLength | 0
  6856. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6857. var i = byteLength
  6858. var mul = 1
  6859. var val = this[offset + --i]
  6860. while (i > 0 && (mul *= 0x100)) {
  6861. val += this[offset + --i] * mul
  6862. }
  6863. mul *= 0x80
  6864. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6865. return val
  6866. }
  6867. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  6868. if (!noAssert) checkOffset(offset, 1, this.length)
  6869. if (!(this[offset] & 0x80)) return (this[offset])
  6870. return ((0xff - this[offset] + 1) * -1)
  6871. }
  6872. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  6873. if (!noAssert) checkOffset(offset, 2, this.length)
  6874. var val = this[offset] | (this[offset + 1] << 8)
  6875. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6876. }
  6877. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  6878. if (!noAssert) checkOffset(offset, 2, this.length)
  6879. var val = this[offset + 1] | (this[offset] << 8)
  6880. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6881. }
  6882. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  6883. if (!noAssert) checkOffset(offset, 4, this.length)
  6884. return (this[offset]) |
  6885. (this[offset + 1] << 8) |
  6886. (this[offset + 2] << 16) |
  6887. (this[offset + 3] << 24)
  6888. }
  6889. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  6890. if (!noAssert) checkOffset(offset, 4, this.length)
  6891. return (this[offset] << 24) |
  6892. (this[offset + 1] << 16) |
  6893. (this[offset + 2] << 8) |
  6894. (this[offset + 3])
  6895. }
  6896. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  6897. if (!noAssert) checkOffset(offset, 4, this.length)
  6898. return ieee754.read(this, offset, true, 23, 4)
  6899. }
  6900. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  6901. if (!noAssert) checkOffset(offset, 4, this.length)
  6902. return ieee754.read(this, offset, false, 23, 4)
  6903. }
  6904. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  6905. if (!noAssert) checkOffset(offset, 8, this.length)
  6906. return ieee754.read(this, offset, true, 52, 8)
  6907. }
  6908. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  6909. if (!noAssert) checkOffset(offset, 8, this.length)
  6910. return ieee754.read(this, offset, false, 52, 8)
  6911. }
  6912. function checkInt (buf, value, offset, ext, max, min) {
  6913. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  6914. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  6915. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6916. }
  6917. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  6918. value = +value
  6919. offset = offset | 0
  6920. byteLength = byteLength | 0
  6921. if (!noAssert) {
  6922. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6923. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6924. }
  6925. var mul = 1
  6926. var i = 0
  6927. this[offset] = value & 0xFF
  6928. while (++i < byteLength && (mul *= 0x100)) {
  6929. this[offset + i] = (value / mul) & 0xFF
  6930. }
  6931. return offset + byteLength
  6932. }
  6933. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  6934. value = +value
  6935. offset = offset | 0
  6936. byteLength = byteLength | 0
  6937. if (!noAssert) {
  6938. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6939. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6940. }
  6941. var i = byteLength - 1
  6942. var mul = 1
  6943. this[offset + i] = value & 0xFF
  6944. while (--i >= 0 && (mul *= 0x100)) {
  6945. this[offset + i] = (value / mul) & 0xFF
  6946. }
  6947. return offset + byteLength
  6948. }
  6949. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  6950. value = +value
  6951. offset = offset | 0
  6952. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  6953. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6954. this[offset] = (value & 0xff)
  6955. return offset + 1
  6956. }
  6957. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  6958. if (value < 0) value = 0xffff + value + 1
  6959. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  6960. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  6961. (littleEndian ? i : 1 - i) * 8
  6962. }
  6963. }
  6964. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  6965. value = +value
  6966. offset = offset | 0
  6967. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6968. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6969. this[offset] = (value & 0xff)
  6970. this[offset + 1] = (value >>> 8)
  6971. } else {
  6972. objectWriteUInt16(this, value, offset, true)
  6973. }
  6974. return offset + 2
  6975. }
  6976. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  6977. value = +value
  6978. offset = offset | 0
  6979. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6980. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6981. this[offset] = (value >>> 8)
  6982. this[offset + 1] = (value & 0xff)
  6983. } else {
  6984. objectWriteUInt16(this, value, offset, false)
  6985. }
  6986. return offset + 2
  6987. }
  6988. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  6989. if (value < 0) value = 0xffffffff + value + 1
  6990. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  6991. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  6992. }
  6993. }
  6994. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  6995. value = +value
  6996. offset = offset | 0
  6997. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6998. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6999. this[offset + 3] = (value >>> 24)
  7000. this[offset + 2] = (value >>> 16)
  7001. this[offset + 1] = (value >>> 8)
  7002. this[offset] = (value & 0xff)
  7003. } else {
  7004. objectWriteUInt32(this, value, offset, true)
  7005. }
  7006. return offset + 4
  7007. }
  7008. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7009. value = +value
  7010. offset = offset | 0
  7011. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7012. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7013. this[offset] = (value >>> 24)
  7014. this[offset + 1] = (value >>> 16)
  7015. this[offset + 2] = (value >>> 8)
  7016. this[offset + 3] = (value & 0xff)
  7017. } else {
  7018. objectWriteUInt32(this, value, offset, false)
  7019. }
  7020. return offset + 4
  7021. }
  7022. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7023. value = +value
  7024. offset = offset | 0
  7025. if (!noAssert) {
  7026. var limit = Math.pow(2, 8 * byteLength - 1)
  7027. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7028. }
  7029. var i = 0
  7030. var mul = 1
  7031. var sub = 0
  7032. this[offset] = value & 0xFF
  7033. while (++i < byteLength && (mul *= 0x100)) {
  7034. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7035. sub = 1
  7036. }
  7037. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7038. }
  7039. return offset + byteLength
  7040. }
  7041. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7042. value = +value
  7043. offset = offset | 0
  7044. if (!noAssert) {
  7045. var limit = Math.pow(2, 8 * byteLength - 1)
  7046. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7047. }
  7048. var i = byteLength - 1
  7049. var mul = 1
  7050. var sub = 0
  7051. this[offset + i] = value & 0xFF
  7052. while (--i >= 0 && (mul *= 0x100)) {
  7053. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7054. sub = 1
  7055. }
  7056. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7057. }
  7058. return offset + byteLength
  7059. }
  7060. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7061. value = +value
  7062. offset = offset | 0
  7063. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7064. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7065. if (value < 0) value = 0xff + value + 1
  7066. this[offset] = (value & 0xff)
  7067. return offset + 1
  7068. }
  7069. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7070. value = +value
  7071. offset = offset | 0
  7072. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7073. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7074. this[offset] = (value & 0xff)
  7075. this[offset + 1] = (value >>> 8)
  7076. } else {
  7077. objectWriteUInt16(this, value, offset, true)
  7078. }
  7079. return offset + 2
  7080. }
  7081. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7082. value = +value
  7083. offset = offset | 0
  7084. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7085. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7086. this[offset] = (value >>> 8)
  7087. this[offset + 1] = (value & 0xff)
  7088. } else {
  7089. objectWriteUInt16(this, value, offset, false)
  7090. }
  7091. return offset + 2
  7092. }
  7093. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7094. value = +value
  7095. offset = offset | 0
  7096. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7097. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7098. this[offset] = (value & 0xff)
  7099. this[offset + 1] = (value >>> 8)
  7100. this[offset + 2] = (value >>> 16)
  7101. this[offset + 3] = (value >>> 24)
  7102. } else {
  7103. objectWriteUInt32(this, value, offset, true)
  7104. }
  7105. return offset + 4
  7106. }
  7107. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7108. value = +value
  7109. offset = offset | 0
  7110. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7111. if (value < 0) value = 0xffffffff + value + 1
  7112. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7113. this[offset] = (value >>> 24)
  7114. this[offset + 1] = (value >>> 16)
  7115. this[offset + 2] = (value >>> 8)
  7116. this[offset + 3] = (value & 0xff)
  7117. } else {
  7118. objectWriteUInt32(this, value, offset, false)
  7119. }
  7120. return offset + 4
  7121. }
  7122. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7123. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7124. if (offset < 0) throw new RangeError('Index out of range')
  7125. }
  7126. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7127. if (!noAssert) {
  7128. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7129. }
  7130. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7131. return offset + 4
  7132. }
  7133. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7134. return writeFloat(this, value, offset, true, noAssert)
  7135. }
  7136. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7137. return writeFloat(this, value, offset, false, noAssert)
  7138. }
  7139. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7140. if (!noAssert) {
  7141. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7142. }
  7143. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7144. return offset + 8
  7145. }
  7146. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7147. return writeDouble(this, value, offset, true, noAssert)
  7148. }
  7149. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7150. return writeDouble(this, value, offset, false, noAssert)
  7151. }
  7152. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7153. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7154. if (!start) start = 0
  7155. if (!end && end !== 0) end = this.length
  7156. if (targetStart >= target.length) targetStart = target.length
  7157. if (!targetStart) targetStart = 0
  7158. if (end > 0 && end < start) end = start
  7159. // Copy 0 bytes; we're done
  7160. if (end === start) return 0
  7161. if (target.length === 0 || this.length === 0) return 0
  7162. // Fatal error conditions
  7163. if (targetStart < 0) {
  7164. throw new RangeError('targetStart out of bounds')
  7165. }
  7166. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7167. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7168. // Are we oob?
  7169. if (end > this.length) end = this.length
  7170. if (target.length - targetStart < end - start) {
  7171. end = target.length - targetStart + start
  7172. }
  7173. var len = end - start
  7174. var i
  7175. if (this === target && start < targetStart && targetStart < end) {
  7176. // descending copy from end
  7177. for (i = len - 1; i >= 0; --i) {
  7178. target[i + targetStart] = this[i + start]
  7179. }
  7180. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7181. // ascending copy from start
  7182. for (i = 0; i < len; ++i) {
  7183. target[i + targetStart] = this[i + start]
  7184. }
  7185. } else {
  7186. Uint8Array.prototype.set.call(
  7187. target,
  7188. this.subarray(start, start + len),
  7189. targetStart
  7190. )
  7191. }
  7192. return len
  7193. }
  7194. // Usage:
  7195. // buffer.fill(number[, offset[, end]])
  7196. // buffer.fill(buffer[, offset[, end]])
  7197. // buffer.fill(string[, offset[, end]][, encoding])
  7198. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7199. // Handle string cases:
  7200. if (typeof val === 'string') {
  7201. if (typeof start === 'string') {
  7202. encoding = start
  7203. start = 0
  7204. end = this.length
  7205. } else if (typeof end === 'string') {
  7206. encoding = end
  7207. end = this.length
  7208. }
  7209. if (val.length === 1) {
  7210. var code = val.charCodeAt(0)
  7211. if (code < 256) {
  7212. val = code
  7213. }
  7214. }
  7215. if (encoding !== undefined && typeof encoding !== 'string') {
  7216. throw new TypeError('encoding must be a string')
  7217. }
  7218. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7219. throw new TypeError('Unknown encoding: ' + encoding)
  7220. }
  7221. } else if (typeof val === 'number') {
  7222. val = val & 255
  7223. }
  7224. // Invalid ranges are not set to a default, so can range check early.
  7225. if (start < 0 || this.length < start || this.length < end) {
  7226. throw new RangeError('Out of range index')
  7227. }
  7228. if (end <= start) {
  7229. return this
  7230. }
  7231. start = start >>> 0
  7232. end = end === undefined ? this.length : end >>> 0
  7233. if (!val) val = 0
  7234. var i
  7235. if (typeof val === 'number') {
  7236. for (i = start; i < end; ++i) {
  7237. this[i] = val
  7238. }
  7239. } else {
  7240. var bytes = Buffer.isBuffer(val)
  7241. ? val
  7242. : utf8ToBytes(new Buffer(val, encoding).toString())
  7243. var len = bytes.length
  7244. for (i = 0; i < end - start; ++i) {
  7245. this[i + start] = bytes[i % len]
  7246. }
  7247. }
  7248. return this
  7249. }
  7250. // HELPER FUNCTIONS
  7251. // ================
  7252. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7253. function base64clean (str) {
  7254. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7255. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7256. // Node converts strings with length < 2 to ''
  7257. if (str.length < 2) return ''
  7258. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7259. while (str.length % 4 !== 0) {
  7260. str = str + '='
  7261. }
  7262. return str
  7263. }
  7264. function stringtrim (str) {
  7265. if (str.trim) return str.trim()
  7266. return str.replace(/^\s+|\s+$/g, '')
  7267. }
  7268. function toHex (n) {
  7269. if (n < 16) return '0' + n.toString(16)
  7270. return n.toString(16)
  7271. }
  7272. function utf8ToBytes (string, units) {
  7273. units = units || Infinity
  7274. var codePoint
  7275. var length = string.length
  7276. var leadSurrogate = null
  7277. var bytes = []
  7278. for (var i = 0; i < length; ++i) {
  7279. codePoint = string.charCodeAt(i)
  7280. // is surrogate component
  7281. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7282. // last char was a lead
  7283. if (!leadSurrogate) {
  7284. // no lead yet
  7285. if (codePoint > 0xDBFF) {
  7286. // unexpected trail
  7287. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7288. continue
  7289. } else if (i + 1 === length) {
  7290. // unpaired lead
  7291. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7292. continue
  7293. }
  7294. // valid lead
  7295. leadSurrogate = codePoint
  7296. continue
  7297. }
  7298. // 2 leads in a row
  7299. if (codePoint < 0xDC00) {
  7300. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7301. leadSurrogate = codePoint
  7302. continue
  7303. }
  7304. // valid surrogate pair
  7305. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7306. } else if (leadSurrogate) {
  7307. // valid bmp char, but last char was a lead
  7308. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7309. }
  7310. leadSurrogate = null
  7311. // encode utf8
  7312. if (codePoint < 0x80) {
  7313. if ((units -= 1) < 0) break
  7314. bytes.push(codePoint)
  7315. } else if (codePoint < 0x800) {
  7316. if ((units -= 2) < 0) break
  7317. bytes.push(
  7318. codePoint >> 0x6 | 0xC0,
  7319. codePoint & 0x3F | 0x80
  7320. )
  7321. } else if (codePoint < 0x10000) {
  7322. if ((units -= 3) < 0) break
  7323. bytes.push(
  7324. codePoint >> 0xC | 0xE0,
  7325. codePoint >> 0x6 & 0x3F | 0x80,
  7326. codePoint & 0x3F | 0x80
  7327. )
  7328. } else if (codePoint < 0x110000) {
  7329. if ((units -= 4) < 0) break
  7330. bytes.push(
  7331. codePoint >> 0x12 | 0xF0,
  7332. codePoint >> 0xC & 0x3F | 0x80,
  7333. codePoint >> 0x6 & 0x3F | 0x80,
  7334. codePoint & 0x3F | 0x80
  7335. )
  7336. } else {
  7337. throw new Error('Invalid code point')
  7338. }
  7339. }
  7340. return bytes
  7341. }
  7342. function asciiToBytes (str) {
  7343. var byteArray = []
  7344. for (var i = 0; i < str.length; ++i) {
  7345. // Node's code seems to be doing this and not & 0x7F..
  7346. byteArray.push(str.charCodeAt(i) & 0xFF)
  7347. }
  7348. return byteArray
  7349. }
  7350. function utf16leToBytes (str, units) {
  7351. var c, hi, lo
  7352. var byteArray = []
  7353. for (var i = 0; i < str.length; ++i) {
  7354. if ((units -= 2) < 0) break
  7355. c = str.charCodeAt(i)
  7356. hi = c >> 8
  7357. lo = c % 256
  7358. byteArray.push(lo)
  7359. byteArray.push(hi)
  7360. }
  7361. return byteArray
  7362. }
  7363. function base64ToBytes (str) {
  7364. return base64.toByteArray(base64clean(str))
  7365. }
  7366. function blitBuffer (src, dst, offset, length) {
  7367. for (var i = 0; i < length; ++i) {
  7368. if ((i + offset >= dst.length) || (i >= src.length)) break
  7369. dst[i + offset] = src[i]
  7370. }
  7371. return i
  7372. }
  7373. function isnan (val) {
  7374. return val !== val // eslint-disable-line no-self-compare
  7375. }
  7376. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7377. /***/ }),
  7378. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7379. /*!**************************************************!*\
  7380. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7381. \**************************************************/
  7382. /*! no static exports found */
  7383. /***/ (function(module, exports, __webpack_require__) {
  7384. /*!
  7385. * clipboard.js v2.0.4
  7386. * https://zenorocha.github.io/clipboard.js
  7387. *
  7388. * Licensed MIT © Zeno Rocha
  7389. */
  7390. (function webpackUniversalModuleDefinition(root, factory) {
  7391. if(true)
  7392. module.exports = factory();
  7393. else {}
  7394. })(this, function() {
  7395. return /******/ (function(modules) { // webpackBootstrap
  7396. /******/ // The module cache
  7397. /******/ var installedModules = {};
  7398. /******/
  7399. /******/ // The require function
  7400. /******/ function __webpack_require__(moduleId) {
  7401. /******/
  7402. /******/ // Check if module is in cache
  7403. /******/ if(installedModules[moduleId]) {
  7404. /******/ return installedModules[moduleId].exports;
  7405. /******/ }
  7406. /******/ // Create a new module (and put it into the cache)
  7407. /******/ var module = installedModules[moduleId] = {
  7408. /******/ i: moduleId,
  7409. /******/ l: false,
  7410. /******/ exports: {}
  7411. /******/ };
  7412. /******/
  7413. /******/ // Execute the module function
  7414. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7415. /******/
  7416. /******/ // Flag the module as loaded
  7417. /******/ module.l = true;
  7418. /******/
  7419. /******/ // Return the exports of the module
  7420. /******/ return module.exports;
  7421. /******/ }
  7422. /******/
  7423. /******/
  7424. /******/ // expose the modules object (__webpack_modules__)
  7425. /******/ __webpack_require__.m = modules;
  7426. /******/
  7427. /******/ // expose the module cache
  7428. /******/ __webpack_require__.c = installedModules;
  7429. /******/
  7430. /******/ // define getter function for harmony exports
  7431. /******/ __webpack_require__.d = function(exports, name, getter) {
  7432. /******/ if(!__webpack_require__.o(exports, name)) {
  7433. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7434. /******/ }
  7435. /******/ };
  7436. /******/
  7437. /******/ // define __esModule on exports
  7438. /******/ __webpack_require__.r = function(exports) {
  7439. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7440. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7441. /******/ }
  7442. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7443. /******/ };
  7444. /******/
  7445. /******/ // create a fake namespace object
  7446. /******/ // mode & 1: value is a module id, require it
  7447. /******/ // mode & 2: merge all properties of value into the ns
  7448. /******/ // mode & 4: return value when already ns object
  7449. /******/ // mode & 8|1: behave like require
  7450. /******/ __webpack_require__.t = function(value, mode) {
  7451. /******/ if(mode & 1) value = __webpack_require__(value);
  7452. /******/ if(mode & 8) return value;
  7453. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7454. /******/ var ns = Object.create(null);
  7455. /******/ __webpack_require__.r(ns);
  7456. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7457. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7458. /******/ return ns;
  7459. /******/ };
  7460. /******/
  7461. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7462. /******/ __webpack_require__.n = function(module) {
  7463. /******/ var getter = module && module.__esModule ?
  7464. /******/ function getDefault() { return module['default']; } :
  7465. /******/ function getModuleExports() { return module; };
  7466. /******/ __webpack_require__.d(getter, 'a', getter);
  7467. /******/ return getter;
  7468. /******/ };
  7469. /******/
  7470. /******/ // Object.prototype.hasOwnProperty.call
  7471. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7472. /******/
  7473. /******/ // __webpack_public_path__
  7474. /******/ __webpack_require__.p = "";
  7475. /******/
  7476. /******/
  7477. /******/ // Load entry module and return exports
  7478. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7479. /******/ })
  7480. /************************************************************************/
  7481. /******/ ([
  7482. /* 0 */
  7483. /***/ (function(module, exports, __webpack_require__) {
  7484. "use strict";
  7485. 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; };
  7486. 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; }; }();
  7487. var _clipboardAction = __webpack_require__(1);
  7488. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7489. var _tinyEmitter = __webpack_require__(3);
  7490. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7491. var _goodListener = __webpack_require__(4);
  7492. var _goodListener2 = _interopRequireDefault(_goodListener);
  7493. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7494. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7495. 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; }
  7496. 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; }
  7497. /**
  7498. * Base class which takes one or more elements, adds event listeners to them,
  7499. * and instantiates a new `ClipboardAction` on each click.
  7500. */
  7501. var Clipboard = function (_Emitter) {
  7502. _inherits(Clipboard, _Emitter);
  7503. /**
  7504. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7505. * @param {Object} options
  7506. */
  7507. function Clipboard(trigger, options) {
  7508. _classCallCheck(this, Clipboard);
  7509. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7510. _this.resolveOptions(options);
  7511. _this.listenClick(trigger);
  7512. return _this;
  7513. }
  7514. /**
  7515. * Defines if attributes would be resolved using internal setter functions
  7516. * or custom functions that were passed in the constructor.
  7517. * @param {Object} options
  7518. */
  7519. _createClass(Clipboard, [{
  7520. key: 'resolveOptions',
  7521. value: function resolveOptions() {
  7522. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7523. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7524. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7525. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7526. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7527. }
  7528. /**
  7529. * Adds a click event listener to the passed trigger.
  7530. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7531. */
  7532. }, {
  7533. key: 'listenClick',
  7534. value: function listenClick(trigger) {
  7535. var _this2 = this;
  7536. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7537. return _this2.onClick(e);
  7538. });
  7539. }
  7540. /**
  7541. * Defines a new `ClipboardAction` on each click event.
  7542. * @param {Event} e
  7543. */
  7544. }, {
  7545. key: 'onClick',
  7546. value: function onClick(e) {
  7547. var trigger = e.delegateTarget || e.currentTarget;
  7548. if (this.clipboardAction) {
  7549. this.clipboardAction = null;
  7550. }
  7551. this.clipboardAction = new _clipboardAction2.default({
  7552. action: this.action(trigger),
  7553. target: this.target(trigger),
  7554. text: this.text(trigger),
  7555. container: this.container,
  7556. trigger: trigger,
  7557. emitter: this
  7558. });
  7559. }
  7560. /**
  7561. * Default `action` lookup function.
  7562. * @param {Element} trigger
  7563. */
  7564. }, {
  7565. key: 'defaultAction',
  7566. value: function defaultAction(trigger) {
  7567. return getAttributeValue('action', trigger);
  7568. }
  7569. /**
  7570. * Default `target` lookup function.
  7571. * @param {Element} trigger
  7572. */
  7573. }, {
  7574. key: 'defaultTarget',
  7575. value: function defaultTarget(trigger) {
  7576. var selector = getAttributeValue('target', trigger);
  7577. if (selector) {
  7578. return document.querySelector(selector);
  7579. }
  7580. }
  7581. /**
  7582. * Returns the support of the given action, or all actions if no action is
  7583. * given.
  7584. * @param {String} [action]
  7585. */
  7586. }, {
  7587. key: 'defaultText',
  7588. /**
  7589. * Default `text` lookup function.
  7590. * @param {Element} trigger
  7591. */
  7592. value: function defaultText(trigger) {
  7593. return getAttributeValue('text', trigger);
  7594. }
  7595. /**
  7596. * Destroy lifecycle.
  7597. */
  7598. }, {
  7599. key: 'destroy',
  7600. value: function destroy() {
  7601. this.listener.destroy();
  7602. if (this.clipboardAction) {
  7603. this.clipboardAction.destroy();
  7604. this.clipboardAction = null;
  7605. }
  7606. }
  7607. }], [{
  7608. key: 'isSupported',
  7609. value: function isSupported() {
  7610. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7611. var actions = typeof action === 'string' ? [action] : action;
  7612. var support = !!document.queryCommandSupported;
  7613. actions.forEach(function (action) {
  7614. support = support && !!document.queryCommandSupported(action);
  7615. });
  7616. return support;
  7617. }
  7618. }]);
  7619. return Clipboard;
  7620. }(_tinyEmitter2.default);
  7621. /**
  7622. * Helper function to retrieve attribute value.
  7623. * @param {String} suffix
  7624. * @param {Element} element
  7625. */
  7626. function getAttributeValue(suffix, element) {
  7627. var attribute = 'data-clipboard-' + suffix;
  7628. if (!element.hasAttribute(attribute)) {
  7629. return;
  7630. }
  7631. return element.getAttribute(attribute);
  7632. }
  7633. module.exports = Clipboard;
  7634. /***/ }),
  7635. /* 1 */
  7636. /***/ (function(module, exports, __webpack_require__) {
  7637. "use strict";
  7638. 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; };
  7639. 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; }; }();
  7640. var _select = __webpack_require__(2);
  7641. var _select2 = _interopRequireDefault(_select);
  7642. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7643. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7644. /**
  7645. * Inner class which performs selection from either `text` or `target`
  7646. * properties and then executes copy or cut operations.
  7647. */
  7648. var ClipboardAction = function () {
  7649. /**
  7650. * @param {Object} options
  7651. */
  7652. function ClipboardAction(options) {
  7653. _classCallCheck(this, ClipboardAction);
  7654. this.resolveOptions(options);
  7655. this.initSelection();
  7656. }
  7657. /**
  7658. * Defines base properties passed from constructor.
  7659. * @param {Object} options
  7660. */
  7661. _createClass(ClipboardAction, [{
  7662. key: 'resolveOptions',
  7663. value: function resolveOptions() {
  7664. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7665. this.action = options.action;
  7666. this.container = options.container;
  7667. this.emitter = options.emitter;
  7668. this.target = options.target;
  7669. this.text = options.text;
  7670. this.trigger = options.trigger;
  7671. this.selectedText = '';
  7672. }
  7673. /**
  7674. * Decides which selection strategy is going to be applied based
  7675. * on the existence of `text` and `target` properties.
  7676. */
  7677. }, {
  7678. key: 'initSelection',
  7679. value: function initSelection() {
  7680. if (this.text) {
  7681. this.selectFake();
  7682. } else if (this.target) {
  7683. this.selectTarget();
  7684. }
  7685. }
  7686. /**
  7687. * Creates a fake textarea element, sets its value from `text` property,
  7688. * and makes a selection on it.
  7689. */
  7690. }, {
  7691. key: 'selectFake',
  7692. value: function selectFake() {
  7693. var _this = this;
  7694. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7695. this.removeFake();
  7696. this.fakeHandlerCallback = function () {
  7697. return _this.removeFake();
  7698. };
  7699. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7700. this.fakeElem = document.createElement('textarea');
  7701. // Prevent zooming on iOS
  7702. this.fakeElem.style.fontSize = '12pt';
  7703. // Reset box model
  7704. this.fakeElem.style.border = '0';
  7705. this.fakeElem.style.padding = '0';
  7706. this.fakeElem.style.margin = '0';
  7707. // Move element out of screen horizontally
  7708. this.fakeElem.style.position = 'absolute';
  7709. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7710. // Move element to the same position vertically
  7711. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7712. this.fakeElem.style.top = yPosition + 'px';
  7713. this.fakeElem.setAttribute('readonly', '');
  7714. this.fakeElem.value = this.text;
  7715. this.container.appendChild(this.fakeElem);
  7716. this.selectedText = (0, _select2.default)(this.fakeElem);
  7717. this.copyText();
  7718. }
  7719. /**
  7720. * Only removes the fake element after another click event, that way
  7721. * a user can hit `Ctrl+C` to copy because selection still exists.
  7722. */
  7723. }, {
  7724. key: 'removeFake',
  7725. value: function removeFake() {
  7726. if (this.fakeHandler) {
  7727. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7728. this.fakeHandler = null;
  7729. this.fakeHandlerCallback = null;
  7730. }
  7731. if (this.fakeElem) {
  7732. this.container.removeChild(this.fakeElem);
  7733. this.fakeElem = null;
  7734. }
  7735. }
  7736. /**
  7737. * Selects the content from element passed on `target` property.
  7738. */
  7739. }, {
  7740. key: 'selectTarget',
  7741. value: function selectTarget() {
  7742. this.selectedText = (0, _select2.default)(this.target);
  7743. this.copyText();
  7744. }
  7745. /**
  7746. * Executes the copy operation based on the current selection.
  7747. */
  7748. }, {
  7749. key: 'copyText',
  7750. value: function copyText() {
  7751. var succeeded = void 0;
  7752. try {
  7753. succeeded = document.execCommand(this.action);
  7754. } catch (err) {
  7755. succeeded = false;
  7756. }
  7757. this.handleResult(succeeded);
  7758. }
  7759. /**
  7760. * Fires an event based on the copy operation result.
  7761. * @param {Boolean} succeeded
  7762. */
  7763. }, {
  7764. key: 'handleResult',
  7765. value: function handleResult(succeeded) {
  7766. this.emitter.emit(succeeded ? 'success' : 'error', {
  7767. action: this.action,
  7768. text: this.selectedText,
  7769. trigger: this.trigger,
  7770. clearSelection: this.clearSelection.bind(this)
  7771. });
  7772. }
  7773. /**
  7774. * Moves focus away from `target` and back to the trigger, removes current selection.
  7775. */
  7776. }, {
  7777. key: 'clearSelection',
  7778. value: function clearSelection() {
  7779. if (this.trigger) {
  7780. this.trigger.focus();
  7781. }
  7782. window.getSelection().removeAllRanges();
  7783. }
  7784. /**
  7785. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  7786. * @param {String} action
  7787. */
  7788. }, {
  7789. key: 'destroy',
  7790. /**
  7791. * Destroy lifecycle.
  7792. */
  7793. value: function destroy() {
  7794. this.removeFake();
  7795. }
  7796. }, {
  7797. key: 'action',
  7798. set: function set() {
  7799. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  7800. this._action = action;
  7801. if (this._action !== 'copy' && this._action !== 'cut') {
  7802. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  7803. }
  7804. }
  7805. /**
  7806. * Gets the `action` property.
  7807. * @return {String}
  7808. */
  7809. ,
  7810. get: function get() {
  7811. return this._action;
  7812. }
  7813. /**
  7814. * Sets the `target` property using an element
  7815. * that will be have its content copied.
  7816. * @param {Element} target
  7817. */
  7818. }, {
  7819. key: 'target',
  7820. set: function set(target) {
  7821. if (target !== undefined) {
  7822. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  7823. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  7824. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  7825. }
  7826. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  7827. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  7828. }
  7829. this._target = target;
  7830. } else {
  7831. throw new Error('Invalid "target" value, use a valid Element');
  7832. }
  7833. }
  7834. }
  7835. /**
  7836. * Gets the `target` property.
  7837. * @return {String|HTMLElement}
  7838. */
  7839. ,
  7840. get: function get() {
  7841. return this._target;
  7842. }
  7843. }]);
  7844. return ClipboardAction;
  7845. }();
  7846. module.exports = ClipboardAction;
  7847. /***/ }),
  7848. /* 2 */
  7849. /***/ (function(module, exports) {
  7850. function select(element) {
  7851. var selectedText;
  7852. if (element.nodeName === 'SELECT') {
  7853. element.focus();
  7854. selectedText = element.value;
  7855. }
  7856. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  7857. var isReadOnly = element.hasAttribute('readonly');
  7858. if (!isReadOnly) {
  7859. element.setAttribute('readonly', '');
  7860. }
  7861. element.select();
  7862. element.setSelectionRange(0, element.value.length);
  7863. if (!isReadOnly) {
  7864. element.removeAttribute('readonly');
  7865. }
  7866. selectedText = element.value;
  7867. }
  7868. else {
  7869. if (element.hasAttribute('contenteditable')) {
  7870. element.focus();
  7871. }
  7872. var selection = window.getSelection();
  7873. var range = document.createRange();
  7874. range.selectNodeContents(element);
  7875. selection.removeAllRanges();
  7876. selection.addRange(range);
  7877. selectedText = selection.toString();
  7878. }
  7879. return selectedText;
  7880. }
  7881. module.exports = select;
  7882. /***/ }),
  7883. /* 3 */
  7884. /***/ (function(module, exports) {
  7885. function E () {
  7886. // Keep this empty so it's easier to inherit from
  7887. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  7888. }
  7889. E.prototype = {
  7890. on: function (name, callback, ctx) {
  7891. var e = this.e || (this.e = {});
  7892. (e[name] || (e[name] = [])).push({
  7893. fn: callback,
  7894. ctx: ctx
  7895. });
  7896. return this;
  7897. },
  7898. once: function (name, callback, ctx) {
  7899. var self = this;
  7900. function listener () {
  7901. self.off(name, listener);
  7902. callback.apply(ctx, arguments);
  7903. };
  7904. listener._ = callback
  7905. return this.on(name, listener, ctx);
  7906. },
  7907. emit: function (name) {
  7908. var data = [].slice.call(arguments, 1);
  7909. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  7910. var i = 0;
  7911. var len = evtArr.length;
  7912. for (i; i < len; i++) {
  7913. evtArr[i].fn.apply(evtArr[i].ctx, data);
  7914. }
  7915. return this;
  7916. },
  7917. off: function (name, callback) {
  7918. var e = this.e || (this.e = {});
  7919. var evts = e[name];
  7920. var liveEvents = [];
  7921. if (evts && callback) {
  7922. for (var i = 0, len = evts.length; i < len; i++) {
  7923. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  7924. liveEvents.push(evts[i]);
  7925. }
  7926. }
  7927. // Remove event from queue to prevent memory leak
  7928. // Suggested by https://github.com/lazd
  7929. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  7930. (liveEvents.length)
  7931. ? e[name] = liveEvents
  7932. : delete e[name];
  7933. return this;
  7934. }
  7935. };
  7936. module.exports = E;
  7937. /***/ }),
  7938. /* 4 */
  7939. /***/ (function(module, exports, __webpack_require__) {
  7940. var is = __webpack_require__(5);
  7941. var delegate = __webpack_require__(6);
  7942. /**
  7943. * Validates all params and calls the right
  7944. * listener function based on its target type.
  7945. *
  7946. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  7947. * @param {String} type
  7948. * @param {Function} callback
  7949. * @return {Object}
  7950. */
  7951. function listen(target, type, callback) {
  7952. if (!target && !type && !callback) {
  7953. throw new Error('Missing required arguments');
  7954. }
  7955. if (!is.string(type)) {
  7956. throw new TypeError('Second argument must be a String');
  7957. }
  7958. if (!is.fn(callback)) {
  7959. throw new TypeError('Third argument must be a Function');
  7960. }
  7961. if (is.node(target)) {
  7962. return listenNode(target, type, callback);
  7963. }
  7964. else if (is.nodeList(target)) {
  7965. return listenNodeList(target, type, callback);
  7966. }
  7967. else if (is.string(target)) {
  7968. return listenSelector(target, type, callback);
  7969. }
  7970. else {
  7971. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  7972. }
  7973. }
  7974. /**
  7975. * Adds an event listener to a HTML element
  7976. * and returns a remove listener function.
  7977. *
  7978. * @param {HTMLElement} node
  7979. * @param {String} type
  7980. * @param {Function} callback
  7981. * @return {Object}
  7982. */
  7983. function listenNode(node, type, callback) {
  7984. node.addEventListener(type, callback);
  7985. return {
  7986. destroy: function() {
  7987. node.removeEventListener(type, callback);
  7988. }
  7989. }
  7990. }
  7991. /**
  7992. * Add an event listener to a list of HTML elements
  7993. * and returns a remove listener function.
  7994. *
  7995. * @param {NodeList|HTMLCollection} nodeList
  7996. * @param {String} type
  7997. * @param {Function} callback
  7998. * @return {Object}
  7999. */
  8000. function listenNodeList(nodeList, type, callback) {
  8001. Array.prototype.forEach.call(nodeList, function(node) {
  8002. node.addEventListener(type, callback);
  8003. });
  8004. return {
  8005. destroy: function() {
  8006. Array.prototype.forEach.call(nodeList, function(node) {
  8007. node.removeEventListener(type, callback);
  8008. });
  8009. }
  8010. }
  8011. }
  8012. /**
  8013. * Add an event listener to a selector
  8014. * and returns a remove listener function.
  8015. *
  8016. * @param {String} selector
  8017. * @param {String} type
  8018. * @param {Function} callback
  8019. * @return {Object}
  8020. */
  8021. function listenSelector(selector, type, callback) {
  8022. return delegate(document.body, selector, type, callback);
  8023. }
  8024. module.exports = listen;
  8025. /***/ }),
  8026. /* 5 */
  8027. /***/ (function(module, exports) {
  8028. /**
  8029. * Check if argument is a HTML element.
  8030. *
  8031. * @param {Object} value
  8032. * @return {Boolean}
  8033. */
  8034. exports.node = function(value) {
  8035. return value !== undefined
  8036. && value instanceof HTMLElement
  8037. && value.nodeType === 1;
  8038. };
  8039. /**
  8040. * Check if argument is a list of HTML elements.
  8041. *
  8042. * @param {Object} value
  8043. * @return {Boolean}
  8044. */
  8045. exports.nodeList = function(value) {
  8046. var type = Object.prototype.toString.call(value);
  8047. return value !== undefined
  8048. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8049. && ('length' in value)
  8050. && (value.length === 0 || exports.node(value[0]));
  8051. };
  8052. /**
  8053. * Check if argument is a string.
  8054. *
  8055. * @param {Object} value
  8056. * @return {Boolean}
  8057. */
  8058. exports.string = function(value) {
  8059. return typeof value === 'string'
  8060. || value instanceof String;
  8061. };
  8062. /**
  8063. * Check if argument is a function.
  8064. *
  8065. * @param {Object} value
  8066. * @return {Boolean}
  8067. */
  8068. exports.fn = function(value) {
  8069. var type = Object.prototype.toString.call(value);
  8070. return type === '[object Function]';
  8071. };
  8072. /***/ }),
  8073. /* 6 */
  8074. /***/ (function(module, exports, __webpack_require__) {
  8075. var closest = __webpack_require__(7);
  8076. /**
  8077. * Delegates event to a selector.
  8078. *
  8079. * @param {Element} element
  8080. * @param {String} selector
  8081. * @param {String} type
  8082. * @param {Function} callback
  8083. * @param {Boolean} useCapture
  8084. * @return {Object}
  8085. */
  8086. function _delegate(element, selector, type, callback, useCapture) {
  8087. var listenerFn = listener.apply(this, arguments);
  8088. element.addEventListener(type, listenerFn, useCapture);
  8089. return {
  8090. destroy: function() {
  8091. element.removeEventListener(type, listenerFn, useCapture);
  8092. }
  8093. }
  8094. }
  8095. /**
  8096. * Delegates event to a selector.
  8097. *
  8098. * @param {Element|String|Array} [elements]
  8099. * @param {String} selector
  8100. * @param {String} type
  8101. * @param {Function} callback
  8102. * @param {Boolean} useCapture
  8103. * @return {Object}
  8104. */
  8105. function delegate(elements, selector, type, callback, useCapture) {
  8106. // Handle the regular Element usage
  8107. if (typeof elements.addEventListener === 'function') {
  8108. return _delegate.apply(null, arguments);
  8109. }
  8110. // Handle Element-less usage, it defaults to global delegation
  8111. if (typeof type === 'function') {
  8112. // Use `document` as the first parameter, then apply arguments
  8113. // This is a short way to .unshift `arguments` without running into deoptimizations
  8114. return _delegate.bind(null, document).apply(null, arguments);
  8115. }
  8116. // Handle Selector-based usage
  8117. if (typeof elements === 'string') {
  8118. elements = document.querySelectorAll(elements);
  8119. }
  8120. // Handle Array-like based usage
  8121. return Array.prototype.map.call(elements, function (element) {
  8122. return _delegate(element, selector, type, callback, useCapture);
  8123. });
  8124. }
  8125. /**
  8126. * Finds closest match and invokes callback.
  8127. *
  8128. * @param {Element} element
  8129. * @param {String} selector
  8130. * @param {String} type
  8131. * @param {Function} callback
  8132. * @return {Function}
  8133. */
  8134. function listener(element, selector, type, callback) {
  8135. return function(e) {
  8136. e.delegateTarget = closest(e.target, selector);
  8137. if (e.delegateTarget) {
  8138. callback.call(element, e);
  8139. }
  8140. }
  8141. }
  8142. module.exports = delegate;
  8143. /***/ }),
  8144. /* 7 */
  8145. /***/ (function(module, exports) {
  8146. var DOCUMENT_NODE_TYPE = 9;
  8147. /**
  8148. * A polyfill for Element.matches()
  8149. */
  8150. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8151. var proto = Element.prototype;
  8152. proto.matches = proto.matchesSelector ||
  8153. proto.mozMatchesSelector ||
  8154. proto.msMatchesSelector ||
  8155. proto.oMatchesSelector ||
  8156. proto.webkitMatchesSelector;
  8157. }
  8158. /**
  8159. * Finds the closest parent that matches a selector.
  8160. *
  8161. * @param {Element} element
  8162. * @param {String} selector
  8163. * @return {Function}
  8164. */
  8165. function closest (element, selector) {
  8166. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8167. if (typeof element.matches === 'function' &&
  8168. element.matches(selector)) {
  8169. return element;
  8170. }
  8171. element = element.parentNode;
  8172. }
  8173. }
  8174. module.exports = closest;
  8175. /***/ })
  8176. /******/ ]);
  8177. });
  8178. /***/ }),
  8179. /***/ "./node_modules/ieee754/index.js":
  8180. /*!***************************************!*\
  8181. !*** ./node_modules/ieee754/index.js ***!
  8182. \***************************************/
  8183. /*! no static exports found */
  8184. /***/ (function(module, exports) {
  8185. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8186. var e, m
  8187. var eLen = (nBytes * 8) - mLen - 1
  8188. var eMax = (1 << eLen) - 1
  8189. var eBias = eMax >> 1
  8190. var nBits = -7
  8191. var i = isLE ? (nBytes - 1) : 0
  8192. var d = isLE ? -1 : 1
  8193. var s = buffer[offset + i]
  8194. i += d
  8195. e = s & ((1 << (-nBits)) - 1)
  8196. s >>= (-nBits)
  8197. nBits += eLen
  8198. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8199. m = e & ((1 << (-nBits)) - 1)
  8200. e >>= (-nBits)
  8201. nBits += mLen
  8202. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8203. if (e === 0) {
  8204. e = 1 - eBias
  8205. } else if (e === eMax) {
  8206. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8207. } else {
  8208. m = m + Math.pow(2, mLen)
  8209. e = e - eBias
  8210. }
  8211. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8212. }
  8213. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8214. var e, m, c
  8215. var eLen = (nBytes * 8) - mLen - 1
  8216. var eMax = (1 << eLen) - 1
  8217. var eBias = eMax >> 1
  8218. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8219. var i = isLE ? 0 : (nBytes - 1)
  8220. var d = isLE ? 1 : -1
  8221. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8222. value = Math.abs(value)
  8223. if (isNaN(value) || value === Infinity) {
  8224. m = isNaN(value) ? 1 : 0
  8225. e = eMax
  8226. } else {
  8227. e = Math.floor(Math.log(value) / Math.LN2)
  8228. if (value * (c = Math.pow(2, -e)) < 1) {
  8229. e--
  8230. c *= 2
  8231. }
  8232. if (e + eBias >= 1) {
  8233. value += rt / c
  8234. } else {
  8235. value += rt * Math.pow(2, 1 - eBias)
  8236. }
  8237. if (value * c >= 2) {
  8238. e++
  8239. c /= 2
  8240. }
  8241. if (e + eBias >= eMax) {
  8242. m = 0
  8243. e = eMax
  8244. } else if (e + eBias >= 1) {
  8245. m = ((value * c) - 1) * Math.pow(2, mLen)
  8246. e = e + eBias
  8247. } else {
  8248. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8249. e = 0
  8250. }
  8251. }
  8252. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8253. e = (e << mLen) | m
  8254. eLen += mLen
  8255. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8256. buffer[offset + i - d] |= s * 128
  8257. }
  8258. /***/ }),
  8259. /***/ "./node_modules/isarray/index.js":
  8260. /*!***************************************!*\
  8261. !*** ./node_modules/isarray/index.js ***!
  8262. \***************************************/
  8263. /*! no static exports found */
  8264. /***/ (function(module, exports) {
  8265. var toString = {}.toString;
  8266. module.exports = Array.isArray || function (arr) {
  8267. return toString.call(arr) == '[object Array]';
  8268. };
  8269. /***/ }),
  8270. /***/ "./node_modules/jquery/dist/jquery.js":
  8271. /*!********************************************!*\
  8272. !*** ./node_modules/jquery/dist/jquery.js ***!
  8273. \********************************************/
  8274. /*! no static exports found */
  8275. /***/ (function(module, exports, __webpack_require__) {
  8276. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8277. * jQuery JavaScript Library v3.4.1
  8278. * https://jquery.com/
  8279. *
  8280. * Includes Sizzle.js
  8281. * https://sizzlejs.com/
  8282. *
  8283. * Copyright JS Foundation and other contributors
  8284. * Released under the MIT license
  8285. * https://jquery.org/license
  8286. *
  8287. * Date: 2019-05-01T21:04Z
  8288. */
  8289. ( function( global, factory ) {
  8290. "use strict";
  8291. if ( true && typeof module.exports === "object" ) {
  8292. // For CommonJS and CommonJS-like environments where a proper `window`
  8293. // is present, execute the factory and get jQuery.
  8294. // For environments that do not have a `window` with a `document`
  8295. // (such as Node.js), expose a factory as module.exports.
  8296. // This accentuates the need for the creation of a real `window`.
  8297. // e.g. var jQuery = require("jquery")(window);
  8298. // See ticket #14549 for more info.
  8299. module.exports = global.document ?
  8300. factory( global, true ) :
  8301. function( w ) {
  8302. if ( !w.document ) {
  8303. throw new Error( "jQuery requires a window with a document" );
  8304. }
  8305. return factory( w );
  8306. };
  8307. } else {
  8308. factory( global );
  8309. }
  8310. // Pass this if window is not defined yet
  8311. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8312. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8313. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8314. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8315. // enough that all such attempts are guarded in a try block.
  8316. "use strict";
  8317. var arr = [];
  8318. var document = window.document;
  8319. var getProto = Object.getPrototypeOf;
  8320. var slice = arr.slice;
  8321. var concat = arr.concat;
  8322. var push = arr.push;
  8323. var indexOf = arr.indexOf;
  8324. var class2type = {};
  8325. var toString = class2type.toString;
  8326. var hasOwn = class2type.hasOwnProperty;
  8327. var fnToString = hasOwn.toString;
  8328. var ObjectFunctionString = fnToString.call( Object );
  8329. var support = {};
  8330. var isFunction = function isFunction( obj ) {
  8331. // Support: Chrome <=57, Firefox <=52
  8332. // In some browsers, typeof returns "function" for HTML <object> elements
  8333. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8334. // We don't want to classify *any* DOM node as a function.
  8335. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8336. };
  8337. var isWindow = function isWindow( obj ) {
  8338. return obj != null && obj === obj.window;
  8339. };
  8340. var preservedScriptAttributes = {
  8341. type: true,
  8342. src: true,
  8343. nonce: true,
  8344. noModule: true
  8345. };
  8346. function DOMEval( code, node, doc ) {
  8347. doc = doc || document;
  8348. var i, val,
  8349. script = doc.createElement( "script" );
  8350. script.text = code;
  8351. if ( node ) {
  8352. for ( i in preservedScriptAttributes ) {
  8353. // Support: Firefox 64+, Edge 18+
  8354. // Some browsers don't support the "nonce" property on scripts.
  8355. // On the other hand, just using `getAttribute` is not enough as
  8356. // the `nonce` attribute is reset to an empty string whenever it
  8357. // becomes browsing-context connected.
  8358. // See https://github.com/whatwg/html/issues/2369
  8359. // See https://html.spec.whatwg.org/#nonce-attributes
  8360. // The `node.getAttribute` check was added for the sake of
  8361. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8362. // via an object.
  8363. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8364. if ( val ) {
  8365. script.setAttribute( i, val );
  8366. }
  8367. }
  8368. }
  8369. doc.head.appendChild( script ).parentNode.removeChild( script );
  8370. }
  8371. function toType( obj ) {
  8372. if ( obj == null ) {
  8373. return obj + "";
  8374. }
  8375. // Support: Android <=2.3 only (functionish RegExp)
  8376. return typeof obj === "object" || typeof obj === "function" ?
  8377. class2type[ toString.call( obj ) ] || "object" :
  8378. typeof obj;
  8379. }
  8380. /* global Symbol */
  8381. // Defining this global in .eslintrc.json would create a danger of using the global
  8382. // unguarded in another place, it seems safer to define global only for this module
  8383. var
  8384. version = "3.4.1",
  8385. // Define a local copy of jQuery
  8386. jQuery = function( selector, context ) {
  8387. // The jQuery object is actually just the init constructor 'enhanced'
  8388. // Need init if jQuery is called (just allow error to be thrown if not included)
  8389. return new jQuery.fn.init( selector, context );
  8390. },
  8391. // Support: Android <=4.0 only
  8392. // Make sure we trim BOM and NBSP
  8393. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8394. jQuery.fn = jQuery.prototype = {
  8395. // The current version of jQuery being used
  8396. jquery: version,
  8397. constructor: jQuery,
  8398. // The default length of a jQuery object is 0
  8399. length: 0,
  8400. toArray: function() {
  8401. return slice.call( this );
  8402. },
  8403. // Get the Nth element in the matched element set OR
  8404. // Get the whole matched element set as a clean array
  8405. get: function( num ) {
  8406. // Return all the elements in a clean array
  8407. if ( num == null ) {
  8408. return slice.call( this );
  8409. }
  8410. // Return just the one element from the set
  8411. return num < 0 ? this[ num + this.length ] : this[ num ];
  8412. },
  8413. // Take an array of elements and push it onto the stack
  8414. // (returning the new matched element set)
  8415. pushStack: function( elems ) {
  8416. // Build a new jQuery matched element set
  8417. var ret = jQuery.merge( this.constructor(), elems );
  8418. // Add the old object onto the stack (as a reference)
  8419. ret.prevObject = this;
  8420. // Return the newly-formed element set
  8421. return ret;
  8422. },
  8423. // Execute a callback for every element in the matched set.
  8424. each: function( callback ) {
  8425. return jQuery.each( this, callback );
  8426. },
  8427. map: function( callback ) {
  8428. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8429. return callback.call( elem, i, elem );
  8430. } ) );
  8431. },
  8432. slice: function() {
  8433. return this.pushStack( slice.apply( this, arguments ) );
  8434. },
  8435. first: function() {
  8436. return this.eq( 0 );
  8437. },
  8438. last: function() {
  8439. return this.eq( -1 );
  8440. },
  8441. eq: function( i ) {
  8442. var len = this.length,
  8443. j = +i + ( i < 0 ? len : 0 );
  8444. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8445. },
  8446. end: function() {
  8447. return this.prevObject || this.constructor();
  8448. },
  8449. // For internal use only.
  8450. // Behaves like an Array's method, not like a jQuery method.
  8451. push: push,
  8452. sort: arr.sort,
  8453. splice: arr.splice
  8454. };
  8455. jQuery.extend = jQuery.fn.extend = function() {
  8456. var options, name, src, copy, copyIsArray, clone,
  8457. target = arguments[ 0 ] || {},
  8458. i = 1,
  8459. length = arguments.length,
  8460. deep = false;
  8461. // Handle a deep copy situation
  8462. if ( typeof target === "boolean" ) {
  8463. deep = target;
  8464. // Skip the boolean and the target
  8465. target = arguments[ i ] || {};
  8466. i++;
  8467. }
  8468. // Handle case when target is a string or something (possible in deep copy)
  8469. if ( typeof target !== "object" && !isFunction( target ) ) {
  8470. target = {};
  8471. }
  8472. // Extend jQuery itself if only one argument is passed
  8473. if ( i === length ) {
  8474. target = this;
  8475. i--;
  8476. }
  8477. for ( ; i < length; i++ ) {
  8478. // Only deal with non-null/undefined values
  8479. if ( ( options = arguments[ i ] ) != null ) {
  8480. // Extend the base object
  8481. for ( name in options ) {
  8482. copy = options[ name ];
  8483. // Prevent Object.prototype pollution
  8484. // Prevent never-ending loop
  8485. if ( name === "__proto__" || target === copy ) {
  8486. continue;
  8487. }
  8488. // Recurse if we're merging plain objects or arrays
  8489. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8490. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8491. src = target[ name ];
  8492. // Ensure proper type for the source value
  8493. if ( copyIsArray && !Array.isArray( src ) ) {
  8494. clone = [];
  8495. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8496. clone = {};
  8497. } else {
  8498. clone = src;
  8499. }
  8500. copyIsArray = false;
  8501. // Never move original objects, clone them
  8502. target[ name ] = jQuery.extend( deep, clone, copy );
  8503. // Don't bring in undefined values
  8504. } else if ( copy !== undefined ) {
  8505. target[ name ] = copy;
  8506. }
  8507. }
  8508. }
  8509. }
  8510. // Return the modified object
  8511. return target;
  8512. };
  8513. jQuery.extend( {
  8514. // Unique for each copy of jQuery on the page
  8515. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8516. // Assume jQuery is ready without the ready module
  8517. isReady: true,
  8518. error: function( msg ) {
  8519. throw new Error( msg );
  8520. },
  8521. noop: function() {},
  8522. isPlainObject: function( obj ) {
  8523. var proto, Ctor;
  8524. // Detect obvious negatives
  8525. // Use toString instead of jQuery.type to catch host objects
  8526. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8527. return false;
  8528. }
  8529. proto = getProto( obj );
  8530. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8531. if ( !proto ) {
  8532. return true;
  8533. }
  8534. // Objects with prototype are plain iff they were constructed by a global Object function
  8535. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8536. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8537. },
  8538. isEmptyObject: function( obj ) {
  8539. var name;
  8540. for ( name in obj ) {
  8541. return false;
  8542. }
  8543. return true;
  8544. },
  8545. // Evaluates a script in a global context
  8546. globalEval: function( code, options ) {
  8547. DOMEval( code, { nonce: options && options.nonce } );
  8548. },
  8549. each: function( obj, callback ) {
  8550. var length, i = 0;
  8551. if ( isArrayLike( obj ) ) {
  8552. length = obj.length;
  8553. for ( ; i < length; i++ ) {
  8554. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8555. break;
  8556. }
  8557. }
  8558. } else {
  8559. for ( i in obj ) {
  8560. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8561. break;
  8562. }
  8563. }
  8564. }
  8565. return obj;
  8566. },
  8567. // Support: Android <=4.0 only
  8568. trim: function( text ) {
  8569. return text == null ?
  8570. "" :
  8571. ( text + "" ).replace( rtrim, "" );
  8572. },
  8573. // results is for internal usage only
  8574. makeArray: function( arr, results ) {
  8575. var ret = results || [];
  8576. if ( arr != null ) {
  8577. if ( isArrayLike( Object( arr ) ) ) {
  8578. jQuery.merge( ret,
  8579. typeof arr === "string" ?
  8580. [ arr ] : arr
  8581. );
  8582. } else {
  8583. push.call( ret, arr );
  8584. }
  8585. }
  8586. return ret;
  8587. },
  8588. inArray: function( elem, arr, i ) {
  8589. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8590. },
  8591. // Support: Android <=4.0 only, PhantomJS 1 only
  8592. // push.apply(_, arraylike) throws on ancient WebKit
  8593. merge: function( first, second ) {
  8594. var len = +second.length,
  8595. j = 0,
  8596. i = first.length;
  8597. for ( ; j < len; j++ ) {
  8598. first[ i++ ] = second[ j ];
  8599. }
  8600. first.length = i;
  8601. return first;
  8602. },
  8603. grep: function( elems, callback, invert ) {
  8604. var callbackInverse,
  8605. matches = [],
  8606. i = 0,
  8607. length = elems.length,
  8608. callbackExpect = !invert;
  8609. // Go through the array, only saving the items
  8610. // that pass the validator function
  8611. for ( ; i < length; i++ ) {
  8612. callbackInverse = !callback( elems[ i ], i );
  8613. if ( callbackInverse !== callbackExpect ) {
  8614. matches.push( elems[ i ] );
  8615. }
  8616. }
  8617. return matches;
  8618. },
  8619. // arg is for internal usage only
  8620. map: function( elems, callback, arg ) {
  8621. var length, value,
  8622. i = 0,
  8623. ret = [];
  8624. // Go through the array, translating each of the items to their new values
  8625. if ( isArrayLike( elems ) ) {
  8626. length = elems.length;
  8627. for ( ; i < length; i++ ) {
  8628. value = callback( elems[ i ], i, arg );
  8629. if ( value != null ) {
  8630. ret.push( value );
  8631. }
  8632. }
  8633. // Go through every key on the object,
  8634. } else {
  8635. for ( i in elems ) {
  8636. value = callback( elems[ i ], i, arg );
  8637. if ( value != null ) {
  8638. ret.push( value );
  8639. }
  8640. }
  8641. }
  8642. // Flatten any nested arrays
  8643. return concat.apply( [], ret );
  8644. },
  8645. // A global GUID counter for objects
  8646. guid: 1,
  8647. // jQuery.support is not used in Core but other projects attach their
  8648. // properties to it so it needs to exist.
  8649. support: support
  8650. } );
  8651. if ( typeof Symbol === "function" ) {
  8652. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8653. }
  8654. // Populate the class2type map
  8655. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8656. function( i, name ) {
  8657. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8658. } );
  8659. function isArrayLike( obj ) {
  8660. // Support: real iOS 8.2 only (not reproducible in simulator)
  8661. // `in` check used to prevent JIT error (gh-2145)
  8662. // hasOwn isn't used here due to false negatives
  8663. // regarding Nodelist length in IE
  8664. var length = !!obj && "length" in obj && obj.length,
  8665. type = toType( obj );
  8666. if ( isFunction( obj ) || isWindow( obj ) ) {
  8667. return false;
  8668. }
  8669. return type === "array" || length === 0 ||
  8670. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8671. }
  8672. var Sizzle =
  8673. /*!
  8674. * Sizzle CSS Selector Engine v2.3.4
  8675. * https://sizzlejs.com/
  8676. *
  8677. * Copyright JS Foundation and other contributors
  8678. * Released under the MIT license
  8679. * https://js.foundation/
  8680. *
  8681. * Date: 2019-04-08
  8682. */
  8683. (function( window ) {
  8684. var i,
  8685. support,
  8686. Expr,
  8687. getText,
  8688. isXML,
  8689. tokenize,
  8690. compile,
  8691. select,
  8692. outermostContext,
  8693. sortInput,
  8694. hasDuplicate,
  8695. // Local document vars
  8696. setDocument,
  8697. document,
  8698. docElem,
  8699. documentIsHTML,
  8700. rbuggyQSA,
  8701. rbuggyMatches,
  8702. matches,
  8703. contains,
  8704. // Instance-specific data
  8705. expando = "sizzle" + 1 * new Date(),
  8706. preferredDoc = window.document,
  8707. dirruns = 0,
  8708. done = 0,
  8709. classCache = createCache(),
  8710. tokenCache = createCache(),
  8711. compilerCache = createCache(),
  8712. nonnativeSelectorCache = createCache(),
  8713. sortOrder = function( a, b ) {
  8714. if ( a === b ) {
  8715. hasDuplicate = true;
  8716. }
  8717. return 0;
  8718. },
  8719. // Instance methods
  8720. hasOwn = ({}).hasOwnProperty,
  8721. arr = [],
  8722. pop = arr.pop,
  8723. push_native = arr.push,
  8724. push = arr.push,
  8725. slice = arr.slice,
  8726. // Use a stripped-down indexOf as it's faster than native
  8727. // https://jsperf.com/thor-indexof-vs-for/5
  8728. indexOf = function( list, elem ) {
  8729. var i = 0,
  8730. len = list.length;
  8731. for ( ; i < len; i++ ) {
  8732. if ( list[i] === elem ) {
  8733. return i;
  8734. }
  8735. }
  8736. return -1;
  8737. },
  8738. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  8739. // Regular expressions
  8740. // http://www.w3.org/TR/css3-selectors/#whitespace
  8741. whitespace = "[\\x20\\t\\r\\n\\f]",
  8742. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  8743. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  8744. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  8745. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  8746. // Operator (capture 2)
  8747. "*([*^$|!~]?=)" + whitespace +
  8748. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  8749. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  8750. "*\\]",
  8751. pseudos = ":(" + identifier + ")(?:\\((" +
  8752. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  8753. // 1. quoted (capture 3; capture 4 or capture 5)
  8754. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  8755. // 2. simple (capture 6)
  8756. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  8757. // 3. anything else (capture 2)
  8758. ".*" +
  8759. ")\\)|)",
  8760. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  8761. rwhitespace = new RegExp( whitespace + "+", "g" ),
  8762. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  8763. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  8764. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  8765. rdescend = new RegExp( whitespace + "|>" ),
  8766. rpseudo = new RegExp( pseudos ),
  8767. ridentifier = new RegExp( "^" + identifier + "$" ),
  8768. matchExpr = {
  8769. "ID": new RegExp( "^#(" + identifier + ")" ),
  8770. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  8771. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  8772. "ATTR": new RegExp( "^" + attributes ),
  8773. "PSEUDO": new RegExp( "^" + pseudos ),
  8774. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  8775. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  8776. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  8777. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  8778. // For use in libraries implementing .is()
  8779. // We use this for POS matching in `select`
  8780. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  8781. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  8782. },
  8783. rhtml = /HTML$/i,
  8784. rinputs = /^(?:input|select|textarea|button)$/i,
  8785. rheader = /^h\d$/i,
  8786. rnative = /^[^{]+\{\s*\[native \w/,
  8787. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  8788. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  8789. rsibling = /[+~]/,
  8790. // CSS escapes
  8791. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  8792. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  8793. funescape = function( _, escaped, escapedWhitespace ) {
  8794. var high = "0x" + escaped - 0x10000;
  8795. // NaN means non-codepoint
  8796. // Support: Firefox<24
  8797. // Workaround erroneous numeric interpretation of +"0x"
  8798. return high !== high || escapedWhitespace ?
  8799. escaped :
  8800. high < 0 ?
  8801. // BMP codepoint
  8802. String.fromCharCode( high + 0x10000 ) :
  8803. // Supplemental Plane codepoint (surrogate pair)
  8804. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  8805. },
  8806. // CSS string/identifier serialization
  8807. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  8808. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  8809. fcssescape = function( ch, asCodePoint ) {
  8810. if ( asCodePoint ) {
  8811. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  8812. if ( ch === "\0" ) {
  8813. return "\uFFFD";
  8814. }
  8815. // Control characters and (dependent upon position) numbers get escaped as code points
  8816. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  8817. }
  8818. // Other potentially-special ASCII characters get backslash-escaped
  8819. return "\\" + ch;
  8820. },
  8821. // Used for iframes
  8822. // See setDocument()
  8823. // Removing the function wrapper causes a "Permission Denied"
  8824. // error in IE
  8825. unloadHandler = function() {
  8826. setDocument();
  8827. },
  8828. inDisabledFieldset = addCombinator(
  8829. function( elem ) {
  8830. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  8831. },
  8832. { dir: "parentNode", next: "legend" }
  8833. );
  8834. // Optimize for push.apply( _, NodeList )
  8835. try {
  8836. push.apply(
  8837. (arr = slice.call( preferredDoc.childNodes )),
  8838. preferredDoc.childNodes
  8839. );
  8840. // Support: Android<4.0
  8841. // Detect silently failing push.apply
  8842. arr[ preferredDoc.childNodes.length ].nodeType;
  8843. } catch ( e ) {
  8844. push = { apply: arr.length ?
  8845. // Leverage slice if possible
  8846. function( target, els ) {
  8847. push_native.apply( target, slice.call(els) );
  8848. } :
  8849. // Support: IE<9
  8850. // Otherwise append directly
  8851. function( target, els ) {
  8852. var j = target.length,
  8853. i = 0;
  8854. // Can't trust NodeList.length
  8855. while ( (target[j++] = els[i++]) ) {}
  8856. target.length = j - 1;
  8857. }
  8858. };
  8859. }
  8860. function Sizzle( selector, context, results, seed ) {
  8861. var m, i, elem, nid, match, groups, newSelector,
  8862. newContext = context && context.ownerDocument,
  8863. // nodeType defaults to 9, since context defaults to document
  8864. nodeType = context ? context.nodeType : 9;
  8865. results = results || [];
  8866. // Return early from calls with invalid selector or context
  8867. if ( typeof selector !== "string" || !selector ||
  8868. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  8869. return results;
  8870. }
  8871. // Try to shortcut find operations (as opposed to filters) in HTML documents
  8872. if ( !seed ) {
  8873. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  8874. setDocument( context );
  8875. }
  8876. context = context || document;
  8877. if ( documentIsHTML ) {
  8878. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  8879. // (excepting DocumentFragment context, where the methods don't exist)
  8880. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  8881. // ID selector
  8882. if ( (m = match[1]) ) {
  8883. // Document context
  8884. if ( nodeType === 9 ) {
  8885. if ( (elem = context.getElementById( m )) ) {
  8886. // Support: IE, Opera, Webkit
  8887. // TODO: identify versions
  8888. // getElementById can match elements by name instead of ID
  8889. if ( elem.id === m ) {
  8890. results.push( elem );
  8891. return results;
  8892. }
  8893. } else {
  8894. return results;
  8895. }
  8896. // Element context
  8897. } else {
  8898. // Support: IE, Opera, Webkit
  8899. // TODO: identify versions
  8900. // getElementById can match elements by name instead of ID
  8901. if ( newContext && (elem = newContext.getElementById( m )) &&
  8902. contains( context, elem ) &&
  8903. elem.id === m ) {
  8904. results.push( elem );
  8905. return results;
  8906. }
  8907. }
  8908. // Type selector
  8909. } else if ( match[2] ) {
  8910. push.apply( results, context.getElementsByTagName( selector ) );
  8911. return results;
  8912. // Class selector
  8913. } else if ( (m = match[3]) && support.getElementsByClassName &&
  8914. context.getElementsByClassName ) {
  8915. push.apply( results, context.getElementsByClassName( m ) );
  8916. return results;
  8917. }
  8918. }
  8919. // Take advantage of querySelectorAll
  8920. if ( support.qsa &&
  8921. !nonnativeSelectorCache[ selector + " " ] &&
  8922. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  8923. // Support: IE 8 only
  8924. // Exclude object elements
  8925. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  8926. newSelector = selector;
  8927. newContext = context;
  8928. // qSA considers elements outside a scoping root when evaluating child or
  8929. // descendant combinators, which is not what we want.
  8930. // In such cases, we work around the behavior by prefixing every selector in the
  8931. // list with an ID selector referencing the scope context.
  8932. // Thanks to Andrew Dupont for this technique.
  8933. if ( nodeType === 1 && rdescend.test( selector ) ) {
  8934. // Capture the context ID, setting it first if necessary
  8935. if ( (nid = context.getAttribute( "id" )) ) {
  8936. nid = nid.replace( rcssescape, fcssescape );
  8937. } else {
  8938. context.setAttribute( "id", (nid = expando) );
  8939. }
  8940. // Prefix every selector in the list
  8941. groups = tokenize( selector );
  8942. i = groups.length;
  8943. while ( i-- ) {
  8944. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  8945. }
  8946. newSelector = groups.join( "," );
  8947. // Expand context for sibling selectors
  8948. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  8949. context;
  8950. }
  8951. try {
  8952. push.apply( results,
  8953. newContext.querySelectorAll( newSelector )
  8954. );
  8955. return results;
  8956. } catch ( qsaError ) {
  8957. nonnativeSelectorCache( selector, true );
  8958. } finally {
  8959. if ( nid === expando ) {
  8960. context.removeAttribute( "id" );
  8961. }
  8962. }
  8963. }
  8964. }
  8965. }
  8966. // All others
  8967. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  8968. }
  8969. /**
  8970. * Create key-value caches of limited size
  8971. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  8972. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  8973. * deleting the oldest entry
  8974. */
  8975. function createCache() {
  8976. var keys = [];
  8977. function cache( key, value ) {
  8978. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  8979. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  8980. // Only keep the most recent entries
  8981. delete cache[ keys.shift() ];
  8982. }
  8983. return (cache[ key + " " ] = value);
  8984. }
  8985. return cache;
  8986. }
  8987. /**
  8988. * Mark a function for special use by Sizzle
  8989. * @param {Function} fn The function to mark
  8990. */
  8991. function markFunction( fn ) {
  8992. fn[ expando ] = true;
  8993. return fn;
  8994. }
  8995. /**
  8996. * Support testing using an element
  8997. * @param {Function} fn Passed the created element and returns a boolean result
  8998. */
  8999. function assert( fn ) {
  9000. var el = document.createElement("fieldset");
  9001. try {
  9002. return !!fn( el );
  9003. } catch (e) {
  9004. return false;
  9005. } finally {
  9006. // Remove from its parent by default
  9007. if ( el.parentNode ) {
  9008. el.parentNode.removeChild( el );
  9009. }
  9010. // release memory in IE
  9011. el = null;
  9012. }
  9013. }
  9014. /**
  9015. * Adds the same handler for all of the specified attrs
  9016. * @param {String} attrs Pipe-separated list of attributes
  9017. * @param {Function} handler The method that will be applied
  9018. */
  9019. function addHandle( attrs, handler ) {
  9020. var arr = attrs.split("|"),
  9021. i = arr.length;
  9022. while ( i-- ) {
  9023. Expr.attrHandle[ arr[i] ] = handler;
  9024. }
  9025. }
  9026. /**
  9027. * Checks document order of two siblings
  9028. * @param {Element} a
  9029. * @param {Element} b
  9030. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9031. */
  9032. function siblingCheck( a, b ) {
  9033. var cur = b && a,
  9034. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9035. a.sourceIndex - b.sourceIndex;
  9036. // Use IE sourceIndex if available on both nodes
  9037. if ( diff ) {
  9038. return diff;
  9039. }
  9040. // Check if b follows a
  9041. if ( cur ) {
  9042. while ( (cur = cur.nextSibling) ) {
  9043. if ( cur === b ) {
  9044. return -1;
  9045. }
  9046. }
  9047. }
  9048. return a ? 1 : -1;
  9049. }
  9050. /**
  9051. * Returns a function to use in pseudos for input types
  9052. * @param {String} type
  9053. */
  9054. function createInputPseudo( type ) {
  9055. return function( elem ) {
  9056. var name = elem.nodeName.toLowerCase();
  9057. return name === "input" && elem.type === type;
  9058. };
  9059. }
  9060. /**
  9061. * Returns a function to use in pseudos for buttons
  9062. * @param {String} type
  9063. */
  9064. function createButtonPseudo( type ) {
  9065. return function( elem ) {
  9066. var name = elem.nodeName.toLowerCase();
  9067. return (name === "input" || name === "button") && elem.type === type;
  9068. };
  9069. }
  9070. /**
  9071. * Returns a function to use in pseudos for :enabled/:disabled
  9072. * @param {Boolean} disabled true for :disabled; false for :enabled
  9073. */
  9074. function createDisabledPseudo( disabled ) {
  9075. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9076. return function( elem ) {
  9077. // Only certain elements can match :enabled or :disabled
  9078. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9079. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9080. if ( "form" in elem ) {
  9081. // Check for inherited disabledness on relevant non-disabled elements:
  9082. // * listed form-associated elements in a disabled fieldset
  9083. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9084. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9085. // * option elements in a disabled optgroup
  9086. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9087. // All such elements have a "form" property.
  9088. if ( elem.parentNode && elem.disabled === false ) {
  9089. // Option elements defer to a parent optgroup if present
  9090. if ( "label" in elem ) {
  9091. if ( "label" in elem.parentNode ) {
  9092. return elem.parentNode.disabled === disabled;
  9093. } else {
  9094. return elem.disabled === disabled;
  9095. }
  9096. }
  9097. // Support: IE 6 - 11
  9098. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9099. return elem.isDisabled === disabled ||
  9100. // Where there is no isDisabled, check manually
  9101. /* jshint -W018 */
  9102. elem.isDisabled !== !disabled &&
  9103. inDisabledFieldset( elem ) === disabled;
  9104. }
  9105. return elem.disabled === disabled;
  9106. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9107. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9108. // even exist on them, let alone have a boolean value.
  9109. } else if ( "label" in elem ) {
  9110. return elem.disabled === disabled;
  9111. }
  9112. // Remaining elements are neither :enabled nor :disabled
  9113. return false;
  9114. };
  9115. }
  9116. /**
  9117. * Returns a function to use in pseudos for positionals
  9118. * @param {Function} fn
  9119. */
  9120. function createPositionalPseudo( fn ) {
  9121. return markFunction(function( argument ) {
  9122. argument = +argument;
  9123. return markFunction(function( seed, matches ) {
  9124. var j,
  9125. matchIndexes = fn( [], seed.length, argument ),
  9126. i = matchIndexes.length;
  9127. // Match elements found at the specified indexes
  9128. while ( i-- ) {
  9129. if ( seed[ (j = matchIndexes[i]) ] ) {
  9130. seed[j] = !(matches[j] = seed[j]);
  9131. }
  9132. }
  9133. });
  9134. });
  9135. }
  9136. /**
  9137. * Checks a node for validity as a Sizzle context
  9138. * @param {Element|Object=} context
  9139. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9140. */
  9141. function testContext( context ) {
  9142. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9143. }
  9144. // Expose support vars for convenience
  9145. support = Sizzle.support = {};
  9146. /**
  9147. * Detects XML nodes
  9148. * @param {Element|Object} elem An element or a document
  9149. * @returns {Boolean} True iff elem is a non-HTML XML node
  9150. */
  9151. isXML = Sizzle.isXML = function( elem ) {
  9152. var namespace = elem.namespaceURI,
  9153. docElem = (elem.ownerDocument || elem).documentElement;
  9154. // Support: IE <=8
  9155. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9156. // https://bugs.jquery.com/ticket/4833
  9157. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9158. };
  9159. /**
  9160. * Sets document-related variables once based on the current document
  9161. * @param {Element|Object} [doc] An element or document object to use to set the document
  9162. * @returns {Object} Returns the current document
  9163. */
  9164. setDocument = Sizzle.setDocument = function( node ) {
  9165. var hasCompare, subWindow,
  9166. doc = node ? node.ownerDocument || node : preferredDoc;
  9167. // Return early if doc is invalid or already selected
  9168. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9169. return document;
  9170. }
  9171. // Update global variables
  9172. document = doc;
  9173. docElem = document.documentElement;
  9174. documentIsHTML = !isXML( document );
  9175. // Support: IE 9-11, Edge
  9176. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9177. if ( preferredDoc !== document &&
  9178. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9179. // Support: IE 11, Edge
  9180. if ( subWindow.addEventListener ) {
  9181. subWindow.addEventListener( "unload", unloadHandler, false );
  9182. // Support: IE 9 - 10 only
  9183. } else if ( subWindow.attachEvent ) {
  9184. subWindow.attachEvent( "onunload", unloadHandler );
  9185. }
  9186. }
  9187. /* Attributes
  9188. ---------------------------------------------------------------------- */
  9189. // Support: IE<8
  9190. // Verify that getAttribute really returns attributes and not properties
  9191. // (excepting IE8 booleans)
  9192. support.attributes = assert(function( el ) {
  9193. el.className = "i";
  9194. return !el.getAttribute("className");
  9195. });
  9196. /* getElement(s)By*
  9197. ---------------------------------------------------------------------- */
  9198. // Check if getElementsByTagName("*") returns only elements
  9199. support.getElementsByTagName = assert(function( el ) {
  9200. el.appendChild( document.createComment("") );
  9201. return !el.getElementsByTagName("*").length;
  9202. });
  9203. // Support: IE<9
  9204. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9205. // Support: IE<10
  9206. // Check if getElementById returns elements by name
  9207. // The broken getElementById methods don't pick up programmatically-set names,
  9208. // so use a roundabout getElementsByName test
  9209. support.getById = assert(function( el ) {
  9210. docElem.appendChild( el ).id = expando;
  9211. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9212. });
  9213. // ID filter and find
  9214. if ( support.getById ) {
  9215. Expr.filter["ID"] = function( id ) {
  9216. var attrId = id.replace( runescape, funescape );
  9217. return function( elem ) {
  9218. return elem.getAttribute("id") === attrId;
  9219. };
  9220. };
  9221. Expr.find["ID"] = function( id, context ) {
  9222. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9223. var elem = context.getElementById( id );
  9224. return elem ? [ elem ] : [];
  9225. }
  9226. };
  9227. } else {
  9228. Expr.filter["ID"] = function( id ) {
  9229. var attrId = id.replace( runescape, funescape );
  9230. return function( elem ) {
  9231. var node = typeof elem.getAttributeNode !== "undefined" &&
  9232. elem.getAttributeNode("id");
  9233. return node && node.value === attrId;
  9234. };
  9235. };
  9236. // Support: IE 6 - 7 only
  9237. // getElementById is not reliable as a find shortcut
  9238. Expr.find["ID"] = function( id, context ) {
  9239. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9240. var node, i, elems,
  9241. elem = context.getElementById( id );
  9242. if ( elem ) {
  9243. // Verify the id attribute
  9244. node = elem.getAttributeNode("id");
  9245. if ( node && node.value === id ) {
  9246. return [ elem ];
  9247. }
  9248. // Fall back on getElementsByName
  9249. elems = context.getElementsByName( id );
  9250. i = 0;
  9251. while ( (elem = elems[i++]) ) {
  9252. node = elem.getAttributeNode("id");
  9253. if ( node && node.value === id ) {
  9254. return [ elem ];
  9255. }
  9256. }
  9257. }
  9258. return [];
  9259. }
  9260. };
  9261. }
  9262. // Tag
  9263. Expr.find["TAG"] = support.getElementsByTagName ?
  9264. function( tag, context ) {
  9265. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9266. return context.getElementsByTagName( tag );
  9267. // DocumentFragment nodes don't have gEBTN
  9268. } else if ( support.qsa ) {
  9269. return context.querySelectorAll( tag );
  9270. }
  9271. } :
  9272. function( tag, context ) {
  9273. var elem,
  9274. tmp = [],
  9275. i = 0,
  9276. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9277. results = context.getElementsByTagName( tag );
  9278. // Filter out possible comments
  9279. if ( tag === "*" ) {
  9280. while ( (elem = results[i++]) ) {
  9281. if ( elem.nodeType === 1 ) {
  9282. tmp.push( elem );
  9283. }
  9284. }
  9285. return tmp;
  9286. }
  9287. return results;
  9288. };
  9289. // Class
  9290. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9291. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9292. return context.getElementsByClassName( className );
  9293. }
  9294. };
  9295. /* QSA/matchesSelector
  9296. ---------------------------------------------------------------------- */
  9297. // QSA and matchesSelector support
  9298. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9299. rbuggyMatches = [];
  9300. // qSa(:focus) reports false when true (Chrome 21)
  9301. // We allow this because of a bug in IE8/9 that throws an error
  9302. // whenever `document.activeElement` is accessed on an iframe
  9303. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9304. // See https://bugs.jquery.com/ticket/13378
  9305. rbuggyQSA = [];
  9306. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9307. // Build QSA regex
  9308. // Regex strategy adopted from Diego Perini
  9309. assert(function( el ) {
  9310. // Select is set to empty string on purpose
  9311. // This is to test IE's treatment of not explicitly
  9312. // setting a boolean content attribute,
  9313. // since its presence should be enough
  9314. // https://bugs.jquery.com/ticket/12359
  9315. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9316. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9317. "<option selected=''></option></select>";
  9318. // Support: IE8, Opera 11-12.16
  9319. // Nothing should be selected when empty strings follow ^= or $= or *=
  9320. // The test attribute must be unknown in Opera but "safe" for WinRT
  9321. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9322. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9323. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9324. }
  9325. // Support: IE8
  9326. // Boolean attributes and "value" are not treated correctly
  9327. if ( !el.querySelectorAll("[selected]").length ) {
  9328. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9329. }
  9330. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9331. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9332. rbuggyQSA.push("~=");
  9333. }
  9334. // Webkit/Opera - :checked should return selected option elements
  9335. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9336. // IE8 throws error here and will not see later tests
  9337. if ( !el.querySelectorAll(":checked").length ) {
  9338. rbuggyQSA.push(":checked");
  9339. }
  9340. // Support: Safari 8+, iOS 8+
  9341. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9342. // In-page `selector#id sibling-combinator selector` fails
  9343. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9344. rbuggyQSA.push(".#.+[+~]");
  9345. }
  9346. });
  9347. assert(function( el ) {
  9348. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9349. "<select disabled='disabled'><option/></select>";
  9350. // Support: Windows 8 Native Apps
  9351. // The type and name attributes are restricted during .innerHTML assignment
  9352. var input = document.createElement("input");
  9353. input.setAttribute( "type", "hidden" );
  9354. el.appendChild( input ).setAttribute( "name", "D" );
  9355. // Support: IE8
  9356. // Enforce case-sensitivity of name attribute
  9357. if ( el.querySelectorAll("[name=d]").length ) {
  9358. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9359. }
  9360. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9361. // IE8 throws error here and will not see later tests
  9362. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9363. rbuggyQSA.push( ":enabled", ":disabled" );
  9364. }
  9365. // Support: IE9-11+
  9366. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9367. docElem.appendChild( el ).disabled = true;
  9368. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9369. rbuggyQSA.push( ":enabled", ":disabled" );
  9370. }
  9371. // Opera 10-11 does not throw on post-comma invalid pseudos
  9372. el.querySelectorAll("*,:x");
  9373. rbuggyQSA.push(",.*:");
  9374. });
  9375. }
  9376. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9377. docElem.webkitMatchesSelector ||
  9378. docElem.mozMatchesSelector ||
  9379. docElem.oMatchesSelector ||
  9380. docElem.msMatchesSelector) )) ) {
  9381. assert(function( el ) {
  9382. // Check to see if it's possible to do matchesSelector
  9383. // on a disconnected node (IE 9)
  9384. support.disconnectedMatch = matches.call( el, "*" );
  9385. // This should fail with an exception
  9386. // Gecko does not error, returns false instead
  9387. matches.call( el, "[s!='']:x" );
  9388. rbuggyMatches.push( "!=", pseudos );
  9389. });
  9390. }
  9391. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9392. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9393. /* Contains
  9394. ---------------------------------------------------------------------- */
  9395. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9396. // Element contains another
  9397. // Purposefully self-exclusive
  9398. // As in, an element does not contain itself
  9399. contains = hasCompare || rnative.test( docElem.contains ) ?
  9400. function( a, b ) {
  9401. var adown = a.nodeType === 9 ? a.documentElement : a,
  9402. bup = b && b.parentNode;
  9403. return a === bup || !!( bup && bup.nodeType === 1 && (
  9404. adown.contains ?
  9405. adown.contains( bup ) :
  9406. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9407. ));
  9408. } :
  9409. function( a, b ) {
  9410. if ( b ) {
  9411. while ( (b = b.parentNode) ) {
  9412. if ( b === a ) {
  9413. return true;
  9414. }
  9415. }
  9416. }
  9417. return false;
  9418. };
  9419. /* Sorting
  9420. ---------------------------------------------------------------------- */
  9421. // Document order sorting
  9422. sortOrder = hasCompare ?
  9423. function( a, b ) {
  9424. // Flag for duplicate removal
  9425. if ( a === b ) {
  9426. hasDuplicate = true;
  9427. return 0;
  9428. }
  9429. // Sort on method existence if only one input has compareDocumentPosition
  9430. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9431. if ( compare ) {
  9432. return compare;
  9433. }
  9434. // Calculate position if both inputs belong to the same document
  9435. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9436. a.compareDocumentPosition( b ) :
  9437. // Otherwise we know they are disconnected
  9438. 1;
  9439. // Disconnected nodes
  9440. if ( compare & 1 ||
  9441. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9442. // Choose the first element that is related to our preferred document
  9443. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9444. return -1;
  9445. }
  9446. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9447. return 1;
  9448. }
  9449. // Maintain original order
  9450. return sortInput ?
  9451. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9452. 0;
  9453. }
  9454. return compare & 4 ? -1 : 1;
  9455. } :
  9456. function( a, b ) {
  9457. // Exit early if the nodes are identical
  9458. if ( a === b ) {
  9459. hasDuplicate = true;
  9460. return 0;
  9461. }
  9462. var cur,
  9463. i = 0,
  9464. aup = a.parentNode,
  9465. bup = b.parentNode,
  9466. ap = [ a ],
  9467. bp = [ b ];
  9468. // Parentless nodes are either documents or disconnected
  9469. if ( !aup || !bup ) {
  9470. return a === document ? -1 :
  9471. b === document ? 1 :
  9472. aup ? -1 :
  9473. bup ? 1 :
  9474. sortInput ?
  9475. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9476. 0;
  9477. // If the nodes are siblings, we can do a quick check
  9478. } else if ( aup === bup ) {
  9479. return siblingCheck( a, b );
  9480. }
  9481. // Otherwise we need full lists of their ancestors for comparison
  9482. cur = a;
  9483. while ( (cur = cur.parentNode) ) {
  9484. ap.unshift( cur );
  9485. }
  9486. cur = b;
  9487. while ( (cur = cur.parentNode) ) {
  9488. bp.unshift( cur );
  9489. }
  9490. // Walk down the tree looking for a discrepancy
  9491. while ( ap[i] === bp[i] ) {
  9492. i++;
  9493. }
  9494. return i ?
  9495. // Do a sibling check if the nodes have a common ancestor
  9496. siblingCheck( ap[i], bp[i] ) :
  9497. // Otherwise nodes in our document sort first
  9498. ap[i] === preferredDoc ? -1 :
  9499. bp[i] === preferredDoc ? 1 :
  9500. 0;
  9501. };
  9502. return document;
  9503. };
  9504. Sizzle.matches = function( expr, elements ) {
  9505. return Sizzle( expr, null, null, elements );
  9506. };
  9507. Sizzle.matchesSelector = function( elem, expr ) {
  9508. // Set document vars if needed
  9509. if ( ( elem.ownerDocument || elem ) !== document ) {
  9510. setDocument( elem );
  9511. }
  9512. if ( support.matchesSelector && documentIsHTML &&
  9513. !nonnativeSelectorCache[ expr + " " ] &&
  9514. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9515. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9516. try {
  9517. var ret = matches.call( elem, expr );
  9518. // IE 9's matchesSelector returns false on disconnected nodes
  9519. if ( ret || support.disconnectedMatch ||
  9520. // As well, disconnected nodes are said to be in a document
  9521. // fragment in IE 9
  9522. elem.document && elem.document.nodeType !== 11 ) {
  9523. return ret;
  9524. }
  9525. } catch (e) {
  9526. nonnativeSelectorCache( expr, true );
  9527. }
  9528. }
  9529. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9530. };
  9531. Sizzle.contains = function( context, elem ) {
  9532. // Set document vars if needed
  9533. if ( ( context.ownerDocument || context ) !== document ) {
  9534. setDocument( context );
  9535. }
  9536. return contains( context, elem );
  9537. };
  9538. Sizzle.attr = function( elem, name ) {
  9539. // Set document vars if needed
  9540. if ( ( elem.ownerDocument || elem ) !== document ) {
  9541. setDocument( elem );
  9542. }
  9543. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9544. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9545. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9546. fn( elem, name, !documentIsHTML ) :
  9547. undefined;
  9548. return val !== undefined ?
  9549. val :
  9550. support.attributes || !documentIsHTML ?
  9551. elem.getAttribute( name ) :
  9552. (val = elem.getAttributeNode(name)) && val.specified ?
  9553. val.value :
  9554. null;
  9555. };
  9556. Sizzle.escape = function( sel ) {
  9557. return (sel + "").replace( rcssescape, fcssescape );
  9558. };
  9559. Sizzle.error = function( msg ) {
  9560. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9561. };
  9562. /**
  9563. * Document sorting and removing duplicates
  9564. * @param {ArrayLike} results
  9565. */
  9566. Sizzle.uniqueSort = function( results ) {
  9567. var elem,
  9568. duplicates = [],
  9569. j = 0,
  9570. i = 0;
  9571. // Unless we *know* we can detect duplicates, assume their presence
  9572. hasDuplicate = !support.detectDuplicates;
  9573. sortInput = !support.sortStable && results.slice( 0 );
  9574. results.sort( sortOrder );
  9575. if ( hasDuplicate ) {
  9576. while ( (elem = results[i++]) ) {
  9577. if ( elem === results[ i ] ) {
  9578. j = duplicates.push( i );
  9579. }
  9580. }
  9581. while ( j-- ) {
  9582. results.splice( duplicates[ j ], 1 );
  9583. }
  9584. }
  9585. // Clear input after sorting to release objects
  9586. // See https://github.com/jquery/sizzle/pull/225
  9587. sortInput = null;
  9588. return results;
  9589. };
  9590. /**
  9591. * Utility function for retrieving the text value of an array of DOM nodes
  9592. * @param {Array|Element} elem
  9593. */
  9594. getText = Sizzle.getText = function( elem ) {
  9595. var node,
  9596. ret = "",
  9597. i = 0,
  9598. nodeType = elem.nodeType;
  9599. if ( !nodeType ) {
  9600. // If no nodeType, this is expected to be an array
  9601. while ( (node = elem[i++]) ) {
  9602. // Do not traverse comment nodes
  9603. ret += getText( node );
  9604. }
  9605. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9606. // Use textContent for elements
  9607. // innerText usage removed for consistency of new lines (jQuery #11153)
  9608. if ( typeof elem.textContent === "string" ) {
  9609. return elem.textContent;
  9610. } else {
  9611. // Traverse its children
  9612. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9613. ret += getText( elem );
  9614. }
  9615. }
  9616. } else if ( nodeType === 3 || nodeType === 4 ) {
  9617. return elem.nodeValue;
  9618. }
  9619. // Do not include comment or processing instruction nodes
  9620. return ret;
  9621. };
  9622. Expr = Sizzle.selectors = {
  9623. // Can be adjusted by the user
  9624. cacheLength: 50,
  9625. createPseudo: markFunction,
  9626. match: matchExpr,
  9627. attrHandle: {},
  9628. find: {},
  9629. relative: {
  9630. ">": { dir: "parentNode", first: true },
  9631. " ": { dir: "parentNode" },
  9632. "+": { dir: "previousSibling", first: true },
  9633. "~": { dir: "previousSibling" }
  9634. },
  9635. preFilter: {
  9636. "ATTR": function( match ) {
  9637. match[1] = match[1].replace( runescape, funescape );
  9638. // Move the given value to match[3] whether quoted or unquoted
  9639. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9640. if ( match[2] === "~=" ) {
  9641. match[3] = " " + match[3] + " ";
  9642. }
  9643. return match.slice( 0, 4 );
  9644. },
  9645. "CHILD": function( match ) {
  9646. /* matches from matchExpr["CHILD"]
  9647. 1 type (only|nth|...)
  9648. 2 what (child|of-type)
  9649. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9650. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9651. 5 sign of xn-component
  9652. 6 x of xn-component
  9653. 7 sign of y-component
  9654. 8 y of y-component
  9655. */
  9656. match[1] = match[1].toLowerCase();
  9657. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9658. // nth-* requires argument
  9659. if ( !match[3] ) {
  9660. Sizzle.error( match[0] );
  9661. }
  9662. // numeric x and y parameters for Expr.filter.CHILD
  9663. // remember that false/true cast respectively to 0/1
  9664. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9665. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9666. // other types prohibit arguments
  9667. } else if ( match[3] ) {
  9668. Sizzle.error( match[0] );
  9669. }
  9670. return match;
  9671. },
  9672. "PSEUDO": function( match ) {
  9673. var excess,
  9674. unquoted = !match[6] && match[2];
  9675. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9676. return null;
  9677. }
  9678. // Accept quoted arguments as-is
  9679. if ( match[3] ) {
  9680. match[2] = match[4] || match[5] || "";
  9681. // Strip excess characters from unquoted arguments
  9682. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9683. // Get excess from tokenize (recursively)
  9684. (excess = tokenize( unquoted, true )) &&
  9685. // advance to the next closing parenthesis
  9686. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9687. // excess is a negative index
  9688. match[0] = match[0].slice( 0, excess );
  9689. match[2] = unquoted.slice( 0, excess );
  9690. }
  9691. // Return only captures needed by the pseudo filter method (type and argument)
  9692. return match.slice( 0, 3 );
  9693. }
  9694. },
  9695. filter: {
  9696. "TAG": function( nodeNameSelector ) {
  9697. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9698. return nodeNameSelector === "*" ?
  9699. function() { return true; } :
  9700. function( elem ) {
  9701. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9702. };
  9703. },
  9704. "CLASS": function( className ) {
  9705. var pattern = classCache[ className + " " ];
  9706. return pattern ||
  9707. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9708. classCache( className, function( elem ) {
  9709. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9710. });
  9711. },
  9712. "ATTR": function( name, operator, check ) {
  9713. return function( elem ) {
  9714. var result = Sizzle.attr( elem, name );
  9715. if ( result == null ) {
  9716. return operator === "!=";
  9717. }
  9718. if ( !operator ) {
  9719. return true;
  9720. }
  9721. result += "";
  9722. return operator === "=" ? result === check :
  9723. operator === "!=" ? result !== check :
  9724. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9725. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9726. operator === "$=" ? check && result.slice( -check.length ) === check :
  9727. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9728. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9729. false;
  9730. };
  9731. },
  9732. "CHILD": function( type, what, argument, first, last ) {
  9733. var simple = type.slice( 0, 3 ) !== "nth",
  9734. forward = type.slice( -4 ) !== "last",
  9735. ofType = what === "of-type";
  9736. return first === 1 && last === 0 ?
  9737. // Shortcut for :nth-*(n)
  9738. function( elem ) {
  9739. return !!elem.parentNode;
  9740. } :
  9741. function( elem, context, xml ) {
  9742. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  9743. dir = simple !== forward ? "nextSibling" : "previousSibling",
  9744. parent = elem.parentNode,
  9745. name = ofType && elem.nodeName.toLowerCase(),
  9746. useCache = !xml && !ofType,
  9747. diff = false;
  9748. if ( parent ) {
  9749. // :(first|last|only)-(child|of-type)
  9750. if ( simple ) {
  9751. while ( dir ) {
  9752. node = elem;
  9753. while ( (node = node[ dir ]) ) {
  9754. if ( ofType ?
  9755. node.nodeName.toLowerCase() === name :
  9756. node.nodeType === 1 ) {
  9757. return false;
  9758. }
  9759. }
  9760. // Reverse direction for :only-* (if we haven't yet done so)
  9761. start = dir = type === "only" && !start && "nextSibling";
  9762. }
  9763. return true;
  9764. }
  9765. start = [ forward ? parent.firstChild : parent.lastChild ];
  9766. // non-xml :nth-child(...) stores cache data on `parent`
  9767. if ( forward && useCache ) {
  9768. // Seek `elem` from a previously-cached index
  9769. // ...in a gzip-friendly way
  9770. node = parent;
  9771. outerCache = node[ expando ] || (node[ expando ] = {});
  9772. // Support: IE <9 only
  9773. // Defend against cloned attroperties (jQuery gh-1709)
  9774. uniqueCache = outerCache[ node.uniqueID ] ||
  9775. (outerCache[ node.uniqueID ] = {});
  9776. cache = uniqueCache[ type ] || [];
  9777. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9778. diff = nodeIndex && cache[ 2 ];
  9779. node = nodeIndex && parent.childNodes[ nodeIndex ];
  9780. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9781. // Fallback to seeking `elem` from the start
  9782. (diff = nodeIndex = 0) || start.pop()) ) {
  9783. // When found, cache indexes on `parent` and break
  9784. if ( node.nodeType === 1 && ++diff && node === elem ) {
  9785. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  9786. break;
  9787. }
  9788. }
  9789. } else {
  9790. // Use previously-cached element index if available
  9791. if ( useCache ) {
  9792. // ...in a gzip-friendly way
  9793. node = elem;
  9794. outerCache = node[ expando ] || (node[ expando ] = {});
  9795. // Support: IE <9 only
  9796. // Defend against cloned attroperties (jQuery gh-1709)
  9797. uniqueCache = outerCache[ node.uniqueID ] ||
  9798. (outerCache[ node.uniqueID ] = {});
  9799. cache = uniqueCache[ type ] || [];
  9800. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9801. diff = nodeIndex;
  9802. }
  9803. // xml :nth-child(...)
  9804. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  9805. if ( diff === false ) {
  9806. // Use the same loop as above to seek `elem` from the start
  9807. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9808. (diff = nodeIndex = 0) || start.pop()) ) {
  9809. if ( ( ofType ?
  9810. node.nodeName.toLowerCase() === name :
  9811. node.nodeType === 1 ) &&
  9812. ++diff ) {
  9813. // Cache the index of each encountered element
  9814. if ( useCache ) {
  9815. outerCache = node[ expando ] || (node[ expando ] = {});
  9816. // Support: IE <9 only
  9817. // Defend against cloned attroperties (jQuery gh-1709)
  9818. uniqueCache = outerCache[ node.uniqueID ] ||
  9819. (outerCache[ node.uniqueID ] = {});
  9820. uniqueCache[ type ] = [ dirruns, diff ];
  9821. }
  9822. if ( node === elem ) {
  9823. break;
  9824. }
  9825. }
  9826. }
  9827. }
  9828. }
  9829. // Incorporate the offset, then check against cycle size
  9830. diff -= last;
  9831. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  9832. }
  9833. };
  9834. },
  9835. "PSEUDO": function( pseudo, argument ) {
  9836. // pseudo-class names are case-insensitive
  9837. // http://www.w3.org/TR/selectors/#pseudo-classes
  9838. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  9839. // Remember that setFilters inherits from pseudos
  9840. var args,
  9841. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  9842. Sizzle.error( "unsupported pseudo: " + pseudo );
  9843. // The user may use createPseudo to indicate that
  9844. // arguments are needed to create the filter function
  9845. // just as Sizzle does
  9846. if ( fn[ expando ] ) {
  9847. return fn( argument );
  9848. }
  9849. // But maintain support for old signatures
  9850. if ( fn.length > 1 ) {
  9851. args = [ pseudo, pseudo, "", argument ];
  9852. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  9853. markFunction(function( seed, matches ) {
  9854. var idx,
  9855. matched = fn( seed, argument ),
  9856. i = matched.length;
  9857. while ( i-- ) {
  9858. idx = indexOf( seed, matched[i] );
  9859. seed[ idx ] = !( matches[ idx ] = matched[i] );
  9860. }
  9861. }) :
  9862. function( elem ) {
  9863. return fn( elem, 0, args );
  9864. };
  9865. }
  9866. return fn;
  9867. }
  9868. },
  9869. pseudos: {
  9870. // Potentially complex pseudos
  9871. "not": markFunction(function( selector ) {
  9872. // Trim the selector passed to compile
  9873. // to avoid treating leading and trailing
  9874. // spaces as combinators
  9875. var input = [],
  9876. results = [],
  9877. matcher = compile( selector.replace( rtrim, "$1" ) );
  9878. return matcher[ expando ] ?
  9879. markFunction(function( seed, matches, context, xml ) {
  9880. var elem,
  9881. unmatched = matcher( seed, null, xml, [] ),
  9882. i = seed.length;
  9883. // Match elements unmatched by `matcher`
  9884. while ( i-- ) {
  9885. if ( (elem = unmatched[i]) ) {
  9886. seed[i] = !(matches[i] = elem);
  9887. }
  9888. }
  9889. }) :
  9890. function( elem, context, xml ) {
  9891. input[0] = elem;
  9892. matcher( input, null, xml, results );
  9893. // Don't keep the element (issue #299)
  9894. input[0] = null;
  9895. return !results.pop();
  9896. };
  9897. }),
  9898. "has": markFunction(function( selector ) {
  9899. return function( elem ) {
  9900. return Sizzle( selector, elem ).length > 0;
  9901. };
  9902. }),
  9903. "contains": markFunction(function( text ) {
  9904. text = text.replace( runescape, funescape );
  9905. return function( elem ) {
  9906. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  9907. };
  9908. }),
  9909. // "Whether an element is represented by a :lang() selector
  9910. // is based solely on the element's language value
  9911. // being equal to the identifier C,
  9912. // or beginning with the identifier C immediately followed by "-".
  9913. // The matching of C against the element's language value is performed case-insensitively.
  9914. // The identifier C does not have to be a valid language name."
  9915. // http://www.w3.org/TR/selectors/#lang-pseudo
  9916. "lang": markFunction( function( lang ) {
  9917. // lang value must be a valid identifier
  9918. if ( !ridentifier.test(lang || "") ) {
  9919. Sizzle.error( "unsupported lang: " + lang );
  9920. }
  9921. lang = lang.replace( runescape, funescape ).toLowerCase();
  9922. return function( elem ) {
  9923. var elemLang;
  9924. do {
  9925. if ( (elemLang = documentIsHTML ?
  9926. elem.lang :
  9927. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  9928. elemLang = elemLang.toLowerCase();
  9929. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  9930. }
  9931. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  9932. return false;
  9933. };
  9934. }),
  9935. // Miscellaneous
  9936. "target": function( elem ) {
  9937. var hash = window.location && window.location.hash;
  9938. return hash && hash.slice( 1 ) === elem.id;
  9939. },
  9940. "root": function( elem ) {
  9941. return elem === docElem;
  9942. },
  9943. "focus": function( elem ) {
  9944. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  9945. },
  9946. // Boolean properties
  9947. "enabled": createDisabledPseudo( false ),
  9948. "disabled": createDisabledPseudo( true ),
  9949. "checked": function( elem ) {
  9950. // In CSS3, :checked should return both checked and selected elements
  9951. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9952. var nodeName = elem.nodeName.toLowerCase();
  9953. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  9954. },
  9955. "selected": function( elem ) {
  9956. // Accessing this property makes selected-by-default
  9957. // options in Safari work properly
  9958. if ( elem.parentNode ) {
  9959. elem.parentNode.selectedIndex;
  9960. }
  9961. return elem.selected === true;
  9962. },
  9963. // Contents
  9964. "empty": function( elem ) {
  9965. // http://www.w3.org/TR/selectors/#empty-pseudo
  9966. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  9967. // but not by others (comment: 8; processing instruction: 7; etc.)
  9968. // nodeType < 6 works because attributes (2) do not appear as children
  9969. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9970. if ( elem.nodeType < 6 ) {
  9971. return false;
  9972. }
  9973. }
  9974. return true;
  9975. },
  9976. "parent": function( elem ) {
  9977. return !Expr.pseudos["empty"]( elem );
  9978. },
  9979. // Element/input types
  9980. "header": function( elem ) {
  9981. return rheader.test( elem.nodeName );
  9982. },
  9983. "input": function( elem ) {
  9984. return rinputs.test( elem.nodeName );
  9985. },
  9986. "button": function( elem ) {
  9987. var name = elem.nodeName.toLowerCase();
  9988. return name === "input" && elem.type === "button" || name === "button";
  9989. },
  9990. "text": function( elem ) {
  9991. var attr;
  9992. return elem.nodeName.toLowerCase() === "input" &&
  9993. elem.type === "text" &&
  9994. // Support: IE<8
  9995. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  9996. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  9997. },
  9998. // Position-in-collection
  9999. "first": createPositionalPseudo(function() {
  10000. return [ 0 ];
  10001. }),
  10002. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10003. return [ length - 1 ];
  10004. }),
  10005. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10006. return [ argument < 0 ? argument + length : argument ];
  10007. }),
  10008. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10009. var i = 0;
  10010. for ( ; i < length; i += 2 ) {
  10011. matchIndexes.push( i );
  10012. }
  10013. return matchIndexes;
  10014. }),
  10015. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10016. var i = 1;
  10017. for ( ; i < length; i += 2 ) {
  10018. matchIndexes.push( i );
  10019. }
  10020. return matchIndexes;
  10021. }),
  10022. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10023. var i = argument < 0 ?
  10024. argument + length :
  10025. argument > length ?
  10026. length :
  10027. argument;
  10028. for ( ; --i >= 0; ) {
  10029. matchIndexes.push( i );
  10030. }
  10031. return matchIndexes;
  10032. }),
  10033. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10034. var i = argument < 0 ? argument + length : argument;
  10035. for ( ; ++i < length; ) {
  10036. matchIndexes.push( i );
  10037. }
  10038. return matchIndexes;
  10039. })
  10040. }
  10041. };
  10042. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10043. // Add button/input type pseudos
  10044. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10045. Expr.pseudos[ i ] = createInputPseudo( i );
  10046. }
  10047. for ( i in { submit: true, reset: true } ) {
  10048. Expr.pseudos[ i ] = createButtonPseudo( i );
  10049. }
  10050. // Easy API for creating new setFilters
  10051. function setFilters() {}
  10052. setFilters.prototype = Expr.filters = Expr.pseudos;
  10053. Expr.setFilters = new setFilters();
  10054. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10055. var matched, match, tokens, type,
  10056. soFar, groups, preFilters,
  10057. cached = tokenCache[ selector + " " ];
  10058. if ( cached ) {
  10059. return parseOnly ? 0 : cached.slice( 0 );
  10060. }
  10061. soFar = selector;
  10062. groups = [];
  10063. preFilters = Expr.preFilter;
  10064. while ( soFar ) {
  10065. // Comma and first run
  10066. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10067. if ( match ) {
  10068. // Don't consume trailing commas as valid
  10069. soFar = soFar.slice( match[0].length ) || soFar;
  10070. }
  10071. groups.push( (tokens = []) );
  10072. }
  10073. matched = false;
  10074. // Combinators
  10075. if ( (match = rcombinators.exec( soFar )) ) {
  10076. matched = match.shift();
  10077. tokens.push({
  10078. value: matched,
  10079. // Cast descendant combinators to space
  10080. type: match[0].replace( rtrim, " " )
  10081. });
  10082. soFar = soFar.slice( matched.length );
  10083. }
  10084. // Filters
  10085. for ( type in Expr.filter ) {
  10086. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10087. (match = preFilters[ type ]( match ))) ) {
  10088. matched = match.shift();
  10089. tokens.push({
  10090. value: matched,
  10091. type: type,
  10092. matches: match
  10093. });
  10094. soFar = soFar.slice( matched.length );
  10095. }
  10096. }
  10097. if ( !matched ) {
  10098. break;
  10099. }
  10100. }
  10101. // Return the length of the invalid excess
  10102. // if we're just parsing
  10103. // Otherwise, throw an error or return tokens
  10104. return parseOnly ?
  10105. soFar.length :
  10106. soFar ?
  10107. Sizzle.error( selector ) :
  10108. // Cache the tokens
  10109. tokenCache( selector, groups ).slice( 0 );
  10110. };
  10111. function toSelector( tokens ) {
  10112. var i = 0,
  10113. len = tokens.length,
  10114. selector = "";
  10115. for ( ; i < len; i++ ) {
  10116. selector += tokens[i].value;
  10117. }
  10118. return selector;
  10119. }
  10120. function addCombinator( matcher, combinator, base ) {
  10121. var dir = combinator.dir,
  10122. skip = combinator.next,
  10123. key = skip || dir,
  10124. checkNonElements = base && key === "parentNode",
  10125. doneName = done++;
  10126. return combinator.first ?
  10127. // Check against closest ancestor/preceding element
  10128. function( elem, context, xml ) {
  10129. while ( (elem = elem[ dir ]) ) {
  10130. if ( elem.nodeType === 1 || checkNonElements ) {
  10131. return matcher( elem, context, xml );
  10132. }
  10133. }
  10134. return false;
  10135. } :
  10136. // Check against all ancestor/preceding elements
  10137. function( elem, context, xml ) {
  10138. var oldCache, uniqueCache, outerCache,
  10139. newCache = [ dirruns, doneName ];
  10140. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10141. if ( xml ) {
  10142. while ( (elem = elem[ dir ]) ) {
  10143. if ( elem.nodeType === 1 || checkNonElements ) {
  10144. if ( matcher( elem, context, xml ) ) {
  10145. return true;
  10146. }
  10147. }
  10148. }
  10149. } else {
  10150. while ( (elem = elem[ dir ]) ) {
  10151. if ( elem.nodeType === 1 || checkNonElements ) {
  10152. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10153. // Support: IE <9 only
  10154. // Defend against cloned attroperties (jQuery gh-1709)
  10155. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10156. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10157. elem = elem[ dir ] || elem;
  10158. } else if ( (oldCache = uniqueCache[ key ]) &&
  10159. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10160. // Assign to newCache so results back-propagate to previous elements
  10161. return (newCache[ 2 ] = oldCache[ 2 ]);
  10162. } else {
  10163. // Reuse newcache so results back-propagate to previous elements
  10164. uniqueCache[ key ] = newCache;
  10165. // A match means we're done; a fail means we have to keep checking
  10166. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10167. return true;
  10168. }
  10169. }
  10170. }
  10171. }
  10172. }
  10173. return false;
  10174. };
  10175. }
  10176. function elementMatcher( matchers ) {
  10177. return matchers.length > 1 ?
  10178. function( elem, context, xml ) {
  10179. var i = matchers.length;
  10180. while ( i-- ) {
  10181. if ( !matchers[i]( elem, context, xml ) ) {
  10182. return false;
  10183. }
  10184. }
  10185. return true;
  10186. } :
  10187. matchers[0];
  10188. }
  10189. function multipleContexts( selector, contexts, results ) {
  10190. var i = 0,
  10191. len = contexts.length;
  10192. for ( ; i < len; i++ ) {
  10193. Sizzle( selector, contexts[i], results );
  10194. }
  10195. return results;
  10196. }
  10197. function condense( unmatched, map, filter, context, xml ) {
  10198. var elem,
  10199. newUnmatched = [],
  10200. i = 0,
  10201. len = unmatched.length,
  10202. mapped = map != null;
  10203. for ( ; i < len; i++ ) {
  10204. if ( (elem = unmatched[i]) ) {
  10205. if ( !filter || filter( elem, context, xml ) ) {
  10206. newUnmatched.push( elem );
  10207. if ( mapped ) {
  10208. map.push( i );
  10209. }
  10210. }
  10211. }
  10212. }
  10213. return newUnmatched;
  10214. }
  10215. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10216. if ( postFilter && !postFilter[ expando ] ) {
  10217. postFilter = setMatcher( postFilter );
  10218. }
  10219. if ( postFinder && !postFinder[ expando ] ) {
  10220. postFinder = setMatcher( postFinder, postSelector );
  10221. }
  10222. return markFunction(function( seed, results, context, xml ) {
  10223. var temp, i, elem,
  10224. preMap = [],
  10225. postMap = [],
  10226. preexisting = results.length,
  10227. // Get initial elements from seed or context
  10228. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10229. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10230. matcherIn = preFilter && ( seed || !selector ) ?
  10231. condense( elems, preMap, preFilter, context, xml ) :
  10232. elems,
  10233. matcherOut = matcher ?
  10234. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10235. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10236. // ...intermediate processing is necessary
  10237. [] :
  10238. // ...otherwise use results directly
  10239. results :
  10240. matcherIn;
  10241. // Find primary matches
  10242. if ( matcher ) {
  10243. matcher( matcherIn, matcherOut, context, xml );
  10244. }
  10245. // Apply postFilter
  10246. if ( postFilter ) {
  10247. temp = condense( matcherOut, postMap );
  10248. postFilter( temp, [], context, xml );
  10249. // Un-match failing elements by moving them back to matcherIn
  10250. i = temp.length;
  10251. while ( i-- ) {
  10252. if ( (elem = temp[i]) ) {
  10253. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10254. }
  10255. }
  10256. }
  10257. if ( seed ) {
  10258. if ( postFinder || preFilter ) {
  10259. if ( postFinder ) {
  10260. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10261. temp = [];
  10262. i = matcherOut.length;
  10263. while ( i-- ) {
  10264. if ( (elem = matcherOut[i]) ) {
  10265. // Restore matcherIn since elem is not yet a final match
  10266. temp.push( (matcherIn[i] = elem) );
  10267. }
  10268. }
  10269. postFinder( null, (matcherOut = []), temp, xml );
  10270. }
  10271. // Move matched elements from seed to results to keep them synchronized
  10272. i = matcherOut.length;
  10273. while ( i-- ) {
  10274. if ( (elem = matcherOut[i]) &&
  10275. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10276. seed[temp] = !(results[temp] = elem);
  10277. }
  10278. }
  10279. }
  10280. // Add elements to results, through postFinder if defined
  10281. } else {
  10282. matcherOut = condense(
  10283. matcherOut === results ?
  10284. matcherOut.splice( preexisting, matcherOut.length ) :
  10285. matcherOut
  10286. );
  10287. if ( postFinder ) {
  10288. postFinder( null, results, matcherOut, xml );
  10289. } else {
  10290. push.apply( results, matcherOut );
  10291. }
  10292. }
  10293. });
  10294. }
  10295. function matcherFromTokens( tokens ) {
  10296. var checkContext, matcher, j,
  10297. len = tokens.length,
  10298. leadingRelative = Expr.relative[ tokens[0].type ],
  10299. implicitRelative = leadingRelative || Expr.relative[" "],
  10300. i = leadingRelative ? 1 : 0,
  10301. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10302. matchContext = addCombinator( function( elem ) {
  10303. return elem === checkContext;
  10304. }, implicitRelative, true ),
  10305. matchAnyContext = addCombinator( function( elem ) {
  10306. return indexOf( checkContext, elem ) > -1;
  10307. }, implicitRelative, true ),
  10308. matchers = [ function( elem, context, xml ) {
  10309. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10310. (checkContext = context).nodeType ?
  10311. matchContext( elem, context, xml ) :
  10312. matchAnyContext( elem, context, xml ) );
  10313. // Avoid hanging onto element (issue #299)
  10314. checkContext = null;
  10315. return ret;
  10316. } ];
  10317. for ( ; i < len; i++ ) {
  10318. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10319. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10320. } else {
  10321. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10322. // Return special upon seeing a positional matcher
  10323. if ( matcher[ expando ] ) {
  10324. // Find the next relative operator (if any) for proper handling
  10325. j = ++i;
  10326. for ( ; j < len; j++ ) {
  10327. if ( Expr.relative[ tokens[j].type ] ) {
  10328. break;
  10329. }
  10330. }
  10331. return setMatcher(
  10332. i > 1 && elementMatcher( matchers ),
  10333. i > 1 && toSelector(
  10334. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10335. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10336. ).replace( rtrim, "$1" ),
  10337. matcher,
  10338. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10339. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10340. j < len && toSelector( tokens )
  10341. );
  10342. }
  10343. matchers.push( matcher );
  10344. }
  10345. }
  10346. return elementMatcher( matchers );
  10347. }
  10348. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10349. var bySet = setMatchers.length > 0,
  10350. byElement = elementMatchers.length > 0,
  10351. superMatcher = function( seed, context, xml, results, outermost ) {
  10352. var elem, j, matcher,
  10353. matchedCount = 0,
  10354. i = "0",
  10355. unmatched = seed && [],
  10356. setMatched = [],
  10357. contextBackup = outermostContext,
  10358. // We must always have either seed elements or outermost context
  10359. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10360. // Use integer dirruns iff this is the outermost matcher
  10361. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10362. len = elems.length;
  10363. if ( outermost ) {
  10364. outermostContext = context === document || context || outermost;
  10365. }
  10366. // Add elements passing elementMatchers directly to results
  10367. // Support: IE<9, Safari
  10368. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10369. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10370. if ( byElement && elem ) {
  10371. j = 0;
  10372. if ( !context && elem.ownerDocument !== document ) {
  10373. setDocument( elem );
  10374. xml = !documentIsHTML;
  10375. }
  10376. while ( (matcher = elementMatchers[j++]) ) {
  10377. if ( matcher( elem, context || document, xml) ) {
  10378. results.push( elem );
  10379. break;
  10380. }
  10381. }
  10382. if ( outermost ) {
  10383. dirruns = dirrunsUnique;
  10384. }
  10385. }
  10386. // Track unmatched elements for set filters
  10387. if ( bySet ) {
  10388. // They will have gone through all possible matchers
  10389. if ( (elem = !matcher && elem) ) {
  10390. matchedCount--;
  10391. }
  10392. // Lengthen the array for every element, matched or not
  10393. if ( seed ) {
  10394. unmatched.push( elem );
  10395. }
  10396. }
  10397. }
  10398. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10399. // makes the latter nonnegative.
  10400. matchedCount += i;
  10401. // Apply set filters to unmatched elements
  10402. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10403. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10404. // no element matchers and no seed.
  10405. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10406. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10407. // numerically zero.
  10408. if ( bySet && i !== matchedCount ) {
  10409. j = 0;
  10410. while ( (matcher = setMatchers[j++]) ) {
  10411. matcher( unmatched, setMatched, context, xml );
  10412. }
  10413. if ( seed ) {
  10414. // Reintegrate element matches to eliminate the need for sorting
  10415. if ( matchedCount > 0 ) {
  10416. while ( i-- ) {
  10417. if ( !(unmatched[i] || setMatched[i]) ) {
  10418. setMatched[i] = pop.call( results );
  10419. }
  10420. }
  10421. }
  10422. // Discard index placeholder values to get only actual matches
  10423. setMatched = condense( setMatched );
  10424. }
  10425. // Add matches to results
  10426. push.apply( results, setMatched );
  10427. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10428. if ( outermost && !seed && setMatched.length > 0 &&
  10429. ( matchedCount + setMatchers.length ) > 1 ) {
  10430. Sizzle.uniqueSort( results );
  10431. }
  10432. }
  10433. // Override manipulation of globals by nested matchers
  10434. if ( outermost ) {
  10435. dirruns = dirrunsUnique;
  10436. outermostContext = contextBackup;
  10437. }
  10438. return unmatched;
  10439. };
  10440. return bySet ?
  10441. markFunction( superMatcher ) :
  10442. superMatcher;
  10443. }
  10444. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10445. var i,
  10446. setMatchers = [],
  10447. elementMatchers = [],
  10448. cached = compilerCache[ selector + " " ];
  10449. if ( !cached ) {
  10450. // Generate a function of recursive functions that can be used to check each element
  10451. if ( !match ) {
  10452. match = tokenize( selector );
  10453. }
  10454. i = match.length;
  10455. while ( i-- ) {
  10456. cached = matcherFromTokens( match[i] );
  10457. if ( cached[ expando ] ) {
  10458. setMatchers.push( cached );
  10459. } else {
  10460. elementMatchers.push( cached );
  10461. }
  10462. }
  10463. // Cache the compiled function
  10464. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10465. // Save selector and tokenization
  10466. cached.selector = selector;
  10467. }
  10468. return cached;
  10469. };
  10470. /**
  10471. * A low-level selection function that works with Sizzle's compiled
  10472. * selector functions
  10473. * @param {String|Function} selector A selector or a pre-compiled
  10474. * selector function built with Sizzle.compile
  10475. * @param {Element} context
  10476. * @param {Array} [results]
  10477. * @param {Array} [seed] A set of elements to match against
  10478. */
  10479. select = Sizzle.select = function( selector, context, results, seed ) {
  10480. var i, tokens, token, type, find,
  10481. compiled = typeof selector === "function" && selector,
  10482. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10483. results = results || [];
  10484. // Try to minimize operations if there is only one selector in the list and no seed
  10485. // (the latter of which guarantees us context)
  10486. if ( match.length === 1 ) {
  10487. // Reduce context if the leading compound selector is an ID
  10488. tokens = match[0] = match[0].slice( 0 );
  10489. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10490. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10491. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10492. if ( !context ) {
  10493. return results;
  10494. // Precompiled matchers will still verify ancestry, so step up a level
  10495. } else if ( compiled ) {
  10496. context = context.parentNode;
  10497. }
  10498. selector = selector.slice( tokens.shift().value.length );
  10499. }
  10500. // Fetch a seed set for right-to-left matching
  10501. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10502. while ( i-- ) {
  10503. token = tokens[i];
  10504. // Abort if we hit a combinator
  10505. if ( Expr.relative[ (type = token.type) ] ) {
  10506. break;
  10507. }
  10508. if ( (find = Expr.find[ type ]) ) {
  10509. // Search, expanding context for leading sibling combinators
  10510. if ( (seed = find(
  10511. token.matches[0].replace( runescape, funescape ),
  10512. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10513. )) ) {
  10514. // If seed is empty or no tokens remain, we can return early
  10515. tokens.splice( i, 1 );
  10516. selector = seed.length && toSelector( tokens );
  10517. if ( !selector ) {
  10518. push.apply( results, seed );
  10519. return results;
  10520. }
  10521. break;
  10522. }
  10523. }
  10524. }
  10525. }
  10526. // Compile and execute a filtering function if one is not provided
  10527. // Provide `match` to avoid retokenization if we modified the selector above
  10528. ( compiled || compile( selector, match ) )(
  10529. seed,
  10530. context,
  10531. !documentIsHTML,
  10532. results,
  10533. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10534. );
  10535. return results;
  10536. };
  10537. // One-time assignments
  10538. // Sort stability
  10539. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10540. // Support: Chrome 14-35+
  10541. // Always assume duplicates if they aren't passed to the comparison function
  10542. support.detectDuplicates = !!hasDuplicate;
  10543. // Initialize against the default document
  10544. setDocument();
  10545. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10546. // Detached nodes confoundingly follow *each other*
  10547. support.sortDetached = assert(function( el ) {
  10548. // Should return 1, but returns 4 (following)
  10549. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10550. });
  10551. // Support: IE<8
  10552. // Prevent attribute/property "interpolation"
  10553. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10554. if ( !assert(function( el ) {
  10555. el.innerHTML = "<a href='#'></a>";
  10556. return el.firstChild.getAttribute("href") === "#" ;
  10557. }) ) {
  10558. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10559. if ( !isXML ) {
  10560. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10561. }
  10562. });
  10563. }
  10564. // Support: IE<9
  10565. // Use defaultValue in place of getAttribute("value")
  10566. if ( !support.attributes || !assert(function( el ) {
  10567. el.innerHTML = "<input/>";
  10568. el.firstChild.setAttribute( "value", "" );
  10569. return el.firstChild.getAttribute( "value" ) === "";
  10570. }) ) {
  10571. addHandle( "value", function( elem, name, isXML ) {
  10572. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10573. return elem.defaultValue;
  10574. }
  10575. });
  10576. }
  10577. // Support: IE<9
  10578. // Use getAttributeNode to fetch booleans when getAttribute lies
  10579. if ( !assert(function( el ) {
  10580. return el.getAttribute("disabled") == null;
  10581. }) ) {
  10582. addHandle( booleans, function( elem, name, isXML ) {
  10583. var val;
  10584. if ( !isXML ) {
  10585. return elem[ name ] === true ? name.toLowerCase() :
  10586. (val = elem.getAttributeNode( name )) && val.specified ?
  10587. val.value :
  10588. null;
  10589. }
  10590. });
  10591. }
  10592. return Sizzle;
  10593. })( window );
  10594. jQuery.find = Sizzle;
  10595. jQuery.expr = Sizzle.selectors;
  10596. // Deprecated
  10597. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10598. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10599. jQuery.text = Sizzle.getText;
  10600. jQuery.isXMLDoc = Sizzle.isXML;
  10601. jQuery.contains = Sizzle.contains;
  10602. jQuery.escapeSelector = Sizzle.escape;
  10603. var dir = function( elem, dir, until ) {
  10604. var matched = [],
  10605. truncate = until !== undefined;
  10606. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10607. if ( elem.nodeType === 1 ) {
  10608. if ( truncate && jQuery( elem ).is( until ) ) {
  10609. break;
  10610. }
  10611. matched.push( elem );
  10612. }
  10613. }
  10614. return matched;
  10615. };
  10616. var siblings = function( n, elem ) {
  10617. var matched = [];
  10618. for ( ; n; n = n.nextSibling ) {
  10619. if ( n.nodeType === 1 && n !== elem ) {
  10620. matched.push( n );
  10621. }
  10622. }
  10623. return matched;
  10624. };
  10625. var rneedsContext = jQuery.expr.match.needsContext;
  10626. function nodeName( elem, name ) {
  10627. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10628. };
  10629. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10630. // Implement the identical functionality for filter and not
  10631. function winnow( elements, qualifier, not ) {
  10632. if ( isFunction( qualifier ) ) {
  10633. return jQuery.grep( elements, function( elem, i ) {
  10634. return !!qualifier.call( elem, i, elem ) !== not;
  10635. } );
  10636. }
  10637. // Single element
  10638. if ( qualifier.nodeType ) {
  10639. return jQuery.grep( elements, function( elem ) {
  10640. return ( elem === qualifier ) !== not;
  10641. } );
  10642. }
  10643. // Arraylike of elements (jQuery, arguments, Array)
  10644. if ( typeof qualifier !== "string" ) {
  10645. return jQuery.grep( elements, function( elem ) {
  10646. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10647. } );
  10648. }
  10649. // Filtered directly for both simple and complex selectors
  10650. return jQuery.filter( qualifier, elements, not );
  10651. }
  10652. jQuery.filter = function( expr, elems, not ) {
  10653. var elem = elems[ 0 ];
  10654. if ( not ) {
  10655. expr = ":not(" + expr + ")";
  10656. }
  10657. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10658. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10659. }
  10660. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10661. return elem.nodeType === 1;
  10662. } ) );
  10663. };
  10664. jQuery.fn.extend( {
  10665. find: function( selector ) {
  10666. var i, ret,
  10667. len = this.length,
  10668. self = this;
  10669. if ( typeof selector !== "string" ) {
  10670. return this.pushStack( jQuery( selector ).filter( function() {
  10671. for ( i = 0; i < len; i++ ) {
  10672. if ( jQuery.contains( self[ i ], this ) ) {
  10673. return true;
  10674. }
  10675. }
  10676. } ) );
  10677. }
  10678. ret = this.pushStack( [] );
  10679. for ( i = 0; i < len; i++ ) {
  10680. jQuery.find( selector, self[ i ], ret );
  10681. }
  10682. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10683. },
  10684. filter: function( selector ) {
  10685. return this.pushStack( winnow( this, selector || [], false ) );
  10686. },
  10687. not: function( selector ) {
  10688. return this.pushStack( winnow( this, selector || [], true ) );
  10689. },
  10690. is: function( selector ) {
  10691. return !!winnow(
  10692. this,
  10693. // If this is a positional/relative selector, check membership in the returned set
  10694. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10695. typeof selector === "string" && rneedsContext.test( selector ) ?
  10696. jQuery( selector ) :
  10697. selector || [],
  10698. false
  10699. ).length;
  10700. }
  10701. } );
  10702. // Initialize a jQuery object
  10703. // A central reference to the root jQuery(document)
  10704. var rootjQuery,
  10705. // A simple way to check for HTML strings
  10706. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10707. // Strict HTML recognition (#11290: must start with <)
  10708. // Shortcut simple #id case for speed
  10709. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10710. init = jQuery.fn.init = function( selector, context, root ) {
  10711. var match, elem;
  10712. // HANDLE: $(""), $(null), $(undefined), $(false)
  10713. if ( !selector ) {
  10714. return this;
  10715. }
  10716. // Method init() accepts an alternate rootjQuery
  10717. // so migrate can support jQuery.sub (gh-2101)
  10718. root = root || rootjQuery;
  10719. // Handle HTML strings
  10720. if ( typeof selector === "string" ) {
  10721. if ( selector[ 0 ] === "<" &&
  10722. selector[ selector.length - 1 ] === ">" &&
  10723. selector.length >= 3 ) {
  10724. // Assume that strings that start and end with <> are HTML and skip the regex check
  10725. match = [ null, selector, null ];
  10726. } else {
  10727. match = rquickExpr.exec( selector );
  10728. }
  10729. // Match html or make sure no context is specified for #id
  10730. if ( match && ( match[ 1 ] || !context ) ) {
  10731. // HANDLE: $(html) -> $(array)
  10732. if ( match[ 1 ] ) {
  10733. context = context instanceof jQuery ? context[ 0 ] : context;
  10734. // Option to run scripts is true for back-compat
  10735. // Intentionally let the error be thrown if parseHTML is not present
  10736. jQuery.merge( this, jQuery.parseHTML(
  10737. match[ 1 ],
  10738. context && context.nodeType ? context.ownerDocument || context : document,
  10739. true
  10740. ) );
  10741. // HANDLE: $(html, props)
  10742. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  10743. for ( match in context ) {
  10744. // Properties of context are called as methods if possible
  10745. if ( isFunction( this[ match ] ) ) {
  10746. this[ match ]( context[ match ] );
  10747. // ...and otherwise set as attributes
  10748. } else {
  10749. this.attr( match, context[ match ] );
  10750. }
  10751. }
  10752. }
  10753. return this;
  10754. // HANDLE: $(#id)
  10755. } else {
  10756. elem = document.getElementById( match[ 2 ] );
  10757. if ( elem ) {
  10758. // Inject the element directly into the jQuery object
  10759. this[ 0 ] = elem;
  10760. this.length = 1;
  10761. }
  10762. return this;
  10763. }
  10764. // HANDLE: $(expr, $(...))
  10765. } else if ( !context || context.jquery ) {
  10766. return ( context || root ).find( selector );
  10767. // HANDLE: $(expr, context)
  10768. // (which is just equivalent to: $(context).find(expr)
  10769. } else {
  10770. return this.constructor( context ).find( selector );
  10771. }
  10772. // HANDLE: $(DOMElement)
  10773. } else if ( selector.nodeType ) {
  10774. this[ 0 ] = selector;
  10775. this.length = 1;
  10776. return this;
  10777. // HANDLE: $(function)
  10778. // Shortcut for document ready
  10779. } else if ( isFunction( selector ) ) {
  10780. return root.ready !== undefined ?
  10781. root.ready( selector ) :
  10782. // Execute immediately if ready is not present
  10783. selector( jQuery );
  10784. }
  10785. return jQuery.makeArray( selector, this );
  10786. };
  10787. // Give the init function the jQuery prototype for later instantiation
  10788. init.prototype = jQuery.fn;
  10789. // Initialize central reference
  10790. rootjQuery = jQuery( document );
  10791. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  10792. // Methods guaranteed to produce a unique set when starting from a unique set
  10793. guaranteedUnique = {
  10794. children: true,
  10795. contents: true,
  10796. next: true,
  10797. prev: true
  10798. };
  10799. jQuery.fn.extend( {
  10800. has: function( target ) {
  10801. var targets = jQuery( target, this ),
  10802. l = targets.length;
  10803. return this.filter( function() {
  10804. var i = 0;
  10805. for ( ; i < l; i++ ) {
  10806. if ( jQuery.contains( this, targets[ i ] ) ) {
  10807. return true;
  10808. }
  10809. }
  10810. } );
  10811. },
  10812. closest: function( selectors, context ) {
  10813. var cur,
  10814. i = 0,
  10815. l = this.length,
  10816. matched = [],
  10817. targets = typeof selectors !== "string" && jQuery( selectors );
  10818. // Positional selectors never match, since there's no _selection_ context
  10819. if ( !rneedsContext.test( selectors ) ) {
  10820. for ( ; i < l; i++ ) {
  10821. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  10822. // Always skip document fragments
  10823. if ( cur.nodeType < 11 && ( targets ?
  10824. targets.index( cur ) > -1 :
  10825. // Don't pass non-elements to Sizzle
  10826. cur.nodeType === 1 &&
  10827. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  10828. matched.push( cur );
  10829. break;
  10830. }
  10831. }
  10832. }
  10833. }
  10834. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  10835. },
  10836. // Determine the position of an element within the set
  10837. index: function( elem ) {
  10838. // No argument, return index in parent
  10839. if ( !elem ) {
  10840. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  10841. }
  10842. // Index in selector
  10843. if ( typeof elem === "string" ) {
  10844. return indexOf.call( jQuery( elem ), this[ 0 ] );
  10845. }
  10846. // Locate the position of the desired element
  10847. return indexOf.call( this,
  10848. // If it receives a jQuery object, the first element is used
  10849. elem.jquery ? elem[ 0 ] : elem
  10850. );
  10851. },
  10852. add: function( selector, context ) {
  10853. return this.pushStack(
  10854. jQuery.uniqueSort(
  10855. jQuery.merge( this.get(), jQuery( selector, context ) )
  10856. )
  10857. );
  10858. },
  10859. addBack: function( selector ) {
  10860. return this.add( selector == null ?
  10861. this.prevObject : this.prevObject.filter( selector )
  10862. );
  10863. }
  10864. } );
  10865. function sibling( cur, dir ) {
  10866. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  10867. return cur;
  10868. }
  10869. jQuery.each( {
  10870. parent: function( elem ) {
  10871. var parent = elem.parentNode;
  10872. return parent && parent.nodeType !== 11 ? parent : null;
  10873. },
  10874. parents: function( elem ) {
  10875. return dir( elem, "parentNode" );
  10876. },
  10877. parentsUntil: function( elem, i, until ) {
  10878. return dir( elem, "parentNode", until );
  10879. },
  10880. next: function( elem ) {
  10881. return sibling( elem, "nextSibling" );
  10882. },
  10883. prev: function( elem ) {
  10884. return sibling( elem, "previousSibling" );
  10885. },
  10886. nextAll: function( elem ) {
  10887. return dir( elem, "nextSibling" );
  10888. },
  10889. prevAll: function( elem ) {
  10890. return dir( elem, "previousSibling" );
  10891. },
  10892. nextUntil: function( elem, i, until ) {
  10893. return dir( elem, "nextSibling", until );
  10894. },
  10895. prevUntil: function( elem, i, until ) {
  10896. return dir( elem, "previousSibling", until );
  10897. },
  10898. siblings: function( elem ) {
  10899. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  10900. },
  10901. children: function( elem ) {
  10902. return siblings( elem.firstChild );
  10903. },
  10904. contents: function( elem ) {
  10905. if ( typeof elem.contentDocument !== "undefined" ) {
  10906. return elem.contentDocument;
  10907. }
  10908. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  10909. // Treat the template element as a regular one in browsers that
  10910. // don't support it.
  10911. if ( nodeName( elem, "template" ) ) {
  10912. elem = elem.content || elem;
  10913. }
  10914. return jQuery.merge( [], elem.childNodes );
  10915. }
  10916. }, function( name, fn ) {
  10917. jQuery.fn[ name ] = function( until, selector ) {
  10918. var matched = jQuery.map( this, fn, until );
  10919. if ( name.slice( -5 ) !== "Until" ) {
  10920. selector = until;
  10921. }
  10922. if ( selector && typeof selector === "string" ) {
  10923. matched = jQuery.filter( selector, matched );
  10924. }
  10925. if ( this.length > 1 ) {
  10926. // Remove duplicates
  10927. if ( !guaranteedUnique[ name ] ) {
  10928. jQuery.uniqueSort( matched );
  10929. }
  10930. // Reverse order for parents* and prev-derivatives
  10931. if ( rparentsprev.test( name ) ) {
  10932. matched.reverse();
  10933. }
  10934. }
  10935. return this.pushStack( matched );
  10936. };
  10937. } );
  10938. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  10939. // Convert String-formatted options into Object-formatted ones
  10940. function createOptions( options ) {
  10941. var object = {};
  10942. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  10943. object[ flag ] = true;
  10944. } );
  10945. return object;
  10946. }
  10947. /*
  10948. * Create a callback list using the following parameters:
  10949. *
  10950. * options: an optional list of space-separated options that will change how
  10951. * the callback list behaves or a more traditional option object
  10952. *
  10953. * By default a callback list will act like an event callback list and can be
  10954. * "fired" multiple times.
  10955. *
  10956. * Possible options:
  10957. *
  10958. * once: will ensure the callback list can only be fired once (like a Deferred)
  10959. *
  10960. * memory: will keep track of previous values and will call any callback added
  10961. * after the list has been fired right away with the latest "memorized"
  10962. * values (like a Deferred)
  10963. *
  10964. * unique: will ensure a callback can only be added once (no duplicate in the list)
  10965. *
  10966. * stopOnFalse: interrupt callings when a callback returns false
  10967. *
  10968. */
  10969. jQuery.Callbacks = function( options ) {
  10970. // Convert options from String-formatted to Object-formatted if needed
  10971. // (we check in cache first)
  10972. options = typeof options === "string" ?
  10973. createOptions( options ) :
  10974. jQuery.extend( {}, options );
  10975. var // Flag to know if list is currently firing
  10976. firing,
  10977. // Last fire value for non-forgettable lists
  10978. memory,
  10979. // Flag to know if list was already fired
  10980. fired,
  10981. // Flag to prevent firing
  10982. locked,
  10983. // Actual callback list
  10984. list = [],
  10985. // Queue of execution data for repeatable lists
  10986. queue = [],
  10987. // Index of currently firing callback (modified by add/remove as needed)
  10988. firingIndex = -1,
  10989. // Fire callbacks
  10990. fire = function() {
  10991. // Enforce single-firing
  10992. locked = locked || options.once;
  10993. // Execute callbacks for all pending executions,
  10994. // respecting firingIndex overrides and runtime changes
  10995. fired = firing = true;
  10996. for ( ; queue.length; firingIndex = -1 ) {
  10997. memory = queue.shift();
  10998. while ( ++firingIndex < list.length ) {
  10999. // Run callback and check for early termination
  11000. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11001. options.stopOnFalse ) {
  11002. // Jump to end and forget the data so .add doesn't re-fire
  11003. firingIndex = list.length;
  11004. memory = false;
  11005. }
  11006. }
  11007. }
  11008. // Forget the data if we're done with it
  11009. if ( !options.memory ) {
  11010. memory = false;
  11011. }
  11012. firing = false;
  11013. // Clean up if we're done firing for good
  11014. if ( locked ) {
  11015. // Keep an empty list if we have data for future add calls
  11016. if ( memory ) {
  11017. list = [];
  11018. // Otherwise, this object is spent
  11019. } else {
  11020. list = "";
  11021. }
  11022. }
  11023. },
  11024. // Actual Callbacks object
  11025. self = {
  11026. // Add a callback or a collection of callbacks to the list
  11027. add: function() {
  11028. if ( list ) {
  11029. // If we have memory from a past run, we should fire after adding
  11030. if ( memory && !firing ) {
  11031. firingIndex = list.length - 1;
  11032. queue.push( memory );
  11033. }
  11034. ( function add( args ) {
  11035. jQuery.each( args, function( _, arg ) {
  11036. if ( isFunction( arg ) ) {
  11037. if ( !options.unique || !self.has( arg ) ) {
  11038. list.push( arg );
  11039. }
  11040. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11041. // Inspect recursively
  11042. add( arg );
  11043. }
  11044. } );
  11045. } )( arguments );
  11046. if ( memory && !firing ) {
  11047. fire();
  11048. }
  11049. }
  11050. return this;
  11051. },
  11052. // Remove a callback from the list
  11053. remove: function() {
  11054. jQuery.each( arguments, function( _, arg ) {
  11055. var index;
  11056. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11057. list.splice( index, 1 );
  11058. // Handle firing indexes
  11059. if ( index <= firingIndex ) {
  11060. firingIndex--;
  11061. }
  11062. }
  11063. } );
  11064. return this;
  11065. },
  11066. // Check if a given callback is in the list.
  11067. // If no argument is given, return whether or not list has callbacks attached.
  11068. has: function( fn ) {
  11069. return fn ?
  11070. jQuery.inArray( fn, list ) > -1 :
  11071. list.length > 0;
  11072. },
  11073. // Remove all callbacks from the list
  11074. empty: function() {
  11075. if ( list ) {
  11076. list = [];
  11077. }
  11078. return this;
  11079. },
  11080. // Disable .fire and .add
  11081. // Abort any current/pending executions
  11082. // Clear all callbacks and values
  11083. disable: function() {
  11084. locked = queue = [];
  11085. list = memory = "";
  11086. return this;
  11087. },
  11088. disabled: function() {
  11089. return !list;
  11090. },
  11091. // Disable .fire
  11092. // Also disable .add unless we have memory (since it would have no effect)
  11093. // Abort any pending executions
  11094. lock: function() {
  11095. locked = queue = [];
  11096. if ( !memory && !firing ) {
  11097. list = memory = "";
  11098. }
  11099. return this;
  11100. },
  11101. locked: function() {
  11102. return !!locked;
  11103. },
  11104. // Call all callbacks with the given context and arguments
  11105. fireWith: function( context, args ) {
  11106. if ( !locked ) {
  11107. args = args || [];
  11108. args = [ context, args.slice ? args.slice() : args ];
  11109. queue.push( args );
  11110. if ( !firing ) {
  11111. fire();
  11112. }
  11113. }
  11114. return this;
  11115. },
  11116. // Call all the callbacks with the given arguments
  11117. fire: function() {
  11118. self.fireWith( this, arguments );
  11119. return this;
  11120. },
  11121. // To know if the callbacks have already been called at least once
  11122. fired: function() {
  11123. return !!fired;
  11124. }
  11125. };
  11126. return self;
  11127. };
  11128. function Identity( v ) {
  11129. return v;
  11130. }
  11131. function Thrower( ex ) {
  11132. throw ex;
  11133. }
  11134. function adoptValue( value, resolve, reject, noValue ) {
  11135. var method;
  11136. try {
  11137. // Check for promise aspect first to privilege synchronous behavior
  11138. if ( value && isFunction( ( method = value.promise ) ) ) {
  11139. method.call( value ).done( resolve ).fail( reject );
  11140. // Other thenables
  11141. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11142. method.call( value, resolve, reject );
  11143. // Other non-thenables
  11144. } else {
  11145. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11146. // * false: [ value ].slice( 0 ) => resolve( value )
  11147. // * true: [ value ].slice( 1 ) => resolve()
  11148. resolve.apply( undefined, [ value ].slice( noValue ) );
  11149. }
  11150. // For Promises/A+, convert exceptions into rejections
  11151. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11152. // Deferred#then to conditionally suppress rejection.
  11153. } catch ( value ) {
  11154. // Support: Android 4.0 only
  11155. // Strict mode functions invoked without .call/.apply get global-object context
  11156. reject.apply( undefined, [ value ] );
  11157. }
  11158. }
  11159. jQuery.extend( {
  11160. Deferred: function( func ) {
  11161. var tuples = [
  11162. // action, add listener, callbacks,
  11163. // ... .then handlers, argument index, [final state]
  11164. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11165. jQuery.Callbacks( "memory" ), 2 ],
  11166. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11167. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11168. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11169. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11170. ],
  11171. state = "pending",
  11172. promise = {
  11173. state: function() {
  11174. return state;
  11175. },
  11176. always: function() {
  11177. deferred.done( arguments ).fail( arguments );
  11178. return this;
  11179. },
  11180. "catch": function( fn ) {
  11181. return promise.then( null, fn );
  11182. },
  11183. // Keep pipe for back-compat
  11184. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11185. var fns = arguments;
  11186. return jQuery.Deferred( function( newDefer ) {
  11187. jQuery.each( tuples, function( i, tuple ) {
  11188. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11189. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11190. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11191. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11192. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11193. deferred[ tuple[ 1 ] ]( function() {
  11194. var returned = fn && fn.apply( this, arguments );
  11195. if ( returned && isFunction( returned.promise ) ) {
  11196. returned.promise()
  11197. .progress( newDefer.notify )
  11198. .done( newDefer.resolve )
  11199. .fail( newDefer.reject );
  11200. } else {
  11201. newDefer[ tuple[ 0 ] + "With" ](
  11202. this,
  11203. fn ? [ returned ] : arguments
  11204. );
  11205. }
  11206. } );
  11207. } );
  11208. fns = null;
  11209. } ).promise();
  11210. },
  11211. then: function( onFulfilled, onRejected, onProgress ) {
  11212. var maxDepth = 0;
  11213. function resolve( depth, deferred, handler, special ) {
  11214. return function() {
  11215. var that = this,
  11216. args = arguments,
  11217. mightThrow = function() {
  11218. var returned, then;
  11219. // Support: Promises/A+ section 2.3.3.3.3
  11220. // https://promisesaplus.com/#point-59
  11221. // Ignore double-resolution attempts
  11222. if ( depth < maxDepth ) {
  11223. return;
  11224. }
  11225. returned = handler.apply( that, args );
  11226. // Support: Promises/A+ section 2.3.1
  11227. // https://promisesaplus.com/#point-48
  11228. if ( returned === deferred.promise() ) {
  11229. throw new TypeError( "Thenable self-resolution" );
  11230. }
  11231. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11232. // https://promisesaplus.com/#point-54
  11233. // https://promisesaplus.com/#point-75
  11234. // Retrieve `then` only once
  11235. then = returned &&
  11236. // Support: Promises/A+ section 2.3.4
  11237. // https://promisesaplus.com/#point-64
  11238. // Only check objects and functions for thenability
  11239. ( typeof returned === "object" ||
  11240. typeof returned === "function" ) &&
  11241. returned.then;
  11242. // Handle a returned thenable
  11243. if ( isFunction( then ) ) {
  11244. // Special processors (notify) just wait for resolution
  11245. if ( special ) {
  11246. then.call(
  11247. returned,
  11248. resolve( maxDepth, deferred, Identity, special ),
  11249. resolve( maxDepth, deferred, Thrower, special )
  11250. );
  11251. // Normal processors (resolve) also hook into progress
  11252. } else {
  11253. // ...and disregard older resolution values
  11254. maxDepth++;
  11255. then.call(
  11256. returned,
  11257. resolve( maxDepth, deferred, Identity, special ),
  11258. resolve( maxDepth, deferred, Thrower, special ),
  11259. resolve( maxDepth, deferred, Identity,
  11260. deferred.notifyWith )
  11261. );
  11262. }
  11263. // Handle all other returned values
  11264. } else {
  11265. // Only substitute handlers pass on context
  11266. // and multiple values (non-spec behavior)
  11267. if ( handler !== Identity ) {
  11268. that = undefined;
  11269. args = [ returned ];
  11270. }
  11271. // Process the value(s)
  11272. // Default process is resolve
  11273. ( special || deferred.resolveWith )( that, args );
  11274. }
  11275. },
  11276. // Only normal processors (resolve) catch and reject exceptions
  11277. process = special ?
  11278. mightThrow :
  11279. function() {
  11280. try {
  11281. mightThrow();
  11282. } catch ( e ) {
  11283. if ( jQuery.Deferred.exceptionHook ) {
  11284. jQuery.Deferred.exceptionHook( e,
  11285. process.stackTrace );
  11286. }
  11287. // Support: Promises/A+ section 2.3.3.3.4.1
  11288. // https://promisesaplus.com/#point-61
  11289. // Ignore post-resolution exceptions
  11290. if ( depth + 1 >= maxDepth ) {
  11291. // Only substitute handlers pass on context
  11292. // and multiple values (non-spec behavior)
  11293. if ( handler !== Thrower ) {
  11294. that = undefined;
  11295. args = [ e ];
  11296. }
  11297. deferred.rejectWith( that, args );
  11298. }
  11299. }
  11300. };
  11301. // Support: Promises/A+ section 2.3.3.3.1
  11302. // https://promisesaplus.com/#point-57
  11303. // Re-resolve promises immediately to dodge false rejection from
  11304. // subsequent errors
  11305. if ( depth ) {
  11306. process();
  11307. } else {
  11308. // Call an optional hook to record the stack, in case of exception
  11309. // since it's otherwise lost when execution goes async
  11310. if ( jQuery.Deferred.getStackHook ) {
  11311. process.stackTrace = jQuery.Deferred.getStackHook();
  11312. }
  11313. window.setTimeout( process );
  11314. }
  11315. };
  11316. }
  11317. return jQuery.Deferred( function( newDefer ) {
  11318. // progress_handlers.add( ... )
  11319. tuples[ 0 ][ 3 ].add(
  11320. resolve(
  11321. 0,
  11322. newDefer,
  11323. isFunction( onProgress ) ?
  11324. onProgress :
  11325. Identity,
  11326. newDefer.notifyWith
  11327. )
  11328. );
  11329. // fulfilled_handlers.add( ... )
  11330. tuples[ 1 ][ 3 ].add(
  11331. resolve(
  11332. 0,
  11333. newDefer,
  11334. isFunction( onFulfilled ) ?
  11335. onFulfilled :
  11336. Identity
  11337. )
  11338. );
  11339. // rejected_handlers.add( ... )
  11340. tuples[ 2 ][ 3 ].add(
  11341. resolve(
  11342. 0,
  11343. newDefer,
  11344. isFunction( onRejected ) ?
  11345. onRejected :
  11346. Thrower
  11347. )
  11348. );
  11349. } ).promise();
  11350. },
  11351. // Get a promise for this deferred
  11352. // If obj is provided, the promise aspect is added to the object
  11353. promise: function( obj ) {
  11354. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11355. }
  11356. },
  11357. deferred = {};
  11358. // Add list-specific methods
  11359. jQuery.each( tuples, function( i, tuple ) {
  11360. var list = tuple[ 2 ],
  11361. stateString = tuple[ 5 ];
  11362. // promise.progress = list.add
  11363. // promise.done = list.add
  11364. // promise.fail = list.add
  11365. promise[ tuple[ 1 ] ] = list.add;
  11366. // Handle state
  11367. if ( stateString ) {
  11368. list.add(
  11369. function() {
  11370. // state = "resolved" (i.e., fulfilled)
  11371. // state = "rejected"
  11372. state = stateString;
  11373. },
  11374. // rejected_callbacks.disable
  11375. // fulfilled_callbacks.disable
  11376. tuples[ 3 - i ][ 2 ].disable,
  11377. // rejected_handlers.disable
  11378. // fulfilled_handlers.disable
  11379. tuples[ 3 - i ][ 3 ].disable,
  11380. // progress_callbacks.lock
  11381. tuples[ 0 ][ 2 ].lock,
  11382. // progress_handlers.lock
  11383. tuples[ 0 ][ 3 ].lock
  11384. );
  11385. }
  11386. // progress_handlers.fire
  11387. // fulfilled_handlers.fire
  11388. // rejected_handlers.fire
  11389. list.add( tuple[ 3 ].fire );
  11390. // deferred.notify = function() { deferred.notifyWith(...) }
  11391. // deferred.resolve = function() { deferred.resolveWith(...) }
  11392. // deferred.reject = function() { deferred.rejectWith(...) }
  11393. deferred[ tuple[ 0 ] ] = function() {
  11394. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11395. return this;
  11396. };
  11397. // deferred.notifyWith = list.fireWith
  11398. // deferred.resolveWith = list.fireWith
  11399. // deferred.rejectWith = list.fireWith
  11400. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11401. } );
  11402. // Make the deferred a promise
  11403. promise.promise( deferred );
  11404. // Call given func if any
  11405. if ( func ) {
  11406. func.call( deferred, deferred );
  11407. }
  11408. // All done!
  11409. return deferred;
  11410. },
  11411. // Deferred helper
  11412. when: function( singleValue ) {
  11413. var
  11414. // count of uncompleted subordinates
  11415. remaining = arguments.length,
  11416. // count of unprocessed arguments
  11417. i = remaining,
  11418. // subordinate fulfillment data
  11419. resolveContexts = Array( i ),
  11420. resolveValues = slice.call( arguments ),
  11421. // the master Deferred
  11422. master = jQuery.Deferred(),
  11423. // subordinate callback factory
  11424. updateFunc = function( i ) {
  11425. return function( value ) {
  11426. resolveContexts[ i ] = this;
  11427. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11428. if ( !( --remaining ) ) {
  11429. master.resolveWith( resolveContexts, resolveValues );
  11430. }
  11431. };
  11432. };
  11433. // Single- and empty arguments are adopted like Promise.resolve
  11434. if ( remaining <= 1 ) {
  11435. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11436. !remaining );
  11437. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11438. if ( master.state() === "pending" ||
  11439. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11440. return master.then();
  11441. }
  11442. }
  11443. // Multiple arguments are aggregated like Promise.all array elements
  11444. while ( i-- ) {
  11445. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11446. }
  11447. return master.promise();
  11448. }
  11449. } );
  11450. // These usually indicate a programmer mistake during development,
  11451. // warn about them ASAP rather than swallowing them by default.
  11452. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11453. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11454. // Support: IE 8 - 9 only
  11455. // Console exists when dev tools are open, which can happen at any time
  11456. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11457. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11458. }
  11459. };
  11460. jQuery.readyException = function( error ) {
  11461. window.setTimeout( function() {
  11462. throw error;
  11463. } );
  11464. };
  11465. // The deferred used on DOM ready
  11466. var readyList = jQuery.Deferred();
  11467. jQuery.fn.ready = function( fn ) {
  11468. readyList
  11469. .then( fn )
  11470. // Wrap jQuery.readyException in a function so that the lookup
  11471. // happens at the time of error handling instead of callback
  11472. // registration.
  11473. .catch( function( error ) {
  11474. jQuery.readyException( error );
  11475. } );
  11476. return this;
  11477. };
  11478. jQuery.extend( {
  11479. // Is the DOM ready to be used? Set to true once it occurs.
  11480. isReady: false,
  11481. // A counter to track how many items to wait for before
  11482. // the ready event fires. See #6781
  11483. readyWait: 1,
  11484. // Handle when the DOM is ready
  11485. ready: function( wait ) {
  11486. // Abort if there are pending holds or we're already ready
  11487. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11488. return;
  11489. }
  11490. // Remember that the DOM is ready
  11491. jQuery.isReady = true;
  11492. // If a normal DOM Ready event fired, decrement, and wait if need be
  11493. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11494. return;
  11495. }
  11496. // If there are functions bound, to execute
  11497. readyList.resolveWith( document, [ jQuery ] );
  11498. }
  11499. } );
  11500. jQuery.ready.then = readyList.then;
  11501. // The ready event handler and self cleanup method
  11502. function completed() {
  11503. document.removeEventListener( "DOMContentLoaded", completed );
  11504. window.removeEventListener( "load", completed );
  11505. jQuery.ready();
  11506. }
  11507. // Catch cases where $(document).ready() is called
  11508. // after the browser event has already occurred.
  11509. // Support: IE <=9 - 10 only
  11510. // Older IE sometimes signals "interactive" too soon
  11511. if ( document.readyState === "complete" ||
  11512. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11513. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11514. window.setTimeout( jQuery.ready );
  11515. } else {
  11516. // Use the handy event callback
  11517. document.addEventListener( "DOMContentLoaded", completed );
  11518. // A fallback to window.onload, that will always work
  11519. window.addEventListener( "load", completed );
  11520. }
  11521. // Multifunctional method to get and set values of a collection
  11522. // The value/s can optionally be executed if it's a function
  11523. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11524. var i = 0,
  11525. len = elems.length,
  11526. bulk = key == null;
  11527. // Sets many values
  11528. if ( toType( key ) === "object" ) {
  11529. chainable = true;
  11530. for ( i in key ) {
  11531. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11532. }
  11533. // Sets one value
  11534. } else if ( value !== undefined ) {
  11535. chainable = true;
  11536. if ( !isFunction( value ) ) {
  11537. raw = true;
  11538. }
  11539. if ( bulk ) {
  11540. // Bulk operations run against the entire set
  11541. if ( raw ) {
  11542. fn.call( elems, value );
  11543. fn = null;
  11544. // ...except when executing function values
  11545. } else {
  11546. bulk = fn;
  11547. fn = function( elem, key, value ) {
  11548. return bulk.call( jQuery( elem ), value );
  11549. };
  11550. }
  11551. }
  11552. if ( fn ) {
  11553. for ( ; i < len; i++ ) {
  11554. fn(
  11555. elems[ i ], key, raw ?
  11556. value :
  11557. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11558. );
  11559. }
  11560. }
  11561. }
  11562. if ( chainable ) {
  11563. return elems;
  11564. }
  11565. // Gets
  11566. if ( bulk ) {
  11567. return fn.call( elems );
  11568. }
  11569. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11570. };
  11571. // Matches dashed string for camelizing
  11572. var rmsPrefix = /^-ms-/,
  11573. rdashAlpha = /-([a-z])/g;
  11574. // Used by camelCase as callback to replace()
  11575. function fcamelCase( all, letter ) {
  11576. return letter.toUpperCase();
  11577. }
  11578. // Convert dashed to camelCase; used by the css and data modules
  11579. // Support: IE <=9 - 11, Edge 12 - 15
  11580. // Microsoft forgot to hump their vendor prefix (#9572)
  11581. function camelCase( string ) {
  11582. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11583. }
  11584. var acceptData = function( owner ) {
  11585. // Accepts only:
  11586. // - Node
  11587. // - Node.ELEMENT_NODE
  11588. // - Node.DOCUMENT_NODE
  11589. // - Object
  11590. // - Any
  11591. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11592. };
  11593. function Data() {
  11594. this.expando = jQuery.expando + Data.uid++;
  11595. }
  11596. Data.uid = 1;
  11597. Data.prototype = {
  11598. cache: function( owner ) {
  11599. // Check if the owner object already has a cache
  11600. var value = owner[ this.expando ];
  11601. // If not, create one
  11602. if ( !value ) {
  11603. value = {};
  11604. // We can accept data for non-element nodes in modern browsers,
  11605. // but we should not, see #8335.
  11606. // Always return an empty object.
  11607. if ( acceptData( owner ) ) {
  11608. // If it is a node unlikely to be stringify-ed or looped over
  11609. // use plain assignment
  11610. if ( owner.nodeType ) {
  11611. owner[ this.expando ] = value;
  11612. // Otherwise secure it in a non-enumerable property
  11613. // configurable must be true to allow the property to be
  11614. // deleted when data is removed
  11615. } else {
  11616. Object.defineProperty( owner, this.expando, {
  11617. value: value,
  11618. configurable: true
  11619. } );
  11620. }
  11621. }
  11622. }
  11623. return value;
  11624. },
  11625. set: function( owner, data, value ) {
  11626. var prop,
  11627. cache = this.cache( owner );
  11628. // Handle: [ owner, key, value ] args
  11629. // Always use camelCase key (gh-2257)
  11630. if ( typeof data === "string" ) {
  11631. cache[ camelCase( data ) ] = value;
  11632. // Handle: [ owner, { properties } ] args
  11633. } else {
  11634. // Copy the properties one-by-one to the cache object
  11635. for ( prop in data ) {
  11636. cache[ camelCase( prop ) ] = data[ prop ];
  11637. }
  11638. }
  11639. return cache;
  11640. },
  11641. get: function( owner, key ) {
  11642. return key === undefined ?
  11643. this.cache( owner ) :
  11644. // Always use camelCase key (gh-2257)
  11645. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11646. },
  11647. access: function( owner, key, value ) {
  11648. // In cases where either:
  11649. //
  11650. // 1. No key was specified
  11651. // 2. A string key was specified, but no value provided
  11652. //
  11653. // Take the "read" path and allow the get method to determine
  11654. // which value to return, respectively either:
  11655. //
  11656. // 1. The entire cache object
  11657. // 2. The data stored at the key
  11658. //
  11659. if ( key === undefined ||
  11660. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11661. return this.get( owner, key );
  11662. }
  11663. // When the key is not a string, or both a key and value
  11664. // are specified, set or extend (existing objects) with either:
  11665. //
  11666. // 1. An object of properties
  11667. // 2. A key and value
  11668. //
  11669. this.set( owner, key, value );
  11670. // Since the "set" path can have two possible entry points
  11671. // return the expected data based on which path was taken[*]
  11672. return value !== undefined ? value : key;
  11673. },
  11674. remove: function( owner, key ) {
  11675. var i,
  11676. cache = owner[ this.expando ];
  11677. if ( cache === undefined ) {
  11678. return;
  11679. }
  11680. if ( key !== undefined ) {
  11681. // Support array or space separated string of keys
  11682. if ( Array.isArray( key ) ) {
  11683. // If key is an array of keys...
  11684. // We always set camelCase keys, so remove that.
  11685. key = key.map( camelCase );
  11686. } else {
  11687. key = camelCase( key );
  11688. // If a key with the spaces exists, use it.
  11689. // Otherwise, create an array by matching non-whitespace
  11690. key = key in cache ?
  11691. [ key ] :
  11692. ( key.match( rnothtmlwhite ) || [] );
  11693. }
  11694. i = key.length;
  11695. while ( i-- ) {
  11696. delete cache[ key[ i ] ];
  11697. }
  11698. }
  11699. // Remove the expando if there's no more data
  11700. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11701. // Support: Chrome <=35 - 45
  11702. // Webkit & Blink performance suffers when deleting properties
  11703. // from DOM nodes, so set to undefined instead
  11704. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11705. if ( owner.nodeType ) {
  11706. owner[ this.expando ] = undefined;
  11707. } else {
  11708. delete owner[ this.expando ];
  11709. }
  11710. }
  11711. },
  11712. hasData: function( owner ) {
  11713. var cache = owner[ this.expando ];
  11714. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11715. }
  11716. };
  11717. var dataPriv = new Data();
  11718. var dataUser = new Data();
  11719. // Implementation Summary
  11720. //
  11721. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11722. // 2. Improve the module's maintainability by reducing the storage
  11723. // paths to a single mechanism.
  11724. // 3. Use the same single mechanism to support "private" and "user" data.
  11725. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11726. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11727. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11728. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11729. rmultiDash = /[A-Z]/g;
  11730. function getData( data ) {
  11731. if ( data === "true" ) {
  11732. return true;
  11733. }
  11734. if ( data === "false" ) {
  11735. return false;
  11736. }
  11737. if ( data === "null" ) {
  11738. return null;
  11739. }
  11740. // Only convert to a number if it doesn't change the string
  11741. if ( data === +data + "" ) {
  11742. return +data;
  11743. }
  11744. if ( rbrace.test( data ) ) {
  11745. return JSON.parse( data );
  11746. }
  11747. return data;
  11748. }
  11749. function dataAttr( elem, key, data ) {
  11750. var name;
  11751. // If nothing was found internally, try to fetch any
  11752. // data from the HTML5 data-* attribute
  11753. if ( data === undefined && elem.nodeType === 1 ) {
  11754. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  11755. data = elem.getAttribute( name );
  11756. if ( typeof data === "string" ) {
  11757. try {
  11758. data = getData( data );
  11759. } catch ( e ) {}
  11760. // Make sure we set the data so it isn't changed later
  11761. dataUser.set( elem, key, data );
  11762. } else {
  11763. data = undefined;
  11764. }
  11765. }
  11766. return data;
  11767. }
  11768. jQuery.extend( {
  11769. hasData: function( elem ) {
  11770. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  11771. },
  11772. data: function( elem, name, data ) {
  11773. return dataUser.access( elem, name, data );
  11774. },
  11775. removeData: function( elem, name ) {
  11776. dataUser.remove( elem, name );
  11777. },
  11778. // TODO: Now that all calls to _data and _removeData have been replaced
  11779. // with direct calls to dataPriv methods, these can be deprecated.
  11780. _data: function( elem, name, data ) {
  11781. return dataPriv.access( elem, name, data );
  11782. },
  11783. _removeData: function( elem, name ) {
  11784. dataPriv.remove( elem, name );
  11785. }
  11786. } );
  11787. jQuery.fn.extend( {
  11788. data: function( key, value ) {
  11789. var i, name, data,
  11790. elem = this[ 0 ],
  11791. attrs = elem && elem.attributes;
  11792. // Gets all values
  11793. if ( key === undefined ) {
  11794. if ( this.length ) {
  11795. data = dataUser.get( elem );
  11796. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  11797. i = attrs.length;
  11798. while ( i-- ) {
  11799. // Support: IE 11 only
  11800. // The attrs elements can be null (#14894)
  11801. if ( attrs[ i ] ) {
  11802. name = attrs[ i ].name;
  11803. if ( name.indexOf( "data-" ) === 0 ) {
  11804. name = camelCase( name.slice( 5 ) );
  11805. dataAttr( elem, name, data[ name ] );
  11806. }
  11807. }
  11808. }
  11809. dataPriv.set( elem, "hasDataAttrs", true );
  11810. }
  11811. }
  11812. return data;
  11813. }
  11814. // Sets multiple values
  11815. if ( typeof key === "object" ) {
  11816. return this.each( function() {
  11817. dataUser.set( this, key );
  11818. } );
  11819. }
  11820. return access( this, function( value ) {
  11821. var data;
  11822. // The calling jQuery object (element matches) is not empty
  11823. // (and therefore has an element appears at this[ 0 ]) and the
  11824. // `value` parameter was not undefined. An empty jQuery object
  11825. // will result in `undefined` for elem = this[ 0 ] which will
  11826. // throw an exception if an attempt to read a data cache is made.
  11827. if ( elem && value === undefined ) {
  11828. // Attempt to get data from the cache
  11829. // The key will always be camelCased in Data
  11830. data = dataUser.get( elem, key );
  11831. if ( data !== undefined ) {
  11832. return data;
  11833. }
  11834. // Attempt to "discover" the data in
  11835. // HTML5 custom data-* attrs
  11836. data = dataAttr( elem, key );
  11837. if ( data !== undefined ) {
  11838. return data;
  11839. }
  11840. // We tried really hard, but the data doesn't exist.
  11841. return;
  11842. }
  11843. // Set the data...
  11844. this.each( function() {
  11845. // We always store the camelCased key
  11846. dataUser.set( this, key, value );
  11847. } );
  11848. }, null, value, arguments.length > 1, null, true );
  11849. },
  11850. removeData: function( key ) {
  11851. return this.each( function() {
  11852. dataUser.remove( this, key );
  11853. } );
  11854. }
  11855. } );
  11856. jQuery.extend( {
  11857. queue: function( elem, type, data ) {
  11858. var queue;
  11859. if ( elem ) {
  11860. type = ( type || "fx" ) + "queue";
  11861. queue = dataPriv.get( elem, type );
  11862. // Speed up dequeue by getting out quickly if this is just a lookup
  11863. if ( data ) {
  11864. if ( !queue || Array.isArray( data ) ) {
  11865. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  11866. } else {
  11867. queue.push( data );
  11868. }
  11869. }
  11870. return queue || [];
  11871. }
  11872. },
  11873. dequeue: function( elem, type ) {
  11874. type = type || "fx";
  11875. var queue = jQuery.queue( elem, type ),
  11876. startLength = queue.length,
  11877. fn = queue.shift(),
  11878. hooks = jQuery._queueHooks( elem, type ),
  11879. next = function() {
  11880. jQuery.dequeue( elem, type );
  11881. };
  11882. // If the fx queue is dequeued, always remove the progress sentinel
  11883. if ( fn === "inprogress" ) {
  11884. fn = queue.shift();
  11885. startLength--;
  11886. }
  11887. if ( fn ) {
  11888. // Add a progress sentinel to prevent the fx queue from being
  11889. // automatically dequeued
  11890. if ( type === "fx" ) {
  11891. queue.unshift( "inprogress" );
  11892. }
  11893. // Clear up the last queue stop function
  11894. delete hooks.stop;
  11895. fn.call( elem, next, hooks );
  11896. }
  11897. if ( !startLength && hooks ) {
  11898. hooks.empty.fire();
  11899. }
  11900. },
  11901. // Not public - generate a queueHooks object, or return the current one
  11902. _queueHooks: function( elem, type ) {
  11903. var key = type + "queueHooks";
  11904. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  11905. empty: jQuery.Callbacks( "once memory" ).add( function() {
  11906. dataPriv.remove( elem, [ type + "queue", key ] );
  11907. } )
  11908. } );
  11909. }
  11910. } );
  11911. jQuery.fn.extend( {
  11912. queue: function( type, data ) {
  11913. var setter = 2;
  11914. if ( typeof type !== "string" ) {
  11915. data = type;
  11916. type = "fx";
  11917. setter--;
  11918. }
  11919. if ( arguments.length < setter ) {
  11920. return jQuery.queue( this[ 0 ], type );
  11921. }
  11922. return data === undefined ?
  11923. this :
  11924. this.each( function() {
  11925. var queue = jQuery.queue( this, type, data );
  11926. // Ensure a hooks for this queue
  11927. jQuery._queueHooks( this, type );
  11928. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  11929. jQuery.dequeue( this, type );
  11930. }
  11931. } );
  11932. },
  11933. dequeue: function( type ) {
  11934. return this.each( function() {
  11935. jQuery.dequeue( this, type );
  11936. } );
  11937. },
  11938. clearQueue: function( type ) {
  11939. return this.queue( type || "fx", [] );
  11940. },
  11941. // Get a promise resolved when queues of a certain type
  11942. // are emptied (fx is the type by default)
  11943. promise: function( type, obj ) {
  11944. var tmp,
  11945. count = 1,
  11946. defer = jQuery.Deferred(),
  11947. elements = this,
  11948. i = this.length,
  11949. resolve = function() {
  11950. if ( !( --count ) ) {
  11951. defer.resolveWith( elements, [ elements ] );
  11952. }
  11953. };
  11954. if ( typeof type !== "string" ) {
  11955. obj = type;
  11956. type = undefined;
  11957. }
  11958. type = type || "fx";
  11959. while ( i-- ) {
  11960. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  11961. if ( tmp && tmp.empty ) {
  11962. count++;
  11963. tmp.empty.add( resolve );
  11964. }
  11965. }
  11966. resolve();
  11967. return defer.promise( obj );
  11968. }
  11969. } );
  11970. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  11971. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  11972. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  11973. var documentElement = document.documentElement;
  11974. var isAttached = function( elem ) {
  11975. return jQuery.contains( elem.ownerDocument, elem );
  11976. },
  11977. composed = { composed: true };
  11978. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  11979. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  11980. // Support: iOS 10.0-10.2 only
  11981. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  11982. // leading to errors. We need to check for `getRootNode`.
  11983. if ( documentElement.getRootNode ) {
  11984. isAttached = function( elem ) {
  11985. return jQuery.contains( elem.ownerDocument, elem ) ||
  11986. elem.getRootNode( composed ) === elem.ownerDocument;
  11987. };
  11988. }
  11989. var isHiddenWithinTree = function( elem, el ) {
  11990. // isHiddenWithinTree might be called from jQuery#filter function;
  11991. // in that case, element will be second argument
  11992. elem = el || elem;
  11993. // Inline style trumps all
  11994. return elem.style.display === "none" ||
  11995. elem.style.display === "" &&
  11996. // Otherwise, check computed style
  11997. // Support: Firefox <=43 - 45
  11998. // Disconnected elements can have computed display: none, so first confirm that elem is
  11999. // in the document.
  12000. isAttached( elem ) &&
  12001. jQuery.css( elem, "display" ) === "none";
  12002. };
  12003. var swap = function( elem, options, callback, args ) {
  12004. var ret, name,
  12005. old = {};
  12006. // Remember the old values, and insert the new ones
  12007. for ( name in options ) {
  12008. old[ name ] = elem.style[ name ];
  12009. elem.style[ name ] = options[ name ];
  12010. }
  12011. ret = callback.apply( elem, args || [] );
  12012. // Revert the old values
  12013. for ( name in options ) {
  12014. elem.style[ name ] = old[ name ];
  12015. }
  12016. return ret;
  12017. };
  12018. function adjustCSS( elem, prop, valueParts, tween ) {
  12019. var adjusted, scale,
  12020. maxIterations = 20,
  12021. currentValue = tween ?
  12022. function() {
  12023. return tween.cur();
  12024. } :
  12025. function() {
  12026. return jQuery.css( elem, prop, "" );
  12027. },
  12028. initial = currentValue(),
  12029. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12030. // Starting value computation is required for potential unit mismatches
  12031. initialInUnit = elem.nodeType &&
  12032. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12033. rcssNum.exec( jQuery.css( elem, prop ) );
  12034. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12035. // Support: Firefox <=54
  12036. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12037. initial = initial / 2;
  12038. // Trust units reported by jQuery.css
  12039. unit = unit || initialInUnit[ 3 ];
  12040. // Iteratively approximate from a nonzero starting point
  12041. initialInUnit = +initial || 1;
  12042. while ( maxIterations-- ) {
  12043. // Evaluate and update our best guess (doubling guesses that zero out).
  12044. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12045. jQuery.style( elem, prop, initialInUnit + unit );
  12046. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12047. maxIterations = 0;
  12048. }
  12049. initialInUnit = initialInUnit / scale;
  12050. }
  12051. initialInUnit = initialInUnit * 2;
  12052. jQuery.style( elem, prop, initialInUnit + unit );
  12053. // Make sure we update the tween properties later on
  12054. valueParts = valueParts || [];
  12055. }
  12056. if ( valueParts ) {
  12057. initialInUnit = +initialInUnit || +initial || 0;
  12058. // Apply relative offset (+=/-=) if specified
  12059. adjusted = valueParts[ 1 ] ?
  12060. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12061. +valueParts[ 2 ];
  12062. if ( tween ) {
  12063. tween.unit = unit;
  12064. tween.start = initialInUnit;
  12065. tween.end = adjusted;
  12066. }
  12067. }
  12068. return adjusted;
  12069. }
  12070. var defaultDisplayMap = {};
  12071. function getDefaultDisplay( elem ) {
  12072. var temp,
  12073. doc = elem.ownerDocument,
  12074. nodeName = elem.nodeName,
  12075. display = defaultDisplayMap[ nodeName ];
  12076. if ( display ) {
  12077. return display;
  12078. }
  12079. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12080. display = jQuery.css( temp, "display" );
  12081. temp.parentNode.removeChild( temp );
  12082. if ( display === "none" ) {
  12083. display = "block";
  12084. }
  12085. defaultDisplayMap[ nodeName ] = display;
  12086. return display;
  12087. }
  12088. function showHide( elements, show ) {
  12089. var display, elem,
  12090. values = [],
  12091. index = 0,
  12092. length = elements.length;
  12093. // Determine new display value for elements that need to change
  12094. for ( ; index < length; index++ ) {
  12095. elem = elements[ index ];
  12096. if ( !elem.style ) {
  12097. continue;
  12098. }
  12099. display = elem.style.display;
  12100. if ( show ) {
  12101. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12102. // check is required in this first loop unless we have a nonempty display value (either
  12103. // inline or about-to-be-restored)
  12104. if ( display === "none" ) {
  12105. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12106. if ( !values[ index ] ) {
  12107. elem.style.display = "";
  12108. }
  12109. }
  12110. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12111. values[ index ] = getDefaultDisplay( elem );
  12112. }
  12113. } else {
  12114. if ( display !== "none" ) {
  12115. values[ index ] = "none";
  12116. // Remember what we're overwriting
  12117. dataPriv.set( elem, "display", display );
  12118. }
  12119. }
  12120. }
  12121. // Set the display of the elements in a second loop to avoid constant reflow
  12122. for ( index = 0; index < length; index++ ) {
  12123. if ( values[ index ] != null ) {
  12124. elements[ index ].style.display = values[ index ];
  12125. }
  12126. }
  12127. return elements;
  12128. }
  12129. jQuery.fn.extend( {
  12130. show: function() {
  12131. return showHide( this, true );
  12132. },
  12133. hide: function() {
  12134. return showHide( this );
  12135. },
  12136. toggle: function( state ) {
  12137. if ( typeof state === "boolean" ) {
  12138. return state ? this.show() : this.hide();
  12139. }
  12140. return this.each( function() {
  12141. if ( isHiddenWithinTree( this ) ) {
  12142. jQuery( this ).show();
  12143. } else {
  12144. jQuery( this ).hide();
  12145. }
  12146. } );
  12147. }
  12148. } );
  12149. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12150. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12151. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12152. // We have to close these tags to support XHTML (#13200)
  12153. var wrapMap = {
  12154. // Support: IE <=9 only
  12155. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12156. // XHTML parsers do not magically insert elements in the
  12157. // same way that tag soup parsers do. So we cannot shorten
  12158. // this by omitting <tbody> or other required elements.
  12159. thead: [ 1, "<table>", "</table>" ],
  12160. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12161. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12162. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12163. _default: [ 0, "", "" ]
  12164. };
  12165. // Support: IE <=9 only
  12166. wrapMap.optgroup = wrapMap.option;
  12167. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12168. wrapMap.th = wrapMap.td;
  12169. function getAll( context, tag ) {
  12170. // Support: IE <=9 - 11 only
  12171. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12172. var ret;
  12173. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12174. ret = context.getElementsByTagName( tag || "*" );
  12175. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12176. ret = context.querySelectorAll( tag || "*" );
  12177. } else {
  12178. ret = [];
  12179. }
  12180. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12181. return jQuery.merge( [ context ], ret );
  12182. }
  12183. return ret;
  12184. }
  12185. // Mark scripts as having already been evaluated
  12186. function setGlobalEval( elems, refElements ) {
  12187. var i = 0,
  12188. l = elems.length;
  12189. for ( ; i < l; i++ ) {
  12190. dataPriv.set(
  12191. elems[ i ],
  12192. "globalEval",
  12193. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12194. );
  12195. }
  12196. }
  12197. var rhtml = /<|&#?\w+;/;
  12198. function buildFragment( elems, context, scripts, selection, ignored ) {
  12199. var elem, tmp, tag, wrap, attached, j,
  12200. fragment = context.createDocumentFragment(),
  12201. nodes = [],
  12202. i = 0,
  12203. l = elems.length;
  12204. for ( ; i < l; i++ ) {
  12205. elem = elems[ i ];
  12206. if ( elem || elem === 0 ) {
  12207. // Add nodes directly
  12208. if ( toType( elem ) === "object" ) {
  12209. // Support: Android <=4.0 only, PhantomJS 1 only
  12210. // push.apply(_, arraylike) throws on ancient WebKit
  12211. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12212. // Convert non-html into a text node
  12213. } else if ( !rhtml.test( elem ) ) {
  12214. nodes.push( context.createTextNode( elem ) );
  12215. // Convert html into DOM nodes
  12216. } else {
  12217. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12218. // Deserialize a standard representation
  12219. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12220. wrap = wrapMap[ tag ] || wrapMap._default;
  12221. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12222. // Descend through wrappers to the right content
  12223. j = wrap[ 0 ];
  12224. while ( j-- ) {
  12225. tmp = tmp.lastChild;
  12226. }
  12227. // Support: Android <=4.0 only, PhantomJS 1 only
  12228. // push.apply(_, arraylike) throws on ancient WebKit
  12229. jQuery.merge( nodes, tmp.childNodes );
  12230. // Remember the top-level container
  12231. tmp = fragment.firstChild;
  12232. // Ensure the created nodes are orphaned (#12392)
  12233. tmp.textContent = "";
  12234. }
  12235. }
  12236. }
  12237. // Remove wrapper from fragment
  12238. fragment.textContent = "";
  12239. i = 0;
  12240. while ( ( elem = nodes[ i++ ] ) ) {
  12241. // Skip elements already in the context collection (trac-4087)
  12242. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12243. if ( ignored ) {
  12244. ignored.push( elem );
  12245. }
  12246. continue;
  12247. }
  12248. attached = isAttached( elem );
  12249. // Append to fragment
  12250. tmp = getAll( fragment.appendChild( elem ), "script" );
  12251. // Preserve script evaluation history
  12252. if ( attached ) {
  12253. setGlobalEval( tmp );
  12254. }
  12255. // Capture executables
  12256. if ( scripts ) {
  12257. j = 0;
  12258. while ( ( elem = tmp[ j++ ] ) ) {
  12259. if ( rscriptType.test( elem.type || "" ) ) {
  12260. scripts.push( elem );
  12261. }
  12262. }
  12263. }
  12264. }
  12265. return fragment;
  12266. }
  12267. ( function() {
  12268. var fragment = document.createDocumentFragment(),
  12269. div = fragment.appendChild( document.createElement( "div" ) ),
  12270. input = document.createElement( "input" );
  12271. // Support: Android 4.0 - 4.3 only
  12272. // Check state lost if the name is set (#11217)
  12273. // Support: Windows Web Apps (WWA)
  12274. // `name` and `type` must use .setAttribute for WWA (#14901)
  12275. input.setAttribute( "type", "radio" );
  12276. input.setAttribute( "checked", "checked" );
  12277. input.setAttribute( "name", "t" );
  12278. div.appendChild( input );
  12279. // Support: Android <=4.1 only
  12280. // Older WebKit doesn't clone checked state correctly in fragments
  12281. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12282. // Support: IE <=11 only
  12283. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12284. div.innerHTML = "<textarea>x</textarea>";
  12285. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12286. } )();
  12287. var
  12288. rkeyEvent = /^key/,
  12289. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12290. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12291. function returnTrue() {
  12292. return true;
  12293. }
  12294. function returnFalse() {
  12295. return false;
  12296. }
  12297. // Support: IE <=9 - 11+
  12298. // focus() and blur() are asynchronous, except when they are no-op.
  12299. // So expect focus to be synchronous when the element is already active,
  12300. // and blur to be synchronous when the element is not already active.
  12301. // (focus and blur are always synchronous in other supported browsers,
  12302. // this just defines when we can count on it).
  12303. function expectSync( elem, type ) {
  12304. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12305. }
  12306. // Support: IE <=9 only
  12307. // Accessing document.activeElement can throw unexpectedly
  12308. // https://bugs.jquery.com/ticket/13393
  12309. function safeActiveElement() {
  12310. try {
  12311. return document.activeElement;
  12312. } catch ( err ) { }
  12313. }
  12314. function on( elem, types, selector, data, fn, one ) {
  12315. var origFn, type;
  12316. // Types can be a map of types/handlers
  12317. if ( typeof types === "object" ) {
  12318. // ( types-Object, selector, data )
  12319. if ( typeof selector !== "string" ) {
  12320. // ( types-Object, data )
  12321. data = data || selector;
  12322. selector = undefined;
  12323. }
  12324. for ( type in types ) {
  12325. on( elem, type, selector, data, types[ type ], one );
  12326. }
  12327. return elem;
  12328. }
  12329. if ( data == null && fn == null ) {
  12330. // ( types, fn )
  12331. fn = selector;
  12332. data = selector = undefined;
  12333. } else if ( fn == null ) {
  12334. if ( typeof selector === "string" ) {
  12335. // ( types, selector, fn )
  12336. fn = data;
  12337. data = undefined;
  12338. } else {
  12339. // ( types, data, fn )
  12340. fn = data;
  12341. data = selector;
  12342. selector = undefined;
  12343. }
  12344. }
  12345. if ( fn === false ) {
  12346. fn = returnFalse;
  12347. } else if ( !fn ) {
  12348. return elem;
  12349. }
  12350. if ( one === 1 ) {
  12351. origFn = fn;
  12352. fn = function( event ) {
  12353. // Can use an empty set, since event contains the info
  12354. jQuery().off( event );
  12355. return origFn.apply( this, arguments );
  12356. };
  12357. // Use same guid so caller can remove using origFn
  12358. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12359. }
  12360. return elem.each( function() {
  12361. jQuery.event.add( this, types, fn, data, selector );
  12362. } );
  12363. }
  12364. /*
  12365. * Helper functions for managing events -- not part of the public interface.
  12366. * Props to Dean Edwards' addEvent library for many of the ideas.
  12367. */
  12368. jQuery.event = {
  12369. global: {},
  12370. add: function( elem, types, handler, data, selector ) {
  12371. var handleObjIn, eventHandle, tmp,
  12372. events, t, handleObj,
  12373. special, handlers, type, namespaces, origType,
  12374. elemData = dataPriv.get( elem );
  12375. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12376. if ( !elemData ) {
  12377. return;
  12378. }
  12379. // Caller can pass in an object of custom data in lieu of the handler
  12380. if ( handler.handler ) {
  12381. handleObjIn = handler;
  12382. handler = handleObjIn.handler;
  12383. selector = handleObjIn.selector;
  12384. }
  12385. // Ensure that invalid selectors throw exceptions at attach time
  12386. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12387. if ( selector ) {
  12388. jQuery.find.matchesSelector( documentElement, selector );
  12389. }
  12390. // Make sure that the handler has a unique ID, used to find/remove it later
  12391. if ( !handler.guid ) {
  12392. handler.guid = jQuery.guid++;
  12393. }
  12394. // Init the element's event structure and main handler, if this is the first
  12395. if ( !( events = elemData.events ) ) {
  12396. events = elemData.events = {};
  12397. }
  12398. if ( !( eventHandle = elemData.handle ) ) {
  12399. eventHandle = elemData.handle = function( e ) {
  12400. // Discard the second event of a jQuery.event.trigger() and
  12401. // when an event is called after a page has unloaded
  12402. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12403. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12404. };
  12405. }
  12406. // Handle multiple events separated by a space
  12407. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12408. t = types.length;
  12409. while ( t-- ) {
  12410. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12411. type = origType = tmp[ 1 ];
  12412. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12413. // There *must* be a type, no attaching namespace-only handlers
  12414. if ( !type ) {
  12415. continue;
  12416. }
  12417. // If event changes its type, use the special event handlers for the changed type
  12418. special = jQuery.event.special[ type ] || {};
  12419. // If selector defined, determine special event api type, otherwise given type
  12420. type = ( selector ? special.delegateType : special.bindType ) || type;
  12421. // Update special based on newly reset type
  12422. special = jQuery.event.special[ type ] || {};
  12423. // handleObj is passed to all event handlers
  12424. handleObj = jQuery.extend( {
  12425. type: type,
  12426. origType: origType,
  12427. data: data,
  12428. handler: handler,
  12429. guid: handler.guid,
  12430. selector: selector,
  12431. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12432. namespace: namespaces.join( "." )
  12433. }, handleObjIn );
  12434. // Init the event handler queue if we're the first
  12435. if ( !( handlers = events[ type ] ) ) {
  12436. handlers = events[ type ] = [];
  12437. handlers.delegateCount = 0;
  12438. // Only use addEventListener if the special events handler returns false
  12439. if ( !special.setup ||
  12440. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12441. if ( elem.addEventListener ) {
  12442. elem.addEventListener( type, eventHandle );
  12443. }
  12444. }
  12445. }
  12446. if ( special.add ) {
  12447. special.add.call( elem, handleObj );
  12448. if ( !handleObj.handler.guid ) {
  12449. handleObj.handler.guid = handler.guid;
  12450. }
  12451. }
  12452. // Add to the element's handler list, delegates in front
  12453. if ( selector ) {
  12454. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12455. } else {
  12456. handlers.push( handleObj );
  12457. }
  12458. // Keep track of which events have ever been used, for event optimization
  12459. jQuery.event.global[ type ] = true;
  12460. }
  12461. },
  12462. // Detach an event or set of events from an element
  12463. remove: function( elem, types, handler, selector, mappedTypes ) {
  12464. var j, origCount, tmp,
  12465. events, t, handleObj,
  12466. special, handlers, type, namespaces, origType,
  12467. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12468. if ( !elemData || !( events = elemData.events ) ) {
  12469. return;
  12470. }
  12471. // Once for each type.namespace in types; type may be omitted
  12472. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12473. t = types.length;
  12474. while ( t-- ) {
  12475. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12476. type = origType = tmp[ 1 ];
  12477. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12478. // Unbind all events (on this namespace, if provided) for the element
  12479. if ( !type ) {
  12480. for ( type in events ) {
  12481. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12482. }
  12483. continue;
  12484. }
  12485. special = jQuery.event.special[ type ] || {};
  12486. type = ( selector ? special.delegateType : special.bindType ) || type;
  12487. handlers = events[ type ] || [];
  12488. tmp = tmp[ 2 ] &&
  12489. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12490. // Remove matching events
  12491. origCount = j = handlers.length;
  12492. while ( j-- ) {
  12493. handleObj = handlers[ j ];
  12494. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12495. ( !handler || handler.guid === handleObj.guid ) &&
  12496. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12497. ( !selector || selector === handleObj.selector ||
  12498. selector === "**" && handleObj.selector ) ) {
  12499. handlers.splice( j, 1 );
  12500. if ( handleObj.selector ) {
  12501. handlers.delegateCount--;
  12502. }
  12503. if ( special.remove ) {
  12504. special.remove.call( elem, handleObj );
  12505. }
  12506. }
  12507. }
  12508. // Remove generic event handler if we removed something and no more handlers exist
  12509. // (avoids potential for endless recursion during removal of special event handlers)
  12510. if ( origCount && !handlers.length ) {
  12511. if ( !special.teardown ||
  12512. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12513. jQuery.removeEvent( elem, type, elemData.handle );
  12514. }
  12515. delete events[ type ];
  12516. }
  12517. }
  12518. // Remove data and the expando if it's no longer used
  12519. if ( jQuery.isEmptyObject( events ) ) {
  12520. dataPriv.remove( elem, "handle events" );
  12521. }
  12522. },
  12523. dispatch: function( nativeEvent ) {
  12524. // Make a writable jQuery.Event from the native event object
  12525. var event = jQuery.event.fix( nativeEvent );
  12526. var i, j, ret, matched, handleObj, handlerQueue,
  12527. args = new Array( arguments.length ),
  12528. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12529. special = jQuery.event.special[ event.type ] || {};
  12530. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12531. args[ 0 ] = event;
  12532. for ( i = 1; i < arguments.length; i++ ) {
  12533. args[ i ] = arguments[ i ];
  12534. }
  12535. event.delegateTarget = this;
  12536. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12537. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12538. return;
  12539. }
  12540. // Determine handlers
  12541. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12542. // Run delegates first; they may want to stop propagation beneath us
  12543. i = 0;
  12544. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12545. event.currentTarget = matched.elem;
  12546. j = 0;
  12547. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12548. !event.isImmediatePropagationStopped() ) {
  12549. // If the event is namespaced, then each handler is only invoked if it is
  12550. // specially universal or its namespaces are a superset of the event's.
  12551. if ( !event.rnamespace || handleObj.namespace === false ||
  12552. event.rnamespace.test( handleObj.namespace ) ) {
  12553. event.handleObj = handleObj;
  12554. event.data = handleObj.data;
  12555. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12556. handleObj.handler ).apply( matched.elem, args );
  12557. if ( ret !== undefined ) {
  12558. if ( ( event.result = ret ) === false ) {
  12559. event.preventDefault();
  12560. event.stopPropagation();
  12561. }
  12562. }
  12563. }
  12564. }
  12565. }
  12566. // Call the postDispatch hook for the mapped type
  12567. if ( special.postDispatch ) {
  12568. special.postDispatch.call( this, event );
  12569. }
  12570. return event.result;
  12571. },
  12572. handlers: function( event, handlers ) {
  12573. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12574. handlerQueue = [],
  12575. delegateCount = handlers.delegateCount,
  12576. cur = event.target;
  12577. // Find delegate handlers
  12578. if ( delegateCount &&
  12579. // Support: IE <=9
  12580. // Black-hole SVG <use> instance trees (trac-13180)
  12581. cur.nodeType &&
  12582. // Support: Firefox <=42
  12583. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12584. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12585. // Support: IE 11 only
  12586. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12587. !( event.type === "click" && event.button >= 1 ) ) {
  12588. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12589. // Don't check non-elements (#13208)
  12590. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12591. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12592. matchedHandlers = [];
  12593. matchedSelectors = {};
  12594. for ( i = 0; i < delegateCount; i++ ) {
  12595. handleObj = handlers[ i ];
  12596. // Don't conflict with Object.prototype properties (#13203)
  12597. sel = handleObj.selector + " ";
  12598. if ( matchedSelectors[ sel ] === undefined ) {
  12599. matchedSelectors[ sel ] = handleObj.needsContext ?
  12600. jQuery( sel, this ).index( cur ) > -1 :
  12601. jQuery.find( sel, this, null, [ cur ] ).length;
  12602. }
  12603. if ( matchedSelectors[ sel ] ) {
  12604. matchedHandlers.push( handleObj );
  12605. }
  12606. }
  12607. if ( matchedHandlers.length ) {
  12608. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12609. }
  12610. }
  12611. }
  12612. }
  12613. // Add the remaining (directly-bound) handlers
  12614. cur = this;
  12615. if ( delegateCount < handlers.length ) {
  12616. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12617. }
  12618. return handlerQueue;
  12619. },
  12620. addProp: function( name, hook ) {
  12621. Object.defineProperty( jQuery.Event.prototype, name, {
  12622. enumerable: true,
  12623. configurable: true,
  12624. get: isFunction( hook ) ?
  12625. function() {
  12626. if ( this.originalEvent ) {
  12627. return hook( this.originalEvent );
  12628. }
  12629. } :
  12630. function() {
  12631. if ( this.originalEvent ) {
  12632. return this.originalEvent[ name ];
  12633. }
  12634. },
  12635. set: function( value ) {
  12636. Object.defineProperty( this, name, {
  12637. enumerable: true,
  12638. configurable: true,
  12639. writable: true,
  12640. value: value
  12641. } );
  12642. }
  12643. } );
  12644. },
  12645. fix: function( originalEvent ) {
  12646. return originalEvent[ jQuery.expando ] ?
  12647. originalEvent :
  12648. new jQuery.Event( originalEvent );
  12649. },
  12650. special: {
  12651. load: {
  12652. // Prevent triggered image.load events from bubbling to window.load
  12653. noBubble: true
  12654. },
  12655. click: {
  12656. // Utilize native event to ensure correct state for checkable inputs
  12657. setup: function( data ) {
  12658. // For mutual compressibility with _default, replace `this` access with a local var.
  12659. // `|| data` is dead code meant only to preserve the variable through minification.
  12660. var el = this || data;
  12661. // Claim the first handler
  12662. if ( rcheckableType.test( el.type ) &&
  12663. el.click && nodeName( el, "input" ) ) {
  12664. // dataPriv.set( el, "click", ... )
  12665. leverageNative( el, "click", returnTrue );
  12666. }
  12667. // Return false to allow normal processing in the caller
  12668. return false;
  12669. },
  12670. trigger: function( data ) {
  12671. // For mutual compressibility with _default, replace `this` access with a local var.
  12672. // `|| data` is dead code meant only to preserve the variable through minification.
  12673. var el = this || data;
  12674. // Force setup before triggering a click
  12675. if ( rcheckableType.test( el.type ) &&
  12676. el.click && nodeName( el, "input" ) ) {
  12677. leverageNative( el, "click" );
  12678. }
  12679. // Return non-false to allow normal event-path propagation
  12680. return true;
  12681. },
  12682. // For cross-browser consistency, suppress native .click() on links
  12683. // Also prevent it if we're currently inside a leveraged native-event stack
  12684. _default: function( event ) {
  12685. var target = event.target;
  12686. return rcheckableType.test( target.type ) &&
  12687. target.click && nodeName( target, "input" ) &&
  12688. dataPriv.get( target, "click" ) ||
  12689. nodeName( target, "a" );
  12690. }
  12691. },
  12692. beforeunload: {
  12693. postDispatch: function( event ) {
  12694. // Support: Firefox 20+
  12695. // Firefox doesn't alert if the returnValue field is not set.
  12696. if ( event.result !== undefined && event.originalEvent ) {
  12697. event.originalEvent.returnValue = event.result;
  12698. }
  12699. }
  12700. }
  12701. }
  12702. };
  12703. // Ensure the presence of an event listener that handles manually-triggered
  12704. // synthetic events by interrupting progress until reinvoked in response to
  12705. // *native* events that it fires directly, ensuring that state changes have
  12706. // already occurred before other listeners are invoked.
  12707. function leverageNative( el, type, expectSync ) {
  12708. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12709. if ( !expectSync ) {
  12710. if ( dataPriv.get( el, type ) === undefined ) {
  12711. jQuery.event.add( el, type, returnTrue );
  12712. }
  12713. return;
  12714. }
  12715. // Register the controller as a special universal handler for all event namespaces
  12716. dataPriv.set( el, type, false );
  12717. jQuery.event.add( el, type, {
  12718. namespace: false,
  12719. handler: function( event ) {
  12720. var notAsync, result,
  12721. saved = dataPriv.get( this, type );
  12722. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12723. // Interrupt processing of the outer synthetic .trigger()ed event
  12724. // Saved data should be false in such cases, but might be a leftover capture object
  12725. // from an async native handler (gh-4350)
  12726. if ( !saved.length ) {
  12727. // Store arguments for use when handling the inner native event
  12728. // There will always be at least one argument (an event object), so this array
  12729. // will not be confused with a leftover capture object.
  12730. saved = slice.call( arguments );
  12731. dataPriv.set( this, type, saved );
  12732. // Trigger the native event and capture its result
  12733. // Support: IE <=9 - 11+
  12734. // focus() and blur() are asynchronous
  12735. notAsync = expectSync( this, type );
  12736. this[ type ]();
  12737. result = dataPriv.get( this, type );
  12738. if ( saved !== result || notAsync ) {
  12739. dataPriv.set( this, type, false );
  12740. } else {
  12741. result = {};
  12742. }
  12743. if ( saved !== result ) {
  12744. // Cancel the outer synthetic event
  12745. event.stopImmediatePropagation();
  12746. event.preventDefault();
  12747. return result.value;
  12748. }
  12749. // If this is an inner synthetic event for an event with a bubbling surrogate
  12750. // (focus or blur), assume that the surrogate already propagated from triggering the
  12751. // native event and prevent that from happening again here.
  12752. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  12753. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  12754. // less bad than duplication.
  12755. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  12756. event.stopPropagation();
  12757. }
  12758. // If this is a native event triggered above, everything is now in order
  12759. // Fire an inner synthetic event with the original arguments
  12760. } else if ( saved.length ) {
  12761. // ...and capture the result
  12762. dataPriv.set( this, type, {
  12763. value: jQuery.event.trigger(
  12764. // Support: IE <=9 - 11+
  12765. // Extend with the prototype to reset the above stopImmediatePropagation()
  12766. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  12767. saved.slice( 1 ),
  12768. this
  12769. )
  12770. } );
  12771. // Abort handling of the native event
  12772. event.stopImmediatePropagation();
  12773. }
  12774. }
  12775. } );
  12776. }
  12777. jQuery.removeEvent = function( elem, type, handle ) {
  12778. // This "if" is needed for plain objects
  12779. if ( elem.removeEventListener ) {
  12780. elem.removeEventListener( type, handle );
  12781. }
  12782. };
  12783. jQuery.Event = function( src, props ) {
  12784. // Allow instantiation without the 'new' keyword
  12785. if ( !( this instanceof jQuery.Event ) ) {
  12786. return new jQuery.Event( src, props );
  12787. }
  12788. // Event object
  12789. if ( src && src.type ) {
  12790. this.originalEvent = src;
  12791. this.type = src.type;
  12792. // Events bubbling up the document may have been marked as prevented
  12793. // by a handler lower down the tree; reflect the correct value.
  12794. this.isDefaultPrevented = src.defaultPrevented ||
  12795. src.defaultPrevented === undefined &&
  12796. // Support: Android <=2.3 only
  12797. src.returnValue === false ?
  12798. returnTrue :
  12799. returnFalse;
  12800. // Create target properties
  12801. // Support: Safari <=6 - 7 only
  12802. // Target should not be a text node (#504, #13143)
  12803. this.target = ( src.target && src.target.nodeType === 3 ) ?
  12804. src.target.parentNode :
  12805. src.target;
  12806. this.currentTarget = src.currentTarget;
  12807. this.relatedTarget = src.relatedTarget;
  12808. // Event type
  12809. } else {
  12810. this.type = src;
  12811. }
  12812. // Put explicitly provided properties onto the event object
  12813. if ( props ) {
  12814. jQuery.extend( this, props );
  12815. }
  12816. // Create a timestamp if incoming event doesn't have one
  12817. this.timeStamp = src && src.timeStamp || Date.now();
  12818. // Mark it as fixed
  12819. this[ jQuery.expando ] = true;
  12820. };
  12821. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  12822. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  12823. jQuery.Event.prototype = {
  12824. constructor: jQuery.Event,
  12825. isDefaultPrevented: returnFalse,
  12826. isPropagationStopped: returnFalse,
  12827. isImmediatePropagationStopped: returnFalse,
  12828. isSimulated: false,
  12829. preventDefault: function() {
  12830. var e = this.originalEvent;
  12831. this.isDefaultPrevented = returnTrue;
  12832. if ( e && !this.isSimulated ) {
  12833. e.preventDefault();
  12834. }
  12835. },
  12836. stopPropagation: function() {
  12837. var e = this.originalEvent;
  12838. this.isPropagationStopped = returnTrue;
  12839. if ( e && !this.isSimulated ) {
  12840. e.stopPropagation();
  12841. }
  12842. },
  12843. stopImmediatePropagation: function() {
  12844. var e = this.originalEvent;
  12845. this.isImmediatePropagationStopped = returnTrue;
  12846. if ( e && !this.isSimulated ) {
  12847. e.stopImmediatePropagation();
  12848. }
  12849. this.stopPropagation();
  12850. }
  12851. };
  12852. // Includes all common event props including KeyEvent and MouseEvent specific props
  12853. jQuery.each( {
  12854. altKey: true,
  12855. bubbles: true,
  12856. cancelable: true,
  12857. changedTouches: true,
  12858. ctrlKey: true,
  12859. detail: true,
  12860. eventPhase: true,
  12861. metaKey: true,
  12862. pageX: true,
  12863. pageY: true,
  12864. shiftKey: true,
  12865. view: true,
  12866. "char": true,
  12867. code: true,
  12868. charCode: true,
  12869. key: true,
  12870. keyCode: true,
  12871. button: true,
  12872. buttons: true,
  12873. clientX: true,
  12874. clientY: true,
  12875. offsetX: true,
  12876. offsetY: true,
  12877. pointerId: true,
  12878. pointerType: true,
  12879. screenX: true,
  12880. screenY: true,
  12881. targetTouches: true,
  12882. toElement: true,
  12883. touches: true,
  12884. which: function( event ) {
  12885. var button = event.button;
  12886. // Add which for key events
  12887. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  12888. return event.charCode != null ? event.charCode : event.keyCode;
  12889. }
  12890. // Add which for click: 1 === left; 2 === middle; 3 === right
  12891. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  12892. if ( button & 1 ) {
  12893. return 1;
  12894. }
  12895. if ( button & 2 ) {
  12896. return 3;
  12897. }
  12898. if ( button & 4 ) {
  12899. return 2;
  12900. }
  12901. return 0;
  12902. }
  12903. return event.which;
  12904. }
  12905. }, jQuery.event.addProp );
  12906. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  12907. jQuery.event.special[ type ] = {
  12908. // Utilize native event if possible so blur/focus sequence is correct
  12909. setup: function() {
  12910. // Claim the first handler
  12911. // dataPriv.set( this, "focus", ... )
  12912. // dataPriv.set( this, "blur", ... )
  12913. leverageNative( this, type, expectSync );
  12914. // Return false to allow normal processing in the caller
  12915. return false;
  12916. },
  12917. trigger: function() {
  12918. // Force setup before trigger
  12919. leverageNative( this, type );
  12920. // Return non-false to allow normal event-path propagation
  12921. return true;
  12922. },
  12923. delegateType: delegateType
  12924. };
  12925. } );
  12926. // Create mouseenter/leave events using mouseover/out and event-time checks
  12927. // so that event delegation works in jQuery.
  12928. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  12929. //
  12930. // Support: Safari 7 only
  12931. // Safari sends mouseenter too often; see:
  12932. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  12933. // for the description of the bug (it existed in older Chrome versions as well).
  12934. jQuery.each( {
  12935. mouseenter: "mouseover",
  12936. mouseleave: "mouseout",
  12937. pointerenter: "pointerover",
  12938. pointerleave: "pointerout"
  12939. }, function( orig, fix ) {
  12940. jQuery.event.special[ orig ] = {
  12941. delegateType: fix,
  12942. bindType: fix,
  12943. handle: function( event ) {
  12944. var ret,
  12945. target = this,
  12946. related = event.relatedTarget,
  12947. handleObj = event.handleObj;
  12948. // For mouseenter/leave call the handler if related is outside the target.
  12949. // NB: No relatedTarget if the mouse left/entered the browser window
  12950. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  12951. event.type = handleObj.origType;
  12952. ret = handleObj.handler.apply( this, arguments );
  12953. event.type = fix;
  12954. }
  12955. return ret;
  12956. }
  12957. };
  12958. } );
  12959. jQuery.fn.extend( {
  12960. on: function( types, selector, data, fn ) {
  12961. return on( this, types, selector, data, fn );
  12962. },
  12963. one: function( types, selector, data, fn ) {
  12964. return on( this, types, selector, data, fn, 1 );
  12965. },
  12966. off: function( types, selector, fn ) {
  12967. var handleObj, type;
  12968. if ( types && types.preventDefault && types.handleObj ) {
  12969. // ( event ) dispatched jQuery.Event
  12970. handleObj = types.handleObj;
  12971. jQuery( types.delegateTarget ).off(
  12972. handleObj.namespace ?
  12973. handleObj.origType + "." + handleObj.namespace :
  12974. handleObj.origType,
  12975. handleObj.selector,
  12976. handleObj.handler
  12977. );
  12978. return this;
  12979. }
  12980. if ( typeof types === "object" ) {
  12981. // ( types-object [, selector] )
  12982. for ( type in types ) {
  12983. this.off( type, selector, types[ type ] );
  12984. }
  12985. return this;
  12986. }
  12987. if ( selector === false || typeof selector === "function" ) {
  12988. // ( types [, fn] )
  12989. fn = selector;
  12990. selector = undefined;
  12991. }
  12992. if ( fn === false ) {
  12993. fn = returnFalse;
  12994. }
  12995. return this.each( function() {
  12996. jQuery.event.remove( this, types, fn, selector );
  12997. } );
  12998. }
  12999. } );
  13000. var
  13001. /* eslint-disable max-len */
  13002. // See https://github.com/eslint/eslint/issues/3229
  13003. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13004. /* eslint-enable */
  13005. // Support: IE <=10 - 11, Edge 12 - 13 only
  13006. // In IE/Edge using regex groups here causes severe slowdowns.
  13007. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13008. rnoInnerhtml = /<script|<style|<link/i,
  13009. // checked="checked" or checked
  13010. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13011. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13012. // Prefer a tbody over its parent table for containing new rows
  13013. function manipulationTarget( elem, content ) {
  13014. if ( nodeName( elem, "table" ) &&
  13015. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13016. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13017. }
  13018. return elem;
  13019. }
  13020. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13021. function disableScript( elem ) {
  13022. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13023. return elem;
  13024. }
  13025. function restoreScript( elem ) {
  13026. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13027. elem.type = elem.type.slice( 5 );
  13028. } else {
  13029. elem.removeAttribute( "type" );
  13030. }
  13031. return elem;
  13032. }
  13033. function cloneCopyEvent( src, dest ) {
  13034. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13035. if ( dest.nodeType !== 1 ) {
  13036. return;
  13037. }
  13038. // 1. Copy private data: events, handlers, etc.
  13039. if ( dataPriv.hasData( src ) ) {
  13040. pdataOld = dataPriv.access( src );
  13041. pdataCur = dataPriv.set( dest, pdataOld );
  13042. events = pdataOld.events;
  13043. if ( events ) {
  13044. delete pdataCur.handle;
  13045. pdataCur.events = {};
  13046. for ( type in events ) {
  13047. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13048. jQuery.event.add( dest, type, events[ type ][ i ] );
  13049. }
  13050. }
  13051. }
  13052. }
  13053. // 2. Copy user data
  13054. if ( dataUser.hasData( src ) ) {
  13055. udataOld = dataUser.access( src );
  13056. udataCur = jQuery.extend( {}, udataOld );
  13057. dataUser.set( dest, udataCur );
  13058. }
  13059. }
  13060. // Fix IE bugs, see support tests
  13061. function fixInput( src, dest ) {
  13062. var nodeName = dest.nodeName.toLowerCase();
  13063. // Fails to persist the checked state of a cloned checkbox or radio button.
  13064. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13065. dest.checked = src.checked;
  13066. // Fails to return the selected option to the default selected state when cloning options
  13067. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13068. dest.defaultValue = src.defaultValue;
  13069. }
  13070. }
  13071. function domManip( collection, args, callback, ignored ) {
  13072. // Flatten any nested arrays
  13073. args = concat.apply( [], args );
  13074. var fragment, first, scripts, hasScripts, node, doc,
  13075. i = 0,
  13076. l = collection.length,
  13077. iNoClone = l - 1,
  13078. value = args[ 0 ],
  13079. valueIsFunction = isFunction( value );
  13080. // We can't cloneNode fragments that contain checked, in WebKit
  13081. if ( valueIsFunction ||
  13082. ( l > 1 && typeof value === "string" &&
  13083. !support.checkClone && rchecked.test( value ) ) ) {
  13084. return collection.each( function( index ) {
  13085. var self = collection.eq( index );
  13086. if ( valueIsFunction ) {
  13087. args[ 0 ] = value.call( this, index, self.html() );
  13088. }
  13089. domManip( self, args, callback, ignored );
  13090. } );
  13091. }
  13092. if ( l ) {
  13093. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13094. first = fragment.firstChild;
  13095. if ( fragment.childNodes.length === 1 ) {
  13096. fragment = first;
  13097. }
  13098. // Require either new content or an interest in ignored elements to invoke the callback
  13099. if ( first || ignored ) {
  13100. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13101. hasScripts = scripts.length;
  13102. // Use the original fragment for the last item
  13103. // instead of the first because it can end up
  13104. // being emptied incorrectly in certain situations (#8070).
  13105. for ( ; i < l; i++ ) {
  13106. node = fragment;
  13107. if ( i !== iNoClone ) {
  13108. node = jQuery.clone( node, true, true );
  13109. // Keep references to cloned scripts for later restoration
  13110. if ( hasScripts ) {
  13111. // Support: Android <=4.0 only, PhantomJS 1 only
  13112. // push.apply(_, arraylike) throws on ancient WebKit
  13113. jQuery.merge( scripts, getAll( node, "script" ) );
  13114. }
  13115. }
  13116. callback.call( collection[ i ], node, i );
  13117. }
  13118. if ( hasScripts ) {
  13119. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13120. // Reenable scripts
  13121. jQuery.map( scripts, restoreScript );
  13122. // Evaluate executable scripts on first document insertion
  13123. for ( i = 0; i < hasScripts; i++ ) {
  13124. node = scripts[ i ];
  13125. if ( rscriptType.test( node.type || "" ) &&
  13126. !dataPriv.access( node, "globalEval" ) &&
  13127. jQuery.contains( doc, node ) ) {
  13128. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13129. // Optional AJAX dependency, but won't run scripts if not present
  13130. if ( jQuery._evalUrl && !node.noModule ) {
  13131. jQuery._evalUrl( node.src, {
  13132. nonce: node.nonce || node.getAttribute( "nonce" )
  13133. } );
  13134. }
  13135. } else {
  13136. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13137. }
  13138. }
  13139. }
  13140. }
  13141. }
  13142. }
  13143. return collection;
  13144. }
  13145. function remove( elem, selector, keepData ) {
  13146. var node,
  13147. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13148. i = 0;
  13149. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13150. if ( !keepData && node.nodeType === 1 ) {
  13151. jQuery.cleanData( getAll( node ) );
  13152. }
  13153. if ( node.parentNode ) {
  13154. if ( keepData && isAttached( node ) ) {
  13155. setGlobalEval( getAll( node, "script" ) );
  13156. }
  13157. node.parentNode.removeChild( node );
  13158. }
  13159. }
  13160. return elem;
  13161. }
  13162. jQuery.extend( {
  13163. htmlPrefilter: function( html ) {
  13164. return html.replace( rxhtmlTag, "<$1></$2>" );
  13165. },
  13166. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13167. var i, l, srcElements, destElements,
  13168. clone = elem.cloneNode( true ),
  13169. inPage = isAttached( elem );
  13170. // Fix IE cloning issues
  13171. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13172. !jQuery.isXMLDoc( elem ) ) {
  13173. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13174. destElements = getAll( clone );
  13175. srcElements = getAll( elem );
  13176. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13177. fixInput( srcElements[ i ], destElements[ i ] );
  13178. }
  13179. }
  13180. // Copy the events from the original to the clone
  13181. if ( dataAndEvents ) {
  13182. if ( deepDataAndEvents ) {
  13183. srcElements = srcElements || getAll( elem );
  13184. destElements = destElements || getAll( clone );
  13185. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13186. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13187. }
  13188. } else {
  13189. cloneCopyEvent( elem, clone );
  13190. }
  13191. }
  13192. // Preserve script evaluation history
  13193. destElements = getAll( clone, "script" );
  13194. if ( destElements.length > 0 ) {
  13195. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13196. }
  13197. // Return the cloned set
  13198. return clone;
  13199. },
  13200. cleanData: function( elems ) {
  13201. var data, elem, type,
  13202. special = jQuery.event.special,
  13203. i = 0;
  13204. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13205. if ( acceptData( elem ) ) {
  13206. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13207. if ( data.events ) {
  13208. for ( type in data.events ) {
  13209. if ( special[ type ] ) {
  13210. jQuery.event.remove( elem, type );
  13211. // This is a shortcut to avoid jQuery.event.remove's overhead
  13212. } else {
  13213. jQuery.removeEvent( elem, type, data.handle );
  13214. }
  13215. }
  13216. }
  13217. // Support: Chrome <=35 - 45+
  13218. // Assign undefined instead of using delete, see Data#remove
  13219. elem[ dataPriv.expando ] = undefined;
  13220. }
  13221. if ( elem[ dataUser.expando ] ) {
  13222. // Support: Chrome <=35 - 45+
  13223. // Assign undefined instead of using delete, see Data#remove
  13224. elem[ dataUser.expando ] = undefined;
  13225. }
  13226. }
  13227. }
  13228. }
  13229. } );
  13230. jQuery.fn.extend( {
  13231. detach: function( selector ) {
  13232. return remove( this, selector, true );
  13233. },
  13234. remove: function( selector ) {
  13235. return remove( this, selector );
  13236. },
  13237. text: function( value ) {
  13238. return access( this, function( value ) {
  13239. return value === undefined ?
  13240. jQuery.text( this ) :
  13241. this.empty().each( function() {
  13242. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13243. this.textContent = value;
  13244. }
  13245. } );
  13246. }, null, value, arguments.length );
  13247. },
  13248. append: function() {
  13249. return domManip( this, arguments, function( elem ) {
  13250. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13251. var target = manipulationTarget( this, elem );
  13252. target.appendChild( elem );
  13253. }
  13254. } );
  13255. },
  13256. prepend: function() {
  13257. return domManip( this, arguments, function( elem ) {
  13258. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13259. var target = manipulationTarget( this, elem );
  13260. target.insertBefore( elem, target.firstChild );
  13261. }
  13262. } );
  13263. },
  13264. before: function() {
  13265. return domManip( this, arguments, function( elem ) {
  13266. if ( this.parentNode ) {
  13267. this.parentNode.insertBefore( elem, this );
  13268. }
  13269. } );
  13270. },
  13271. after: function() {
  13272. return domManip( this, arguments, function( elem ) {
  13273. if ( this.parentNode ) {
  13274. this.parentNode.insertBefore( elem, this.nextSibling );
  13275. }
  13276. } );
  13277. },
  13278. empty: function() {
  13279. var elem,
  13280. i = 0;
  13281. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13282. if ( elem.nodeType === 1 ) {
  13283. // Prevent memory leaks
  13284. jQuery.cleanData( getAll( elem, false ) );
  13285. // Remove any remaining nodes
  13286. elem.textContent = "";
  13287. }
  13288. }
  13289. return this;
  13290. },
  13291. clone: function( dataAndEvents, deepDataAndEvents ) {
  13292. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13293. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13294. return this.map( function() {
  13295. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13296. } );
  13297. },
  13298. html: function( value ) {
  13299. return access( this, function( value ) {
  13300. var elem = this[ 0 ] || {},
  13301. i = 0,
  13302. l = this.length;
  13303. if ( value === undefined && elem.nodeType === 1 ) {
  13304. return elem.innerHTML;
  13305. }
  13306. // See if we can take a shortcut and just use innerHTML
  13307. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13308. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13309. value = jQuery.htmlPrefilter( value );
  13310. try {
  13311. for ( ; i < l; i++ ) {
  13312. elem = this[ i ] || {};
  13313. // Remove element nodes and prevent memory leaks
  13314. if ( elem.nodeType === 1 ) {
  13315. jQuery.cleanData( getAll( elem, false ) );
  13316. elem.innerHTML = value;
  13317. }
  13318. }
  13319. elem = 0;
  13320. // If using innerHTML throws an exception, use the fallback method
  13321. } catch ( e ) {}
  13322. }
  13323. if ( elem ) {
  13324. this.empty().append( value );
  13325. }
  13326. }, null, value, arguments.length );
  13327. },
  13328. replaceWith: function() {
  13329. var ignored = [];
  13330. // Make the changes, replacing each non-ignored context element with the new content
  13331. return domManip( this, arguments, function( elem ) {
  13332. var parent = this.parentNode;
  13333. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13334. jQuery.cleanData( getAll( this ) );
  13335. if ( parent ) {
  13336. parent.replaceChild( elem, this );
  13337. }
  13338. }
  13339. // Force callback invocation
  13340. }, ignored );
  13341. }
  13342. } );
  13343. jQuery.each( {
  13344. appendTo: "append",
  13345. prependTo: "prepend",
  13346. insertBefore: "before",
  13347. insertAfter: "after",
  13348. replaceAll: "replaceWith"
  13349. }, function( name, original ) {
  13350. jQuery.fn[ name ] = function( selector ) {
  13351. var elems,
  13352. ret = [],
  13353. insert = jQuery( selector ),
  13354. last = insert.length - 1,
  13355. i = 0;
  13356. for ( ; i <= last; i++ ) {
  13357. elems = i === last ? this : this.clone( true );
  13358. jQuery( insert[ i ] )[ original ]( elems );
  13359. // Support: Android <=4.0 only, PhantomJS 1 only
  13360. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13361. push.apply( ret, elems.get() );
  13362. }
  13363. return this.pushStack( ret );
  13364. };
  13365. } );
  13366. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13367. var getStyles = function( elem ) {
  13368. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13369. // IE throws on elements created in popups
  13370. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13371. var view = elem.ownerDocument.defaultView;
  13372. if ( !view || !view.opener ) {
  13373. view = window;
  13374. }
  13375. return view.getComputedStyle( elem );
  13376. };
  13377. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13378. ( function() {
  13379. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13380. // so they're executed at the same time to save the second computation.
  13381. function computeStyleTests() {
  13382. // This is a singleton, we need to execute it only once
  13383. if ( !div ) {
  13384. return;
  13385. }
  13386. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13387. "margin-top:1px;padding:0;border:0";
  13388. div.style.cssText =
  13389. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13390. "margin:auto;border:1px;padding:1px;" +
  13391. "width:60%;top:1%";
  13392. documentElement.appendChild( container ).appendChild( div );
  13393. var divStyle = window.getComputedStyle( div );
  13394. pixelPositionVal = divStyle.top !== "1%";
  13395. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13396. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13397. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13398. // Some styles come back with percentage values, even though they shouldn't
  13399. div.style.right = "60%";
  13400. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13401. // Support: IE 9 - 11 only
  13402. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13403. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13404. // Support: IE 9 only
  13405. // Detect overflow:scroll screwiness (gh-3699)
  13406. // Support: Chrome <=64
  13407. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13408. div.style.position = "absolute";
  13409. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13410. documentElement.removeChild( container );
  13411. // Nullify the div so it wouldn't be stored in the memory and
  13412. // it will also be a sign that checks already performed
  13413. div = null;
  13414. }
  13415. function roundPixelMeasures( measure ) {
  13416. return Math.round( parseFloat( measure ) );
  13417. }
  13418. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13419. reliableMarginLeftVal,
  13420. container = document.createElement( "div" ),
  13421. div = document.createElement( "div" );
  13422. // Finish early in limited (non-browser) environments
  13423. if ( !div.style ) {
  13424. return;
  13425. }
  13426. // Support: IE <=9 - 11 only
  13427. // Style of cloned element affects source element cloned (#8908)
  13428. div.style.backgroundClip = "content-box";
  13429. div.cloneNode( true ).style.backgroundClip = "";
  13430. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13431. jQuery.extend( support, {
  13432. boxSizingReliable: function() {
  13433. computeStyleTests();
  13434. return boxSizingReliableVal;
  13435. },
  13436. pixelBoxStyles: function() {
  13437. computeStyleTests();
  13438. return pixelBoxStylesVal;
  13439. },
  13440. pixelPosition: function() {
  13441. computeStyleTests();
  13442. return pixelPositionVal;
  13443. },
  13444. reliableMarginLeft: function() {
  13445. computeStyleTests();
  13446. return reliableMarginLeftVal;
  13447. },
  13448. scrollboxSize: function() {
  13449. computeStyleTests();
  13450. return scrollboxSizeVal;
  13451. }
  13452. } );
  13453. } )();
  13454. function curCSS( elem, name, computed ) {
  13455. var width, minWidth, maxWidth, ret,
  13456. // Support: Firefox 51+
  13457. // Retrieving style before computed somehow
  13458. // fixes an issue with getting wrong values
  13459. // on detached elements
  13460. style = elem.style;
  13461. computed = computed || getStyles( elem );
  13462. // getPropertyValue is needed for:
  13463. // .css('filter') (IE 9 only, #12537)
  13464. // .css('--customProperty) (#3144)
  13465. if ( computed ) {
  13466. ret = computed.getPropertyValue( name ) || computed[ name ];
  13467. if ( ret === "" && !isAttached( elem ) ) {
  13468. ret = jQuery.style( elem, name );
  13469. }
  13470. // A tribute to the "awesome hack by Dean Edwards"
  13471. // Android Browser returns percentage for some values,
  13472. // but width seems to be reliably pixels.
  13473. // This is against the CSSOM draft spec:
  13474. // https://drafts.csswg.org/cssom/#resolved-values
  13475. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13476. // Remember the original values
  13477. width = style.width;
  13478. minWidth = style.minWidth;
  13479. maxWidth = style.maxWidth;
  13480. // Put in the new values to get a computed value out
  13481. style.minWidth = style.maxWidth = style.width = ret;
  13482. ret = computed.width;
  13483. // Revert the changed values
  13484. style.width = width;
  13485. style.minWidth = minWidth;
  13486. style.maxWidth = maxWidth;
  13487. }
  13488. }
  13489. return ret !== undefined ?
  13490. // Support: IE <=9 - 11 only
  13491. // IE returns zIndex value as an integer.
  13492. ret + "" :
  13493. ret;
  13494. }
  13495. function addGetHookIf( conditionFn, hookFn ) {
  13496. // Define the hook, we'll check on the first run if it's really needed.
  13497. return {
  13498. get: function() {
  13499. if ( conditionFn() ) {
  13500. // Hook not needed (or it's not possible to use it due
  13501. // to missing dependency), remove it.
  13502. delete this.get;
  13503. return;
  13504. }
  13505. // Hook needed; redefine it so that the support test is not executed again.
  13506. return ( this.get = hookFn ).apply( this, arguments );
  13507. }
  13508. };
  13509. }
  13510. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13511. emptyStyle = document.createElement( "div" ).style,
  13512. vendorProps = {};
  13513. // Return a vendor-prefixed property or undefined
  13514. function vendorPropName( name ) {
  13515. // Check for vendor prefixed names
  13516. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13517. i = cssPrefixes.length;
  13518. while ( i-- ) {
  13519. name = cssPrefixes[ i ] + capName;
  13520. if ( name in emptyStyle ) {
  13521. return name;
  13522. }
  13523. }
  13524. }
  13525. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13526. function finalPropName( name ) {
  13527. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13528. if ( final ) {
  13529. return final;
  13530. }
  13531. if ( name in emptyStyle ) {
  13532. return name;
  13533. }
  13534. return vendorProps[ name ] = vendorPropName( name ) || name;
  13535. }
  13536. var
  13537. // Swappable if display is none or starts with table
  13538. // except "table", "table-cell", or "table-caption"
  13539. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13540. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13541. rcustomProp = /^--/,
  13542. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13543. cssNormalTransform = {
  13544. letterSpacing: "0",
  13545. fontWeight: "400"
  13546. };
  13547. function setPositiveNumber( elem, value, subtract ) {
  13548. // Any relative (+/-) values have already been
  13549. // normalized at this point
  13550. var matches = rcssNum.exec( value );
  13551. return matches ?
  13552. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13553. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13554. value;
  13555. }
  13556. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13557. var i = dimension === "width" ? 1 : 0,
  13558. extra = 0,
  13559. delta = 0;
  13560. // Adjustment may not be necessary
  13561. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13562. return 0;
  13563. }
  13564. for ( ; i < 4; i += 2 ) {
  13565. // Both box models exclude margin
  13566. if ( box === "margin" ) {
  13567. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13568. }
  13569. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13570. if ( !isBorderBox ) {
  13571. // Add padding
  13572. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13573. // For "border" or "margin", add border
  13574. if ( box !== "padding" ) {
  13575. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13576. // But still keep track of it otherwise
  13577. } else {
  13578. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13579. }
  13580. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13581. // "padding" or "margin"
  13582. } else {
  13583. // For "content", subtract padding
  13584. if ( box === "content" ) {
  13585. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13586. }
  13587. // For "content" or "padding", subtract border
  13588. if ( box !== "margin" ) {
  13589. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13590. }
  13591. }
  13592. }
  13593. // Account for positive content-box scroll gutter when requested by providing computedVal
  13594. if ( !isBorderBox && computedVal >= 0 ) {
  13595. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13596. // Assuming integer scroll gutter, subtract the rest and round down
  13597. delta += Math.max( 0, Math.ceil(
  13598. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13599. computedVal -
  13600. delta -
  13601. extra -
  13602. 0.5
  13603. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13604. // Use an explicit zero to avoid NaN (gh-3964)
  13605. ) ) || 0;
  13606. }
  13607. return delta;
  13608. }
  13609. function getWidthOrHeight( elem, dimension, extra ) {
  13610. // Start with computed style
  13611. var styles = getStyles( elem ),
  13612. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13613. // Fake content-box until we know it's needed to know the true value.
  13614. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13615. isBorderBox = boxSizingNeeded &&
  13616. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13617. valueIsBorderBox = isBorderBox,
  13618. val = curCSS( elem, dimension, styles ),
  13619. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13620. // Support: Firefox <=54
  13621. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13622. if ( rnumnonpx.test( val ) ) {
  13623. if ( !extra ) {
  13624. return val;
  13625. }
  13626. val = "auto";
  13627. }
  13628. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13629. // This happens for inline elements with no explicit setting (gh-3571)
  13630. // Support: Android <=4.1 - 4.3 only
  13631. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13632. // Support: IE 9-11 only
  13633. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13634. // We use getClientRects() to check for hidden/disconnected.
  13635. // In those cases, the computed value can be trusted to be border-box
  13636. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13637. val === "auto" ||
  13638. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13639. elem.getClientRects().length ) {
  13640. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13641. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13642. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13643. // retrieved value as a content box dimension.
  13644. valueIsBorderBox = offsetProp in elem;
  13645. if ( valueIsBorderBox ) {
  13646. val = elem[ offsetProp ];
  13647. }
  13648. }
  13649. // Normalize "" and auto
  13650. val = parseFloat( val ) || 0;
  13651. // Adjust for the element's box model
  13652. return ( val +
  13653. boxModelAdjustment(
  13654. elem,
  13655. dimension,
  13656. extra || ( isBorderBox ? "border" : "content" ),
  13657. valueIsBorderBox,
  13658. styles,
  13659. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13660. val
  13661. )
  13662. ) + "px";
  13663. }
  13664. jQuery.extend( {
  13665. // Add in style property hooks for overriding the default
  13666. // behavior of getting and setting a style property
  13667. cssHooks: {
  13668. opacity: {
  13669. get: function( elem, computed ) {
  13670. if ( computed ) {
  13671. // We should always get a number back from opacity
  13672. var ret = curCSS( elem, "opacity" );
  13673. return ret === "" ? "1" : ret;
  13674. }
  13675. }
  13676. }
  13677. },
  13678. // Don't automatically add "px" to these possibly-unitless properties
  13679. cssNumber: {
  13680. "animationIterationCount": true,
  13681. "columnCount": true,
  13682. "fillOpacity": true,
  13683. "flexGrow": true,
  13684. "flexShrink": true,
  13685. "fontWeight": true,
  13686. "gridArea": true,
  13687. "gridColumn": true,
  13688. "gridColumnEnd": true,
  13689. "gridColumnStart": true,
  13690. "gridRow": true,
  13691. "gridRowEnd": true,
  13692. "gridRowStart": true,
  13693. "lineHeight": true,
  13694. "opacity": true,
  13695. "order": true,
  13696. "orphans": true,
  13697. "widows": true,
  13698. "zIndex": true,
  13699. "zoom": true
  13700. },
  13701. // Add in properties whose names you wish to fix before
  13702. // setting or getting the value
  13703. cssProps: {},
  13704. // Get and set the style property on a DOM Node
  13705. style: function( elem, name, value, extra ) {
  13706. // Don't set styles on text and comment nodes
  13707. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13708. return;
  13709. }
  13710. // Make sure that we're working with the right name
  13711. var ret, type, hooks,
  13712. origName = camelCase( name ),
  13713. isCustomProp = rcustomProp.test( name ),
  13714. style = elem.style;
  13715. // Make sure that we're working with the right name. We don't
  13716. // want to query the value if it is a CSS custom property
  13717. // since they are user-defined.
  13718. if ( !isCustomProp ) {
  13719. name = finalPropName( origName );
  13720. }
  13721. // Gets hook for the prefixed version, then unprefixed version
  13722. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13723. // Check if we're setting a value
  13724. if ( value !== undefined ) {
  13725. type = typeof value;
  13726. // Convert "+=" or "-=" to relative numbers (#7345)
  13727. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13728. value = adjustCSS( elem, name, ret );
  13729. // Fixes bug #9237
  13730. type = "number";
  13731. }
  13732. // Make sure that null and NaN values aren't set (#7116)
  13733. if ( value == null || value !== value ) {
  13734. return;
  13735. }
  13736. // If a number was passed in, add the unit (except for certain CSS properties)
  13737. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  13738. // "px" to a few hardcoded values.
  13739. if ( type === "number" && !isCustomProp ) {
  13740. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  13741. }
  13742. // background-* props affect original clone's values
  13743. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  13744. style[ name ] = "inherit";
  13745. }
  13746. // If a hook was provided, use that value, otherwise just set the specified value
  13747. if ( !hooks || !( "set" in hooks ) ||
  13748. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  13749. if ( isCustomProp ) {
  13750. style.setProperty( name, value );
  13751. } else {
  13752. style[ name ] = value;
  13753. }
  13754. }
  13755. } else {
  13756. // If a hook was provided get the non-computed value from there
  13757. if ( hooks && "get" in hooks &&
  13758. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  13759. return ret;
  13760. }
  13761. // Otherwise just get the value from the style object
  13762. return style[ name ];
  13763. }
  13764. },
  13765. css: function( elem, name, extra, styles ) {
  13766. var val, num, hooks,
  13767. origName = camelCase( name ),
  13768. isCustomProp = rcustomProp.test( name );
  13769. // Make sure that we're working with the right name. We don't
  13770. // want to modify the value if it is a CSS custom property
  13771. // since they are user-defined.
  13772. if ( !isCustomProp ) {
  13773. name = finalPropName( origName );
  13774. }
  13775. // Try prefixed name followed by the unprefixed name
  13776. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13777. // If a hook was provided get the computed value from there
  13778. if ( hooks && "get" in hooks ) {
  13779. val = hooks.get( elem, true, extra );
  13780. }
  13781. // Otherwise, if a way to get the computed value exists, use that
  13782. if ( val === undefined ) {
  13783. val = curCSS( elem, name, styles );
  13784. }
  13785. // Convert "normal" to computed value
  13786. if ( val === "normal" && name in cssNormalTransform ) {
  13787. val = cssNormalTransform[ name ];
  13788. }
  13789. // Make numeric if forced or a qualifier was provided and val looks numeric
  13790. if ( extra === "" || extra ) {
  13791. num = parseFloat( val );
  13792. return extra === true || isFinite( num ) ? num || 0 : val;
  13793. }
  13794. return val;
  13795. }
  13796. } );
  13797. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  13798. jQuery.cssHooks[ dimension ] = {
  13799. get: function( elem, computed, extra ) {
  13800. if ( computed ) {
  13801. // Certain elements can have dimension info if we invisibly show them
  13802. // but it must have a current display style that would benefit
  13803. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  13804. // Support: Safari 8+
  13805. // Table columns in Safari have non-zero offsetWidth & zero
  13806. // getBoundingClientRect().width unless display is changed.
  13807. // Support: IE <=11 only
  13808. // Running getBoundingClientRect on a disconnected node
  13809. // in IE throws an error.
  13810. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  13811. swap( elem, cssShow, function() {
  13812. return getWidthOrHeight( elem, dimension, extra );
  13813. } ) :
  13814. getWidthOrHeight( elem, dimension, extra );
  13815. }
  13816. },
  13817. set: function( elem, value, extra ) {
  13818. var matches,
  13819. styles = getStyles( elem ),
  13820. // Only read styles.position if the test has a chance to fail
  13821. // to avoid forcing a reflow.
  13822. scrollboxSizeBuggy = !support.scrollboxSize() &&
  13823. styles.position === "absolute",
  13824. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  13825. boxSizingNeeded = scrollboxSizeBuggy || extra,
  13826. isBorderBox = boxSizingNeeded &&
  13827. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13828. subtract = extra ?
  13829. boxModelAdjustment(
  13830. elem,
  13831. dimension,
  13832. extra,
  13833. isBorderBox,
  13834. styles
  13835. ) :
  13836. 0;
  13837. // Account for unreliable border-box dimensions by comparing offset* to computed and
  13838. // faking a content-box to get border and padding (gh-3699)
  13839. if ( isBorderBox && scrollboxSizeBuggy ) {
  13840. subtract -= Math.ceil(
  13841. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13842. parseFloat( styles[ dimension ] ) -
  13843. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  13844. 0.5
  13845. );
  13846. }
  13847. // Convert to pixels if value adjustment is needed
  13848. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  13849. ( matches[ 3 ] || "px" ) !== "px" ) {
  13850. elem.style[ dimension ] = value;
  13851. value = jQuery.css( elem, dimension );
  13852. }
  13853. return setPositiveNumber( elem, value, subtract );
  13854. }
  13855. };
  13856. } );
  13857. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  13858. function( elem, computed ) {
  13859. if ( computed ) {
  13860. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  13861. elem.getBoundingClientRect().left -
  13862. swap( elem, { marginLeft: 0 }, function() {
  13863. return elem.getBoundingClientRect().left;
  13864. } )
  13865. ) + "px";
  13866. }
  13867. }
  13868. );
  13869. // These hooks are used by animate to expand properties
  13870. jQuery.each( {
  13871. margin: "",
  13872. padding: "",
  13873. border: "Width"
  13874. }, function( prefix, suffix ) {
  13875. jQuery.cssHooks[ prefix + suffix ] = {
  13876. expand: function( value ) {
  13877. var i = 0,
  13878. expanded = {},
  13879. // Assumes a single number if not a string
  13880. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  13881. for ( ; i < 4; i++ ) {
  13882. expanded[ prefix + cssExpand[ i ] + suffix ] =
  13883. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  13884. }
  13885. return expanded;
  13886. }
  13887. };
  13888. if ( prefix !== "margin" ) {
  13889. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  13890. }
  13891. } );
  13892. jQuery.fn.extend( {
  13893. css: function( name, value ) {
  13894. return access( this, function( elem, name, value ) {
  13895. var styles, len,
  13896. map = {},
  13897. i = 0;
  13898. if ( Array.isArray( name ) ) {
  13899. styles = getStyles( elem );
  13900. len = name.length;
  13901. for ( ; i < len; i++ ) {
  13902. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  13903. }
  13904. return map;
  13905. }
  13906. return value !== undefined ?
  13907. jQuery.style( elem, name, value ) :
  13908. jQuery.css( elem, name );
  13909. }, name, value, arguments.length > 1 );
  13910. }
  13911. } );
  13912. function Tween( elem, options, prop, end, easing ) {
  13913. return new Tween.prototype.init( elem, options, prop, end, easing );
  13914. }
  13915. jQuery.Tween = Tween;
  13916. Tween.prototype = {
  13917. constructor: Tween,
  13918. init: function( elem, options, prop, end, easing, unit ) {
  13919. this.elem = elem;
  13920. this.prop = prop;
  13921. this.easing = easing || jQuery.easing._default;
  13922. this.options = options;
  13923. this.start = this.now = this.cur();
  13924. this.end = end;
  13925. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  13926. },
  13927. cur: function() {
  13928. var hooks = Tween.propHooks[ this.prop ];
  13929. return hooks && hooks.get ?
  13930. hooks.get( this ) :
  13931. Tween.propHooks._default.get( this );
  13932. },
  13933. run: function( percent ) {
  13934. var eased,
  13935. hooks = Tween.propHooks[ this.prop ];
  13936. if ( this.options.duration ) {
  13937. this.pos = eased = jQuery.easing[ this.easing ](
  13938. percent, this.options.duration * percent, 0, 1, this.options.duration
  13939. );
  13940. } else {
  13941. this.pos = eased = percent;
  13942. }
  13943. this.now = ( this.end - this.start ) * eased + this.start;
  13944. if ( this.options.step ) {
  13945. this.options.step.call( this.elem, this.now, this );
  13946. }
  13947. if ( hooks && hooks.set ) {
  13948. hooks.set( this );
  13949. } else {
  13950. Tween.propHooks._default.set( this );
  13951. }
  13952. return this;
  13953. }
  13954. };
  13955. Tween.prototype.init.prototype = Tween.prototype;
  13956. Tween.propHooks = {
  13957. _default: {
  13958. get: function( tween ) {
  13959. var result;
  13960. // Use a property on the element directly when it is not a DOM element,
  13961. // or when there is no matching style property that exists.
  13962. if ( tween.elem.nodeType !== 1 ||
  13963. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  13964. return tween.elem[ tween.prop ];
  13965. }
  13966. // Passing an empty string as a 3rd parameter to .css will automatically
  13967. // attempt a parseFloat and fallback to a string if the parse fails.
  13968. // Simple values such as "10px" are parsed to Float;
  13969. // complex values such as "rotate(1rad)" are returned as-is.
  13970. result = jQuery.css( tween.elem, tween.prop, "" );
  13971. // Empty strings, null, undefined and "auto" are converted to 0.
  13972. return !result || result === "auto" ? 0 : result;
  13973. },
  13974. set: function( tween ) {
  13975. // Use step hook for back compat.
  13976. // Use cssHook if its there.
  13977. // Use .style if available and use plain properties where available.
  13978. if ( jQuery.fx.step[ tween.prop ] ) {
  13979. jQuery.fx.step[ tween.prop ]( tween );
  13980. } else if ( tween.elem.nodeType === 1 && (
  13981. jQuery.cssHooks[ tween.prop ] ||
  13982. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  13983. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  13984. } else {
  13985. tween.elem[ tween.prop ] = tween.now;
  13986. }
  13987. }
  13988. }
  13989. };
  13990. // Support: IE <=9 only
  13991. // Panic based approach to setting things on disconnected nodes
  13992. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  13993. set: function( tween ) {
  13994. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  13995. tween.elem[ tween.prop ] = tween.now;
  13996. }
  13997. }
  13998. };
  13999. jQuery.easing = {
  14000. linear: function( p ) {
  14001. return p;
  14002. },
  14003. swing: function( p ) {
  14004. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14005. },
  14006. _default: "swing"
  14007. };
  14008. jQuery.fx = Tween.prototype.init;
  14009. // Back compat <1.8 extension point
  14010. jQuery.fx.step = {};
  14011. var
  14012. fxNow, inProgress,
  14013. rfxtypes = /^(?:toggle|show|hide)$/,
  14014. rrun = /queueHooks$/;
  14015. function schedule() {
  14016. if ( inProgress ) {
  14017. if ( document.hidden === false && window.requestAnimationFrame ) {
  14018. window.requestAnimationFrame( schedule );
  14019. } else {
  14020. window.setTimeout( schedule, jQuery.fx.interval );
  14021. }
  14022. jQuery.fx.tick();
  14023. }
  14024. }
  14025. // Animations created synchronously will run synchronously
  14026. function createFxNow() {
  14027. window.setTimeout( function() {
  14028. fxNow = undefined;
  14029. } );
  14030. return ( fxNow = Date.now() );
  14031. }
  14032. // Generate parameters to create a standard animation
  14033. function genFx( type, includeWidth ) {
  14034. var which,
  14035. i = 0,
  14036. attrs = { height: type };
  14037. // If we include width, step value is 1 to do all cssExpand values,
  14038. // otherwise step value is 2 to skip over Left and Right
  14039. includeWidth = includeWidth ? 1 : 0;
  14040. for ( ; i < 4; i += 2 - includeWidth ) {
  14041. which = cssExpand[ i ];
  14042. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14043. }
  14044. if ( includeWidth ) {
  14045. attrs.opacity = attrs.width = type;
  14046. }
  14047. return attrs;
  14048. }
  14049. function createTween( value, prop, animation ) {
  14050. var tween,
  14051. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14052. index = 0,
  14053. length = collection.length;
  14054. for ( ; index < length; index++ ) {
  14055. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14056. // We're done with this property
  14057. return tween;
  14058. }
  14059. }
  14060. }
  14061. function defaultPrefilter( elem, props, opts ) {
  14062. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14063. isBox = "width" in props || "height" in props,
  14064. anim = this,
  14065. orig = {},
  14066. style = elem.style,
  14067. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14068. dataShow = dataPriv.get( elem, "fxshow" );
  14069. // Queue-skipping animations hijack the fx hooks
  14070. if ( !opts.queue ) {
  14071. hooks = jQuery._queueHooks( elem, "fx" );
  14072. if ( hooks.unqueued == null ) {
  14073. hooks.unqueued = 0;
  14074. oldfire = hooks.empty.fire;
  14075. hooks.empty.fire = function() {
  14076. if ( !hooks.unqueued ) {
  14077. oldfire();
  14078. }
  14079. };
  14080. }
  14081. hooks.unqueued++;
  14082. anim.always( function() {
  14083. // Ensure the complete handler is called before this completes
  14084. anim.always( function() {
  14085. hooks.unqueued--;
  14086. if ( !jQuery.queue( elem, "fx" ).length ) {
  14087. hooks.empty.fire();
  14088. }
  14089. } );
  14090. } );
  14091. }
  14092. // Detect show/hide animations
  14093. for ( prop in props ) {
  14094. value = props[ prop ];
  14095. if ( rfxtypes.test( value ) ) {
  14096. delete props[ prop ];
  14097. toggle = toggle || value === "toggle";
  14098. if ( value === ( hidden ? "hide" : "show" ) ) {
  14099. // Pretend to be hidden if this is a "show" and
  14100. // there is still data from a stopped show/hide
  14101. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14102. hidden = true;
  14103. // Ignore all other no-op show/hide data
  14104. } else {
  14105. continue;
  14106. }
  14107. }
  14108. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14109. }
  14110. }
  14111. // Bail out if this is a no-op like .hide().hide()
  14112. propTween = !jQuery.isEmptyObject( props );
  14113. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14114. return;
  14115. }
  14116. // Restrict "overflow" and "display" styles during box animations
  14117. if ( isBox && elem.nodeType === 1 ) {
  14118. // Support: IE <=9 - 11, Edge 12 - 15
  14119. // Record all 3 overflow attributes because IE does not infer the shorthand
  14120. // from identically-valued overflowX and overflowY and Edge just mirrors
  14121. // the overflowX value there.
  14122. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14123. // Identify a display type, preferring old show/hide data over the CSS cascade
  14124. restoreDisplay = dataShow && dataShow.display;
  14125. if ( restoreDisplay == null ) {
  14126. restoreDisplay = dataPriv.get( elem, "display" );
  14127. }
  14128. display = jQuery.css( elem, "display" );
  14129. if ( display === "none" ) {
  14130. if ( restoreDisplay ) {
  14131. display = restoreDisplay;
  14132. } else {
  14133. // Get nonempty value(s) by temporarily forcing visibility
  14134. showHide( [ elem ], true );
  14135. restoreDisplay = elem.style.display || restoreDisplay;
  14136. display = jQuery.css( elem, "display" );
  14137. showHide( [ elem ] );
  14138. }
  14139. }
  14140. // Animate inline elements as inline-block
  14141. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14142. if ( jQuery.css( elem, "float" ) === "none" ) {
  14143. // Restore the original display value at the end of pure show/hide animations
  14144. if ( !propTween ) {
  14145. anim.done( function() {
  14146. style.display = restoreDisplay;
  14147. } );
  14148. if ( restoreDisplay == null ) {
  14149. display = style.display;
  14150. restoreDisplay = display === "none" ? "" : display;
  14151. }
  14152. }
  14153. style.display = "inline-block";
  14154. }
  14155. }
  14156. }
  14157. if ( opts.overflow ) {
  14158. style.overflow = "hidden";
  14159. anim.always( function() {
  14160. style.overflow = opts.overflow[ 0 ];
  14161. style.overflowX = opts.overflow[ 1 ];
  14162. style.overflowY = opts.overflow[ 2 ];
  14163. } );
  14164. }
  14165. // Implement show/hide animations
  14166. propTween = false;
  14167. for ( prop in orig ) {
  14168. // General show/hide setup for this element animation
  14169. if ( !propTween ) {
  14170. if ( dataShow ) {
  14171. if ( "hidden" in dataShow ) {
  14172. hidden = dataShow.hidden;
  14173. }
  14174. } else {
  14175. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14176. }
  14177. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14178. if ( toggle ) {
  14179. dataShow.hidden = !hidden;
  14180. }
  14181. // Show elements before animating them
  14182. if ( hidden ) {
  14183. showHide( [ elem ], true );
  14184. }
  14185. /* eslint-disable no-loop-func */
  14186. anim.done( function() {
  14187. /* eslint-enable no-loop-func */
  14188. // The final step of a "hide" animation is actually hiding the element
  14189. if ( !hidden ) {
  14190. showHide( [ elem ] );
  14191. }
  14192. dataPriv.remove( elem, "fxshow" );
  14193. for ( prop in orig ) {
  14194. jQuery.style( elem, prop, orig[ prop ] );
  14195. }
  14196. } );
  14197. }
  14198. // Per-property setup
  14199. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14200. if ( !( prop in dataShow ) ) {
  14201. dataShow[ prop ] = propTween.start;
  14202. if ( hidden ) {
  14203. propTween.end = propTween.start;
  14204. propTween.start = 0;
  14205. }
  14206. }
  14207. }
  14208. }
  14209. function propFilter( props, specialEasing ) {
  14210. var index, name, easing, value, hooks;
  14211. // camelCase, specialEasing and expand cssHook pass
  14212. for ( index in props ) {
  14213. name = camelCase( index );
  14214. easing = specialEasing[ name ];
  14215. value = props[ index ];
  14216. if ( Array.isArray( value ) ) {
  14217. easing = value[ 1 ];
  14218. value = props[ index ] = value[ 0 ];
  14219. }
  14220. if ( index !== name ) {
  14221. props[ name ] = value;
  14222. delete props[ index ];
  14223. }
  14224. hooks = jQuery.cssHooks[ name ];
  14225. if ( hooks && "expand" in hooks ) {
  14226. value = hooks.expand( value );
  14227. delete props[ name ];
  14228. // Not quite $.extend, this won't overwrite existing keys.
  14229. // Reusing 'index' because we have the correct "name"
  14230. for ( index in value ) {
  14231. if ( !( index in props ) ) {
  14232. props[ index ] = value[ index ];
  14233. specialEasing[ index ] = easing;
  14234. }
  14235. }
  14236. } else {
  14237. specialEasing[ name ] = easing;
  14238. }
  14239. }
  14240. }
  14241. function Animation( elem, properties, options ) {
  14242. var result,
  14243. stopped,
  14244. index = 0,
  14245. length = Animation.prefilters.length,
  14246. deferred = jQuery.Deferred().always( function() {
  14247. // Don't match elem in the :animated selector
  14248. delete tick.elem;
  14249. } ),
  14250. tick = function() {
  14251. if ( stopped ) {
  14252. return false;
  14253. }
  14254. var currentTime = fxNow || createFxNow(),
  14255. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14256. // Support: Android 2.3 only
  14257. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14258. temp = remaining / animation.duration || 0,
  14259. percent = 1 - temp,
  14260. index = 0,
  14261. length = animation.tweens.length;
  14262. for ( ; index < length; index++ ) {
  14263. animation.tweens[ index ].run( percent );
  14264. }
  14265. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14266. // If there's more to do, yield
  14267. if ( percent < 1 && length ) {
  14268. return remaining;
  14269. }
  14270. // If this was an empty animation, synthesize a final progress notification
  14271. if ( !length ) {
  14272. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14273. }
  14274. // Resolve the animation and report its conclusion
  14275. deferred.resolveWith( elem, [ animation ] );
  14276. return false;
  14277. },
  14278. animation = deferred.promise( {
  14279. elem: elem,
  14280. props: jQuery.extend( {}, properties ),
  14281. opts: jQuery.extend( true, {
  14282. specialEasing: {},
  14283. easing: jQuery.easing._default
  14284. }, options ),
  14285. originalProperties: properties,
  14286. originalOptions: options,
  14287. startTime: fxNow || createFxNow(),
  14288. duration: options.duration,
  14289. tweens: [],
  14290. createTween: function( prop, end ) {
  14291. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14292. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14293. animation.tweens.push( tween );
  14294. return tween;
  14295. },
  14296. stop: function( gotoEnd ) {
  14297. var index = 0,
  14298. // If we are going to the end, we want to run all the tweens
  14299. // otherwise we skip this part
  14300. length = gotoEnd ? animation.tweens.length : 0;
  14301. if ( stopped ) {
  14302. return this;
  14303. }
  14304. stopped = true;
  14305. for ( ; index < length; index++ ) {
  14306. animation.tweens[ index ].run( 1 );
  14307. }
  14308. // Resolve when we played the last frame; otherwise, reject
  14309. if ( gotoEnd ) {
  14310. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14311. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14312. } else {
  14313. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14314. }
  14315. return this;
  14316. }
  14317. } ),
  14318. props = animation.props;
  14319. propFilter( props, animation.opts.specialEasing );
  14320. for ( ; index < length; index++ ) {
  14321. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14322. if ( result ) {
  14323. if ( isFunction( result.stop ) ) {
  14324. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14325. result.stop.bind( result );
  14326. }
  14327. return result;
  14328. }
  14329. }
  14330. jQuery.map( props, createTween, animation );
  14331. if ( isFunction( animation.opts.start ) ) {
  14332. animation.opts.start.call( elem, animation );
  14333. }
  14334. // Attach callbacks from options
  14335. animation
  14336. .progress( animation.opts.progress )
  14337. .done( animation.opts.done, animation.opts.complete )
  14338. .fail( animation.opts.fail )
  14339. .always( animation.opts.always );
  14340. jQuery.fx.timer(
  14341. jQuery.extend( tick, {
  14342. elem: elem,
  14343. anim: animation,
  14344. queue: animation.opts.queue
  14345. } )
  14346. );
  14347. return animation;
  14348. }
  14349. jQuery.Animation = jQuery.extend( Animation, {
  14350. tweeners: {
  14351. "*": [ function( prop, value ) {
  14352. var tween = this.createTween( prop, value );
  14353. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14354. return tween;
  14355. } ]
  14356. },
  14357. tweener: function( props, callback ) {
  14358. if ( isFunction( props ) ) {
  14359. callback = props;
  14360. props = [ "*" ];
  14361. } else {
  14362. props = props.match( rnothtmlwhite );
  14363. }
  14364. var prop,
  14365. index = 0,
  14366. length = props.length;
  14367. for ( ; index < length; index++ ) {
  14368. prop = props[ index ];
  14369. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14370. Animation.tweeners[ prop ].unshift( callback );
  14371. }
  14372. },
  14373. prefilters: [ defaultPrefilter ],
  14374. prefilter: function( callback, prepend ) {
  14375. if ( prepend ) {
  14376. Animation.prefilters.unshift( callback );
  14377. } else {
  14378. Animation.prefilters.push( callback );
  14379. }
  14380. }
  14381. } );
  14382. jQuery.speed = function( speed, easing, fn ) {
  14383. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14384. complete: fn || !fn && easing ||
  14385. isFunction( speed ) && speed,
  14386. duration: speed,
  14387. easing: fn && easing || easing && !isFunction( easing ) && easing
  14388. };
  14389. // Go to the end state if fx are off
  14390. if ( jQuery.fx.off ) {
  14391. opt.duration = 0;
  14392. } else {
  14393. if ( typeof opt.duration !== "number" ) {
  14394. if ( opt.duration in jQuery.fx.speeds ) {
  14395. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14396. } else {
  14397. opt.duration = jQuery.fx.speeds._default;
  14398. }
  14399. }
  14400. }
  14401. // Normalize opt.queue - true/undefined/null -> "fx"
  14402. if ( opt.queue == null || opt.queue === true ) {
  14403. opt.queue = "fx";
  14404. }
  14405. // Queueing
  14406. opt.old = opt.complete;
  14407. opt.complete = function() {
  14408. if ( isFunction( opt.old ) ) {
  14409. opt.old.call( this );
  14410. }
  14411. if ( opt.queue ) {
  14412. jQuery.dequeue( this, opt.queue );
  14413. }
  14414. };
  14415. return opt;
  14416. };
  14417. jQuery.fn.extend( {
  14418. fadeTo: function( speed, to, easing, callback ) {
  14419. // Show any hidden elements after setting opacity to 0
  14420. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14421. // Animate to the value specified
  14422. .end().animate( { opacity: to }, speed, easing, callback );
  14423. },
  14424. animate: function( prop, speed, easing, callback ) {
  14425. var empty = jQuery.isEmptyObject( prop ),
  14426. optall = jQuery.speed( speed, easing, callback ),
  14427. doAnimation = function() {
  14428. // Operate on a copy of prop so per-property easing won't be lost
  14429. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14430. // Empty animations, or finishing resolves immediately
  14431. if ( empty || dataPriv.get( this, "finish" ) ) {
  14432. anim.stop( true );
  14433. }
  14434. };
  14435. doAnimation.finish = doAnimation;
  14436. return empty || optall.queue === false ?
  14437. this.each( doAnimation ) :
  14438. this.queue( optall.queue, doAnimation );
  14439. },
  14440. stop: function( type, clearQueue, gotoEnd ) {
  14441. var stopQueue = function( hooks ) {
  14442. var stop = hooks.stop;
  14443. delete hooks.stop;
  14444. stop( gotoEnd );
  14445. };
  14446. if ( typeof type !== "string" ) {
  14447. gotoEnd = clearQueue;
  14448. clearQueue = type;
  14449. type = undefined;
  14450. }
  14451. if ( clearQueue && type !== false ) {
  14452. this.queue( type || "fx", [] );
  14453. }
  14454. return this.each( function() {
  14455. var dequeue = true,
  14456. index = type != null && type + "queueHooks",
  14457. timers = jQuery.timers,
  14458. data = dataPriv.get( this );
  14459. if ( index ) {
  14460. if ( data[ index ] && data[ index ].stop ) {
  14461. stopQueue( data[ index ] );
  14462. }
  14463. } else {
  14464. for ( index in data ) {
  14465. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14466. stopQueue( data[ index ] );
  14467. }
  14468. }
  14469. }
  14470. for ( index = timers.length; index--; ) {
  14471. if ( timers[ index ].elem === this &&
  14472. ( type == null || timers[ index ].queue === type ) ) {
  14473. timers[ index ].anim.stop( gotoEnd );
  14474. dequeue = false;
  14475. timers.splice( index, 1 );
  14476. }
  14477. }
  14478. // Start the next in the queue if the last step wasn't forced.
  14479. // Timers currently will call their complete callbacks, which
  14480. // will dequeue but only if they were gotoEnd.
  14481. if ( dequeue || !gotoEnd ) {
  14482. jQuery.dequeue( this, type );
  14483. }
  14484. } );
  14485. },
  14486. finish: function( type ) {
  14487. if ( type !== false ) {
  14488. type = type || "fx";
  14489. }
  14490. return this.each( function() {
  14491. var index,
  14492. data = dataPriv.get( this ),
  14493. queue = data[ type + "queue" ],
  14494. hooks = data[ type + "queueHooks" ],
  14495. timers = jQuery.timers,
  14496. length = queue ? queue.length : 0;
  14497. // Enable finishing flag on private data
  14498. data.finish = true;
  14499. // Empty the queue first
  14500. jQuery.queue( this, type, [] );
  14501. if ( hooks && hooks.stop ) {
  14502. hooks.stop.call( this, true );
  14503. }
  14504. // Look for any active animations, and finish them
  14505. for ( index = timers.length; index--; ) {
  14506. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14507. timers[ index ].anim.stop( true );
  14508. timers.splice( index, 1 );
  14509. }
  14510. }
  14511. // Look for any animations in the old queue and finish them
  14512. for ( index = 0; index < length; index++ ) {
  14513. if ( queue[ index ] && queue[ index ].finish ) {
  14514. queue[ index ].finish.call( this );
  14515. }
  14516. }
  14517. // Turn off finishing flag
  14518. delete data.finish;
  14519. } );
  14520. }
  14521. } );
  14522. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14523. var cssFn = jQuery.fn[ name ];
  14524. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14525. return speed == null || typeof speed === "boolean" ?
  14526. cssFn.apply( this, arguments ) :
  14527. this.animate( genFx( name, true ), speed, easing, callback );
  14528. };
  14529. } );
  14530. // Generate shortcuts for custom animations
  14531. jQuery.each( {
  14532. slideDown: genFx( "show" ),
  14533. slideUp: genFx( "hide" ),
  14534. slideToggle: genFx( "toggle" ),
  14535. fadeIn: { opacity: "show" },
  14536. fadeOut: { opacity: "hide" },
  14537. fadeToggle: { opacity: "toggle" }
  14538. }, function( name, props ) {
  14539. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14540. return this.animate( props, speed, easing, callback );
  14541. };
  14542. } );
  14543. jQuery.timers = [];
  14544. jQuery.fx.tick = function() {
  14545. var timer,
  14546. i = 0,
  14547. timers = jQuery.timers;
  14548. fxNow = Date.now();
  14549. for ( ; i < timers.length; i++ ) {
  14550. timer = timers[ i ];
  14551. // Run the timer and safely remove it when done (allowing for external removal)
  14552. if ( !timer() && timers[ i ] === timer ) {
  14553. timers.splice( i--, 1 );
  14554. }
  14555. }
  14556. if ( !timers.length ) {
  14557. jQuery.fx.stop();
  14558. }
  14559. fxNow = undefined;
  14560. };
  14561. jQuery.fx.timer = function( timer ) {
  14562. jQuery.timers.push( timer );
  14563. jQuery.fx.start();
  14564. };
  14565. jQuery.fx.interval = 13;
  14566. jQuery.fx.start = function() {
  14567. if ( inProgress ) {
  14568. return;
  14569. }
  14570. inProgress = true;
  14571. schedule();
  14572. };
  14573. jQuery.fx.stop = function() {
  14574. inProgress = null;
  14575. };
  14576. jQuery.fx.speeds = {
  14577. slow: 600,
  14578. fast: 200,
  14579. // Default speed
  14580. _default: 400
  14581. };
  14582. // Based off of the plugin by Clint Helfers, with permission.
  14583. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14584. jQuery.fn.delay = function( time, type ) {
  14585. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14586. type = type || "fx";
  14587. return this.queue( type, function( next, hooks ) {
  14588. var timeout = window.setTimeout( next, time );
  14589. hooks.stop = function() {
  14590. window.clearTimeout( timeout );
  14591. };
  14592. } );
  14593. };
  14594. ( function() {
  14595. var input = document.createElement( "input" ),
  14596. select = document.createElement( "select" ),
  14597. opt = select.appendChild( document.createElement( "option" ) );
  14598. input.type = "checkbox";
  14599. // Support: Android <=4.3 only
  14600. // Default value for a checkbox should be "on"
  14601. support.checkOn = input.value !== "";
  14602. // Support: IE <=11 only
  14603. // Must access selectedIndex to make default options select
  14604. support.optSelected = opt.selected;
  14605. // Support: IE <=11 only
  14606. // An input loses its value after becoming a radio
  14607. input = document.createElement( "input" );
  14608. input.value = "t";
  14609. input.type = "radio";
  14610. support.radioValue = input.value === "t";
  14611. } )();
  14612. var boolHook,
  14613. attrHandle = jQuery.expr.attrHandle;
  14614. jQuery.fn.extend( {
  14615. attr: function( name, value ) {
  14616. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14617. },
  14618. removeAttr: function( name ) {
  14619. return this.each( function() {
  14620. jQuery.removeAttr( this, name );
  14621. } );
  14622. }
  14623. } );
  14624. jQuery.extend( {
  14625. attr: function( elem, name, value ) {
  14626. var ret, hooks,
  14627. nType = elem.nodeType;
  14628. // Don't get/set attributes on text, comment and attribute nodes
  14629. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14630. return;
  14631. }
  14632. // Fallback to prop when attributes are not supported
  14633. if ( typeof elem.getAttribute === "undefined" ) {
  14634. return jQuery.prop( elem, name, value );
  14635. }
  14636. // Attribute hooks are determined by the lowercase version
  14637. // Grab necessary hook if one is defined
  14638. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14639. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14640. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14641. }
  14642. if ( value !== undefined ) {
  14643. if ( value === null ) {
  14644. jQuery.removeAttr( elem, name );
  14645. return;
  14646. }
  14647. if ( hooks && "set" in hooks &&
  14648. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14649. return ret;
  14650. }
  14651. elem.setAttribute( name, value + "" );
  14652. return value;
  14653. }
  14654. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14655. return ret;
  14656. }
  14657. ret = jQuery.find.attr( elem, name );
  14658. // Non-existent attributes return null, we normalize to undefined
  14659. return ret == null ? undefined : ret;
  14660. },
  14661. attrHooks: {
  14662. type: {
  14663. set: function( elem, value ) {
  14664. if ( !support.radioValue && value === "radio" &&
  14665. nodeName( elem, "input" ) ) {
  14666. var val = elem.value;
  14667. elem.setAttribute( "type", value );
  14668. if ( val ) {
  14669. elem.value = val;
  14670. }
  14671. return value;
  14672. }
  14673. }
  14674. }
  14675. },
  14676. removeAttr: function( elem, value ) {
  14677. var name,
  14678. i = 0,
  14679. // Attribute names can contain non-HTML whitespace characters
  14680. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14681. attrNames = value && value.match( rnothtmlwhite );
  14682. if ( attrNames && elem.nodeType === 1 ) {
  14683. while ( ( name = attrNames[ i++ ] ) ) {
  14684. elem.removeAttribute( name );
  14685. }
  14686. }
  14687. }
  14688. } );
  14689. // Hooks for boolean attributes
  14690. boolHook = {
  14691. set: function( elem, value, name ) {
  14692. if ( value === false ) {
  14693. // Remove boolean attributes when set to false
  14694. jQuery.removeAttr( elem, name );
  14695. } else {
  14696. elem.setAttribute( name, name );
  14697. }
  14698. return name;
  14699. }
  14700. };
  14701. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14702. var getter = attrHandle[ name ] || jQuery.find.attr;
  14703. attrHandle[ name ] = function( elem, name, isXML ) {
  14704. var ret, handle,
  14705. lowercaseName = name.toLowerCase();
  14706. if ( !isXML ) {
  14707. // Avoid an infinite loop by temporarily removing this function from the getter
  14708. handle = attrHandle[ lowercaseName ];
  14709. attrHandle[ lowercaseName ] = ret;
  14710. ret = getter( elem, name, isXML ) != null ?
  14711. lowercaseName :
  14712. null;
  14713. attrHandle[ lowercaseName ] = handle;
  14714. }
  14715. return ret;
  14716. };
  14717. } );
  14718. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14719. rclickable = /^(?:a|area)$/i;
  14720. jQuery.fn.extend( {
  14721. prop: function( name, value ) {
  14722. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14723. },
  14724. removeProp: function( name ) {
  14725. return this.each( function() {
  14726. delete this[ jQuery.propFix[ name ] || name ];
  14727. } );
  14728. }
  14729. } );
  14730. jQuery.extend( {
  14731. prop: function( elem, name, value ) {
  14732. var ret, hooks,
  14733. nType = elem.nodeType;
  14734. // Don't get/set properties on text, comment and attribute nodes
  14735. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14736. return;
  14737. }
  14738. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14739. // Fix name and attach hooks
  14740. name = jQuery.propFix[ name ] || name;
  14741. hooks = jQuery.propHooks[ name ];
  14742. }
  14743. if ( value !== undefined ) {
  14744. if ( hooks && "set" in hooks &&
  14745. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14746. return ret;
  14747. }
  14748. return ( elem[ name ] = value );
  14749. }
  14750. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14751. return ret;
  14752. }
  14753. return elem[ name ];
  14754. },
  14755. propHooks: {
  14756. tabIndex: {
  14757. get: function( elem ) {
  14758. // Support: IE <=9 - 11 only
  14759. // elem.tabIndex doesn't always return the
  14760. // correct value when it hasn't been explicitly set
  14761. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  14762. // Use proper attribute retrieval(#12072)
  14763. var tabindex = jQuery.find.attr( elem, "tabindex" );
  14764. if ( tabindex ) {
  14765. return parseInt( tabindex, 10 );
  14766. }
  14767. if (
  14768. rfocusable.test( elem.nodeName ) ||
  14769. rclickable.test( elem.nodeName ) &&
  14770. elem.href
  14771. ) {
  14772. return 0;
  14773. }
  14774. return -1;
  14775. }
  14776. }
  14777. },
  14778. propFix: {
  14779. "for": "htmlFor",
  14780. "class": "className"
  14781. }
  14782. } );
  14783. // Support: IE <=11 only
  14784. // Accessing the selectedIndex property
  14785. // forces the browser to respect setting selected
  14786. // on the option
  14787. // The getter ensures a default option is selected
  14788. // when in an optgroup
  14789. // eslint rule "no-unused-expressions" is disabled for this code
  14790. // since it considers such accessions noop
  14791. if ( !support.optSelected ) {
  14792. jQuery.propHooks.selected = {
  14793. get: function( elem ) {
  14794. /* eslint no-unused-expressions: "off" */
  14795. var parent = elem.parentNode;
  14796. if ( parent && parent.parentNode ) {
  14797. parent.parentNode.selectedIndex;
  14798. }
  14799. return null;
  14800. },
  14801. set: function( elem ) {
  14802. /* eslint no-unused-expressions: "off" */
  14803. var parent = elem.parentNode;
  14804. if ( parent ) {
  14805. parent.selectedIndex;
  14806. if ( parent.parentNode ) {
  14807. parent.parentNode.selectedIndex;
  14808. }
  14809. }
  14810. }
  14811. };
  14812. }
  14813. jQuery.each( [
  14814. "tabIndex",
  14815. "readOnly",
  14816. "maxLength",
  14817. "cellSpacing",
  14818. "cellPadding",
  14819. "rowSpan",
  14820. "colSpan",
  14821. "useMap",
  14822. "frameBorder",
  14823. "contentEditable"
  14824. ], function() {
  14825. jQuery.propFix[ this.toLowerCase() ] = this;
  14826. } );
  14827. // Strip and collapse whitespace according to HTML spec
  14828. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  14829. function stripAndCollapse( value ) {
  14830. var tokens = value.match( rnothtmlwhite ) || [];
  14831. return tokens.join( " " );
  14832. }
  14833. function getClass( elem ) {
  14834. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  14835. }
  14836. function classesToArray( value ) {
  14837. if ( Array.isArray( value ) ) {
  14838. return value;
  14839. }
  14840. if ( typeof value === "string" ) {
  14841. return value.match( rnothtmlwhite ) || [];
  14842. }
  14843. return [];
  14844. }
  14845. jQuery.fn.extend( {
  14846. addClass: function( value ) {
  14847. var classes, elem, cur, curValue, clazz, j, finalValue,
  14848. i = 0;
  14849. if ( isFunction( value ) ) {
  14850. return this.each( function( j ) {
  14851. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  14852. } );
  14853. }
  14854. classes = classesToArray( value );
  14855. if ( classes.length ) {
  14856. while ( ( elem = this[ i++ ] ) ) {
  14857. curValue = getClass( elem );
  14858. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14859. if ( cur ) {
  14860. j = 0;
  14861. while ( ( clazz = classes[ j++ ] ) ) {
  14862. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  14863. cur += clazz + " ";
  14864. }
  14865. }
  14866. // Only assign if different to avoid unneeded rendering.
  14867. finalValue = stripAndCollapse( cur );
  14868. if ( curValue !== finalValue ) {
  14869. elem.setAttribute( "class", finalValue );
  14870. }
  14871. }
  14872. }
  14873. }
  14874. return this;
  14875. },
  14876. removeClass: function( value ) {
  14877. var classes, elem, cur, curValue, clazz, j, finalValue,
  14878. i = 0;
  14879. if ( isFunction( value ) ) {
  14880. return this.each( function( j ) {
  14881. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  14882. } );
  14883. }
  14884. if ( !arguments.length ) {
  14885. return this.attr( "class", "" );
  14886. }
  14887. classes = classesToArray( value );
  14888. if ( classes.length ) {
  14889. while ( ( elem = this[ i++ ] ) ) {
  14890. curValue = getClass( elem );
  14891. // This expression is here for better compressibility (see addClass)
  14892. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14893. if ( cur ) {
  14894. j = 0;
  14895. while ( ( clazz = classes[ j++ ] ) ) {
  14896. // Remove *all* instances
  14897. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  14898. cur = cur.replace( " " + clazz + " ", " " );
  14899. }
  14900. }
  14901. // Only assign if different to avoid unneeded rendering.
  14902. finalValue = stripAndCollapse( cur );
  14903. if ( curValue !== finalValue ) {
  14904. elem.setAttribute( "class", finalValue );
  14905. }
  14906. }
  14907. }
  14908. }
  14909. return this;
  14910. },
  14911. toggleClass: function( value, stateVal ) {
  14912. var type = typeof value,
  14913. isValidValue = type === "string" || Array.isArray( value );
  14914. if ( typeof stateVal === "boolean" && isValidValue ) {
  14915. return stateVal ? this.addClass( value ) : this.removeClass( value );
  14916. }
  14917. if ( isFunction( value ) ) {
  14918. return this.each( function( i ) {
  14919. jQuery( this ).toggleClass(
  14920. value.call( this, i, getClass( this ), stateVal ),
  14921. stateVal
  14922. );
  14923. } );
  14924. }
  14925. return this.each( function() {
  14926. var className, i, self, classNames;
  14927. if ( isValidValue ) {
  14928. // Toggle individual class names
  14929. i = 0;
  14930. self = jQuery( this );
  14931. classNames = classesToArray( value );
  14932. while ( ( className = classNames[ i++ ] ) ) {
  14933. // Check each className given, space separated list
  14934. if ( self.hasClass( className ) ) {
  14935. self.removeClass( className );
  14936. } else {
  14937. self.addClass( className );
  14938. }
  14939. }
  14940. // Toggle whole class name
  14941. } else if ( value === undefined || type === "boolean" ) {
  14942. className = getClass( this );
  14943. if ( className ) {
  14944. // Store className if set
  14945. dataPriv.set( this, "__className__", className );
  14946. }
  14947. // If the element has a class name or if we're passed `false`,
  14948. // then remove the whole classname (if there was one, the above saved it).
  14949. // Otherwise bring back whatever was previously saved (if anything),
  14950. // falling back to the empty string if nothing was stored.
  14951. if ( this.setAttribute ) {
  14952. this.setAttribute( "class",
  14953. className || value === false ?
  14954. "" :
  14955. dataPriv.get( this, "__className__" ) || ""
  14956. );
  14957. }
  14958. }
  14959. } );
  14960. },
  14961. hasClass: function( selector ) {
  14962. var className, elem,
  14963. i = 0;
  14964. className = " " + selector + " ";
  14965. while ( ( elem = this[ i++ ] ) ) {
  14966. if ( elem.nodeType === 1 &&
  14967. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  14968. return true;
  14969. }
  14970. }
  14971. return false;
  14972. }
  14973. } );
  14974. var rreturn = /\r/g;
  14975. jQuery.fn.extend( {
  14976. val: function( value ) {
  14977. var hooks, ret, valueIsFunction,
  14978. elem = this[ 0 ];
  14979. if ( !arguments.length ) {
  14980. if ( elem ) {
  14981. hooks = jQuery.valHooks[ elem.type ] ||
  14982. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  14983. if ( hooks &&
  14984. "get" in hooks &&
  14985. ( ret = hooks.get( elem, "value" ) ) !== undefined
  14986. ) {
  14987. return ret;
  14988. }
  14989. ret = elem.value;
  14990. // Handle most common string cases
  14991. if ( typeof ret === "string" ) {
  14992. return ret.replace( rreturn, "" );
  14993. }
  14994. // Handle cases where value is null/undef or number
  14995. return ret == null ? "" : ret;
  14996. }
  14997. return;
  14998. }
  14999. valueIsFunction = isFunction( value );
  15000. return this.each( function( i ) {
  15001. var val;
  15002. if ( this.nodeType !== 1 ) {
  15003. return;
  15004. }
  15005. if ( valueIsFunction ) {
  15006. val = value.call( this, i, jQuery( this ).val() );
  15007. } else {
  15008. val = value;
  15009. }
  15010. // Treat null/undefined as ""; convert numbers to string
  15011. if ( val == null ) {
  15012. val = "";
  15013. } else if ( typeof val === "number" ) {
  15014. val += "";
  15015. } else if ( Array.isArray( val ) ) {
  15016. val = jQuery.map( val, function( value ) {
  15017. return value == null ? "" : value + "";
  15018. } );
  15019. }
  15020. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15021. // If set returns undefined, fall back to normal setting
  15022. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15023. this.value = val;
  15024. }
  15025. } );
  15026. }
  15027. } );
  15028. jQuery.extend( {
  15029. valHooks: {
  15030. option: {
  15031. get: function( elem ) {
  15032. var val = jQuery.find.attr( elem, "value" );
  15033. return val != null ?
  15034. val :
  15035. // Support: IE <=10 - 11 only
  15036. // option.text throws exceptions (#14686, #14858)
  15037. // Strip and collapse whitespace
  15038. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15039. stripAndCollapse( jQuery.text( elem ) );
  15040. }
  15041. },
  15042. select: {
  15043. get: function( elem ) {
  15044. var value, option, i,
  15045. options = elem.options,
  15046. index = elem.selectedIndex,
  15047. one = elem.type === "select-one",
  15048. values = one ? null : [],
  15049. max = one ? index + 1 : options.length;
  15050. if ( index < 0 ) {
  15051. i = max;
  15052. } else {
  15053. i = one ? index : 0;
  15054. }
  15055. // Loop through all the selected options
  15056. for ( ; i < max; i++ ) {
  15057. option = options[ i ];
  15058. // Support: IE <=9 only
  15059. // IE8-9 doesn't update selected after form reset (#2551)
  15060. if ( ( option.selected || i === index ) &&
  15061. // Don't return options that are disabled or in a disabled optgroup
  15062. !option.disabled &&
  15063. ( !option.parentNode.disabled ||
  15064. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15065. // Get the specific value for the option
  15066. value = jQuery( option ).val();
  15067. // We don't need an array for one selects
  15068. if ( one ) {
  15069. return value;
  15070. }
  15071. // Multi-Selects return an array
  15072. values.push( value );
  15073. }
  15074. }
  15075. return values;
  15076. },
  15077. set: function( elem, value ) {
  15078. var optionSet, option,
  15079. options = elem.options,
  15080. values = jQuery.makeArray( value ),
  15081. i = options.length;
  15082. while ( i-- ) {
  15083. option = options[ i ];
  15084. /* eslint-disable no-cond-assign */
  15085. if ( option.selected =
  15086. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15087. ) {
  15088. optionSet = true;
  15089. }
  15090. /* eslint-enable no-cond-assign */
  15091. }
  15092. // Force browsers to behave consistently when non-matching value is set
  15093. if ( !optionSet ) {
  15094. elem.selectedIndex = -1;
  15095. }
  15096. return values;
  15097. }
  15098. }
  15099. }
  15100. } );
  15101. // Radios and checkboxes getter/setter
  15102. jQuery.each( [ "radio", "checkbox" ], function() {
  15103. jQuery.valHooks[ this ] = {
  15104. set: function( elem, value ) {
  15105. if ( Array.isArray( value ) ) {
  15106. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15107. }
  15108. }
  15109. };
  15110. if ( !support.checkOn ) {
  15111. jQuery.valHooks[ this ].get = function( elem ) {
  15112. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15113. };
  15114. }
  15115. } );
  15116. // Return jQuery for attributes-only inclusion
  15117. support.focusin = "onfocusin" in window;
  15118. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15119. stopPropagationCallback = function( e ) {
  15120. e.stopPropagation();
  15121. };
  15122. jQuery.extend( jQuery.event, {
  15123. trigger: function( event, data, elem, onlyHandlers ) {
  15124. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15125. eventPath = [ elem || document ],
  15126. type = hasOwn.call( event, "type" ) ? event.type : event,
  15127. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15128. cur = lastElement = tmp = elem = elem || document;
  15129. // Don't do events on text and comment nodes
  15130. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15131. return;
  15132. }
  15133. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15134. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15135. return;
  15136. }
  15137. if ( type.indexOf( "." ) > -1 ) {
  15138. // Namespaced trigger; create a regexp to match event type in handle()
  15139. namespaces = type.split( "." );
  15140. type = namespaces.shift();
  15141. namespaces.sort();
  15142. }
  15143. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15144. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15145. event = event[ jQuery.expando ] ?
  15146. event :
  15147. new jQuery.Event( type, typeof event === "object" && event );
  15148. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15149. event.isTrigger = onlyHandlers ? 2 : 3;
  15150. event.namespace = namespaces.join( "." );
  15151. event.rnamespace = event.namespace ?
  15152. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15153. null;
  15154. // Clean up the event in case it is being reused
  15155. event.result = undefined;
  15156. if ( !event.target ) {
  15157. event.target = elem;
  15158. }
  15159. // Clone any incoming data and prepend the event, creating the handler arg list
  15160. data = data == null ?
  15161. [ event ] :
  15162. jQuery.makeArray( data, [ event ] );
  15163. // Allow special events to draw outside the lines
  15164. special = jQuery.event.special[ type ] || {};
  15165. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15166. return;
  15167. }
  15168. // Determine event propagation path in advance, per W3C events spec (#9951)
  15169. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15170. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15171. bubbleType = special.delegateType || type;
  15172. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15173. cur = cur.parentNode;
  15174. }
  15175. for ( ; cur; cur = cur.parentNode ) {
  15176. eventPath.push( cur );
  15177. tmp = cur;
  15178. }
  15179. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15180. if ( tmp === ( elem.ownerDocument || document ) ) {
  15181. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15182. }
  15183. }
  15184. // Fire handlers on the event path
  15185. i = 0;
  15186. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15187. lastElement = cur;
  15188. event.type = i > 1 ?
  15189. bubbleType :
  15190. special.bindType || type;
  15191. // jQuery handler
  15192. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15193. dataPriv.get( cur, "handle" );
  15194. if ( handle ) {
  15195. handle.apply( cur, data );
  15196. }
  15197. // Native handler
  15198. handle = ontype && cur[ ontype ];
  15199. if ( handle && handle.apply && acceptData( cur ) ) {
  15200. event.result = handle.apply( cur, data );
  15201. if ( event.result === false ) {
  15202. event.preventDefault();
  15203. }
  15204. }
  15205. }
  15206. event.type = type;
  15207. // If nobody prevented the default action, do it now
  15208. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15209. if ( ( !special._default ||
  15210. special._default.apply( eventPath.pop(), data ) === false ) &&
  15211. acceptData( elem ) ) {
  15212. // Call a native DOM method on the target with the same name as the event.
  15213. // Don't do default actions on window, that's where global variables be (#6170)
  15214. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15215. // Don't re-trigger an onFOO event when we call its FOO() method
  15216. tmp = elem[ ontype ];
  15217. if ( tmp ) {
  15218. elem[ ontype ] = null;
  15219. }
  15220. // Prevent re-triggering of the same event, since we already bubbled it above
  15221. jQuery.event.triggered = type;
  15222. if ( event.isPropagationStopped() ) {
  15223. lastElement.addEventListener( type, stopPropagationCallback );
  15224. }
  15225. elem[ type ]();
  15226. if ( event.isPropagationStopped() ) {
  15227. lastElement.removeEventListener( type, stopPropagationCallback );
  15228. }
  15229. jQuery.event.triggered = undefined;
  15230. if ( tmp ) {
  15231. elem[ ontype ] = tmp;
  15232. }
  15233. }
  15234. }
  15235. }
  15236. return event.result;
  15237. },
  15238. // Piggyback on a donor event to simulate a different one
  15239. // Used only for `focus(in | out)` events
  15240. simulate: function( type, elem, event ) {
  15241. var e = jQuery.extend(
  15242. new jQuery.Event(),
  15243. event,
  15244. {
  15245. type: type,
  15246. isSimulated: true
  15247. }
  15248. );
  15249. jQuery.event.trigger( e, null, elem );
  15250. }
  15251. } );
  15252. jQuery.fn.extend( {
  15253. trigger: function( type, data ) {
  15254. return this.each( function() {
  15255. jQuery.event.trigger( type, data, this );
  15256. } );
  15257. },
  15258. triggerHandler: function( type, data ) {
  15259. var elem = this[ 0 ];
  15260. if ( elem ) {
  15261. return jQuery.event.trigger( type, data, elem, true );
  15262. }
  15263. }
  15264. } );
  15265. // Support: Firefox <=44
  15266. // Firefox doesn't have focus(in | out) events
  15267. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15268. //
  15269. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15270. // focus(in | out) events fire after focus & blur events,
  15271. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15272. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15273. if ( !support.focusin ) {
  15274. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15275. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15276. var handler = function( event ) {
  15277. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15278. };
  15279. jQuery.event.special[ fix ] = {
  15280. setup: function() {
  15281. var doc = this.ownerDocument || this,
  15282. attaches = dataPriv.access( doc, fix );
  15283. if ( !attaches ) {
  15284. doc.addEventListener( orig, handler, true );
  15285. }
  15286. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15287. },
  15288. teardown: function() {
  15289. var doc = this.ownerDocument || this,
  15290. attaches = dataPriv.access( doc, fix ) - 1;
  15291. if ( !attaches ) {
  15292. doc.removeEventListener( orig, handler, true );
  15293. dataPriv.remove( doc, fix );
  15294. } else {
  15295. dataPriv.access( doc, fix, attaches );
  15296. }
  15297. }
  15298. };
  15299. } );
  15300. }
  15301. var location = window.location;
  15302. var nonce = Date.now();
  15303. var rquery = ( /\?/ );
  15304. // Cross-browser xml parsing
  15305. jQuery.parseXML = function( data ) {
  15306. var xml;
  15307. if ( !data || typeof data !== "string" ) {
  15308. return null;
  15309. }
  15310. // Support: IE 9 - 11 only
  15311. // IE throws on parseFromString with invalid input.
  15312. try {
  15313. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15314. } catch ( e ) {
  15315. xml = undefined;
  15316. }
  15317. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15318. jQuery.error( "Invalid XML: " + data );
  15319. }
  15320. return xml;
  15321. };
  15322. var
  15323. rbracket = /\[\]$/,
  15324. rCRLF = /\r?\n/g,
  15325. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15326. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15327. function buildParams( prefix, obj, traditional, add ) {
  15328. var name;
  15329. if ( Array.isArray( obj ) ) {
  15330. // Serialize array item.
  15331. jQuery.each( obj, function( i, v ) {
  15332. if ( traditional || rbracket.test( prefix ) ) {
  15333. // Treat each array item as a scalar.
  15334. add( prefix, v );
  15335. } else {
  15336. // Item is non-scalar (array or object), encode its numeric index.
  15337. buildParams(
  15338. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15339. v,
  15340. traditional,
  15341. add
  15342. );
  15343. }
  15344. } );
  15345. } else if ( !traditional && toType( obj ) === "object" ) {
  15346. // Serialize object item.
  15347. for ( name in obj ) {
  15348. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15349. }
  15350. } else {
  15351. // Serialize scalar item.
  15352. add( prefix, obj );
  15353. }
  15354. }
  15355. // Serialize an array of form elements or a set of
  15356. // key/values into a query string
  15357. jQuery.param = function( a, traditional ) {
  15358. var prefix,
  15359. s = [],
  15360. add = function( key, valueOrFunction ) {
  15361. // If value is a function, invoke it and use its return value
  15362. var value = isFunction( valueOrFunction ) ?
  15363. valueOrFunction() :
  15364. valueOrFunction;
  15365. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15366. encodeURIComponent( value == null ? "" : value );
  15367. };
  15368. if ( a == null ) {
  15369. return "";
  15370. }
  15371. // If an array was passed in, assume that it is an array of form elements.
  15372. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15373. // Serialize the form elements
  15374. jQuery.each( a, function() {
  15375. add( this.name, this.value );
  15376. } );
  15377. } else {
  15378. // If traditional, encode the "old" way (the way 1.3.2 or older
  15379. // did it), otherwise encode params recursively.
  15380. for ( prefix in a ) {
  15381. buildParams( prefix, a[ prefix ], traditional, add );
  15382. }
  15383. }
  15384. // Return the resulting serialization
  15385. return s.join( "&" );
  15386. };
  15387. jQuery.fn.extend( {
  15388. serialize: function() {
  15389. return jQuery.param( this.serializeArray() );
  15390. },
  15391. serializeArray: function() {
  15392. return this.map( function() {
  15393. // Can add propHook for "elements" to filter or add form elements
  15394. var elements = jQuery.prop( this, "elements" );
  15395. return elements ? jQuery.makeArray( elements ) : this;
  15396. } )
  15397. .filter( function() {
  15398. var type = this.type;
  15399. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15400. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15401. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15402. ( this.checked || !rcheckableType.test( type ) );
  15403. } )
  15404. .map( function( i, elem ) {
  15405. var val = jQuery( this ).val();
  15406. if ( val == null ) {
  15407. return null;
  15408. }
  15409. if ( Array.isArray( val ) ) {
  15410. return jQuery.map( val, function( val ) {
  15411. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15412. } );
  15413. }
  15414. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15415. } ).get();
  15416. }
  15417. } );
  15418. var
  15419. r20 = /%20/g,
  15420. rhash = /#.*$/,
  15421. rantiCache = /([?&])_=[^&]*/,
  15422. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15423. // #7653, #8125, #8152: local protocol detection
  15424. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15425. rnoContent = /^(?:GET|HEAD)$/,
  15426. rprotocol = /^\/\//,
  15427. /* Prefilters
  15428. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15429. * 2) These are called:
  15430. * - BEFORE asking for a transport
  15431. * - AFTER param serialization (s.data is a string if s.processData is true)
  15432. * 3) key is the dataType
  15433. * 4) the catchall symbol "*" can be used
  15434. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15435. */
  15436. prefilters = {},
  15437. /* Transports bindings
  15438. * 1) key is the dataType
  15439. * 2) the catchall symbol "*" can be used
  15440. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15441. */
  15442. transports = {},
  15443. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15444. allTypes = "*/".concat( "*" ),
  15445. // Anchor tag for parsing the document origin
  15446. originAnchor = document.createElement( "a" );
  15447. originAnchor.href = location.href;
  15448. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15449. function addToPrefiltersOrTransports( structure ) {
  15450. // dataTypeExpression is optional and defaults to "*"
  15451. return function( dataTypeExpression, func ) {
  15452. if ( typeof dataTypeExpression !== "string" ) {
  15453. func = dataTypeExpression;
  15454. dataTypeExpression = "*";
  15455. }
  15456. var dataType,
  15457. i = 0,
  15458. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15459. if ( isFunction( func ) ) {
  15460. // For each dataType in the dataTypeExpression
  15461. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15462. // Prepend if requested
  15463. if ( dataType[ 0 ] === "+" ) {
  15464. dataType = dataType.slice( 1 ) || "*";
  15465. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15466. // Otherwise append
  15467. } else {
  15468. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15469. }
  15470. }
  15471. }
  15472. };
  15473. }
  15474. // Base inspection function for prefilters and transports
  15475. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15476. var inspected = {},
  15477. seekingTransport = ( structure === transports );
  15478. function inspect( dataType ) {
  15479. var selected;
  15480. inspected[ dataType ] = true;
  15481. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15482. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15483. if ( typeof dataTypeOrTransport === "string" &&
  15484. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15485. options.dataTypes.unshift( dataTypeOrTransport );
  15486. inspect( dataTypeOrTransport );
  15487. return false;
  15488. } else if ( seekingTransport ) {
  15489. return !( selected = dataTypeOrTransport );
  15490. }
  15491. } );
  15492. return selected;
  15493. }
  15494. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15495. }
  15496. // A special extend for ajax options
  15497. // that takes "flat" options (not to be deep extended)
  15498. // Fixes #9887
  15499. function ajaxExtend( target, src ) {
  15500. var key, deep,
  15501. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15502. for ( key in src ) {
  15503. if ( src[ key ] !== undefined ) {
  15504. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15505. }
  15506. }
  15507. if ( deep ) {
  15508. jQuery.extend( true, target, deep );
  15509. }
  15510. return target;
  15511. }
  15512. /* Handles responses to an ajax request:
  15513. * - finds the right dataType (mediates between content-type and expected dataType)
  15514. * - returns the corresponding response
  15515. */
  15516. function ajaxHandleResponses( s, jqXHR, responses ) {
  15517. var ct, type, finalDataType, firstDataType,
  15518. contents = s.contents,
  15519. dataTypes = s.dataTypes;
  15520. // Remove auto dataType and get content-type in the process
  15521. while ( dataTypes[ 0 ] === "*" ) {
  15522. dataTypes.shift();
  15523. if ( ct === undefined ) {
  15524. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15525. }
  15526. }
  15527. // Check if we're dealing with a known content-type
  15528. if ( ct ) {
  15529. for ( type in contents ) {
  15530. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15531. dataTypes.unshift( type );
  15532. break;
  15533. }
  15534. }
  15535. }
  15536. // Check to see if we have a response for the expected dataType
  15537. if ( dataTypes[ 0 ] in responses ) {
  15538. finalDataType = dataTypes[ 0 ];
  15539. } else {
  15540. // Try convertible dataTypes
  15541. for ( type in responses ) {
  15542. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15543. finalDataType = type;
  15544. break;
  15545. }
  15546. if ( !firstDataType ) {
  15547. firstDataType = type;
  15548. }
  15549. }
  15550. // Or just use first one
  15551. finalDataType = finalDataType || firstDataType;
  15552. }
  15553. // If we found a dataType
  15554. // We add the dataType to the list if needed
  15555. // and return the corresponding response
  15556. if ( finalDataType ) {
  15557. if ( finalDataType !== dataTypes[ 0 ] ) {
  15558. dataTypes.unshift( finalDataType );
  15559. }
  15560. return responses[ finalDataType ];
  15561. }
  15562. }
  15563. /* Chain conversions given the request and the original response
  15564. * Also sets the responseXXX fields on the jqXHR instance
  15565. */
  15566. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15567. var conv2, current, conv, tmp, prev,
  15568. converters = {},
  15569. // Work with a copy of dataTypes in case we need to modify it for conversion
  15570. dataTypes = s.dataTypes.slice();
  15571. // Create converters map with lowercased keys
  15572. if ( dataTypes[ 1 ] ) {
  15573. for ( conv in s.converters ) {
  15574. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15575. }
  15576. }
  15577. current = dataTypes.shift();
  15578. // Convert to each sequential dataType
  15579. while ( current ) {
  15580. if ( s.responseFields[ current ] ) {
  15581. jqXHR[ s.responseFields[ current ] ] = response;
  15582. }
  15583. // Apply the dataFilter if provided
  15584. if ( !prev && isSuccess && s.dataFilter ) {
  15585. response = s.dataFilter( response, s.dataType );
  15586. }
  15587. prev = current;
  15588. current = dataTypes.shift();
  15589. if ( current ) {
  15590. // There's only work to do if current dataType is non-auto
  15591. if ( current === "*" ) {
  15592. current = prev;
  15593. // Convert response if prev dataType is non-auto and differs from current
  15594. } else if ( prev !== "*" && prev !== current ) {
  15595. // Seek a direct converter
  15596. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15597. // If none found, seek a pair
  15598. if ( !conv ) {
  15599. for ( conv2 in converters ) {
  15600. // If conv2 outputs current
  15601. tmp = conv2.split( " " );
  15602. if ( tmp[ 1 ] === current ) {
  15603. // If prev can be converted to accepted input
  15604. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15605. converters[ "* " + tmp[ 0 ] ];
  15606. if ( conv ) {
  15607. // Condense equivalence converters
  15608. if ( conv === true ) {
  15609. conv = converters[ conv2 ];
  15610. // Otherwise, insert the intermediate dataType
  15611. } else if ( converters[ conv2 ] !== true ) {
  15612. current = tmp[ 0 ];
  15613. dataTypes.unshift( tmp[ 1 ] );
  15614. }
  15615. break;
  15616. }
  15617. }
  15618. }
  15619. }
  15620. // Apply converter (if not an equivalence)
  15621. if ( conv !== true ) {
  15622. // Unless errors are allowed to bubble, catch and return them
  15623. if ( conv && s.throws ) {
  15624. response = conv( response );
  15625. } else {
  15626. try {
  15627. response = conv( response );
  15628. } catch ( e ) {
  15629. return {
  15630. state: "parsererror",
  15631. error: conv ? e : "No conversion from " + prev + " to " + current
  15632. };
  15633. }
  15634. }
  15635. }
  15636. }
  15637. }
  15638. }
  15639. return { state: "success", data: response };
  15640. }
  15641. jQuery.extend( {
  15642. // Counter for holding the number of active queries
  15643. active: 0,
  15644. // Last-Modified header cache for next request
  15645. lastModified: {},
  15646. etag: {},
  15647. ajaxSettings: {
  15648. url: location.href,
  15649. type: "GET",
  15650. isLocal: rlocalProtocol.test( location.protocol ),
  15651. global: true,
  15652. processData: true,
  15653. async: true,
  15654. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15655. /*
  15656. timeout: 0,
  15657. data: null,
  15658. dataType: null,
  15659. username: null,
  15660. password: null,
  15661. cache: null,
  15662. throws: false,
  15663. traditional: false,
  15664. headers: {},
  15665. */
  15666. accepts: {
  15667. "*": allTypes,
  15668. text: "text/plain",
  15669. html: "text/html",
  15670. xml: "application/xml, text/xml",
  15671. json: "application/json, text/javascript"
  15672. },
  15673. contents: {
  15674. xml: /\bxml\b/,
  15675. html: /\bhtml/,
  15676. json: /\bjson\b/
  15677. },
  15678. responseFields: {
  15679. xml: "responseXML",
  15680. text: "responseText",
  15681. json: "responseJSON"
  15682. },
  15683. // Data converters
  15684. // Keys separate source (or catchall "*") and destination types with a single space
  15685. converters: {
  15686. // Convert anything to text
  15687. "* text": String,
  15688. // Text to html (true = no transformation)
  15689. "text html": true,
  15690. // Evaluate text as a json expression
  15691. "text json": JSON.parse,
  15692. // Parse text as xml
  15693. "text xml": jQuery.parseXML
  15694. },
  15695. // For options that shouldn't be deep extended:
  15696. // you can add your own custom options here if
  15697. // and when you create one that shouldn't be
  15698. // deep extended (see ajaxExtend)
  15699. flatOptions: {
  15700. url: true,
  15701. context: true
  15702. }
  15703. },
  15704. // Creates a full fledged settings object into target
  15705. // with both ajaxSettings and settings fields.
  15706. // If target is omitted, writes into ajaxSettings.
  15707. ajaxSetup: function( target, settings ) {
  15708. return settings ?
  15709. // Building a settings object
  15710. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15711. // Extending ajaxSettings
  15712. ajaxExtend( jQuery.ajaxSettings, target );
  15713. },
  15714. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15715. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15716. // Main method
  15717. ajax: function( url, options ) {
  15718. // If url is an object, simulate pre-1.5 signature
  15719. if ( typeof url === "object" ) {
  15720. options = url;
  15721. url = undefined;
  15722. }
  15723. // Force options to be an object
  15724. options = options || {};
  15725. var transport,
  15726. // URL without anti-cache param
  15727. cacheURL,
  15728. // Response headers
  15729. responseHeadersString,
  15730. responseHeaders,
  15731. // timeout handle
  15732. timeoutTimer,
  15733. // Url cleanup var
  15734. urlAnchor,
  15735. // Request state (becomes false upon send and true upon completion)
  15736. completed,
  15737. // To know if global events are to be dispatched
  15738. fireGlobals,
  15739. // Loop variable
  15740. i,
  15741. // uncached part of the url
  15742. uncached,
  15743. // Create the final options object
  15744. s = jQuery.ajaxSetup( {}, options ),
  15745. // Callbacks context
  15746. callbackContext = s.context || s,
  15747. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  15748. globalEventContext = s.context &&
  15749. ( callbackContext.nodeType || callbackContext.jquery ) ?
  15750. jQuery( callbackContext ) :
  15751. jQuery.event,
  15752. // Deferreds
  15753. deferred = jQuery.Deferred(),
  15754. completeDeferred = jQuery.Callbacks( "once memory" ),
  15755. // Status-dependent callbacks
  15756. statusCode = s.statusCode || {},
  15757. // Headers (they are sent all at once)
  15758. requestHeaders = {},
  15759. requestHeadersNames = {},
  15760. // Default abort message
  15761. strAbort = "canceled",
  15762. // Fake xhr
  15763. jqXHR = {
  15764. readyState: 0,
  15765. // Builds headers hashtable if needed
  15766. getResponseHeader: function( key ) {
  15767. var match;
  15768. if ( completed ) {
  15769. if ( !responseHeaders ) {
  15770. responseHeaders = {};
  15771. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  15772. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  15773. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  15774. .concat( match[ 2 ] );
  15775. }
  15776. }
  15777. match = responseHeaders[ key.toLowerCase() + " " ];
  15778. }
  15779. return match == null ? null : match.join( ", " );
  15780. },
  15781. // Raw string
  15782. getAllResponseHeaders: function() {
  15783. return completed ? responseHeadersString : null;
  15784. },
  15785. // Caches the header
  15786. setRequestHeader: function( name, value ) {
  15787. if ( completed == null ) {
  15788. name = requestHeadersNames[ name.toLowerCase() ] =
  15789. requestHeadersNames[ name.toLowerCase() ] || name;
  15790. requestHeaders[ name ] = value;
  15791. }
  15792. return this;
  15793. },
  15794. // Overrides response content-type header
  15795. overrideMimeType: function( type ) {
  15796. if ( completed == null ) {
  15797. s.mimeType = type;
  15798. }
  15799. return this;
  15800. },
  15801. // Status-dependent callbacks
  15802. statusCode: function( map ) {
  15803. var code;
  15804. if ( map ) {
  15805. if ( completed ) {
  15806. // Execute the appropriate callbacks
  15807. jqXHR.always( map[ jqXHR.status ] );
  15808. } else {
  15809. // Lazy-add the new callbacks in a way that preserves old ones
  15810. for ( code in map ) {
  15811. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  15812. }
  15813. }
  15814. }
  15815. return this;
  15816. },
  15817. // Cancel the request
  15818. abort: function( statusText ) {
  15819. var finalText = statusText || strAbort;
  15820. if ( transport ) {
  15821. transport.abort( finalText );
  15822. }
  15823. done( 0, finalText );
  15824. return this;
  15825. }
  15826. };
  15827. // Attach deferreds
  15828. deferred.promise( jqXHR );
  15829. // Add protocol if not provided (prefilters might expect it)
  15830. // Handle falsy url in the settings object (#10093: consistency with old signature)
  15831. // We also use the url parameter if available
  15832. s.url = ( ( url || s.url || location.href ) + "" )
  15833. .replace( rprotocol, location.protocol + "//" );
  15834. // Alias method option to type as per ticket #12004
  15835. s.type = options.method || options.type || s.method || s.type;
  15836. // Extract dataTypes list
  15837. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  15838. // A cross-domain request is in order when the origin doesn't match the current origin.
  15839. if ( s.crossDomain == null ) {
  15840. urlAnchor = document.createElement( "a" );
  15841. // Support: IE <=8 - 11, Edge 12 - 15
  15842. // IE throws exception on accessing the href property if url is malformed,
  15843. // e.g. http://example.com:80x/
  15844. try {
  15845. urlAnchor.href = s.url;
  15846. // Support: IE <=8 - 11 only
  15847. // Anchor's host property isn't correctly set when s.url is relative
  15848. urlAnchor.href = urlAnchor.href;
  15849. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  15850. urlAnchor.protocol + "//" + urlAnchor.host;
  15851. } catch ( e ) {
  15852. // If there is an error parsing the URL, assume it is crossDomain,
  15853. // it can be rejected by the transport if it is invalid
  15854. s.crossDomain = true;
  15855. }
  15856. }
  15857. // Convert data if not already a string
  15858. if ( s.data && s.processData && typeof s.data !== "string" ) {
  15859. s.data = jQuery.param( s.data, s.traditional );
  15860. }
  15861. // Apply prefilters
  15862. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  15863. // If request was aborted inside a prefilter, stop there
  15864. if ( completed ) {
  15865. return jqXHR;
  15866. }
  15867. // We can fire global events as of now if asked to
  15868. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  15869. fireGlobals = jQuery.event && s.global;
  15870. // Watch for a new set of requests
  15871. if ( fireGlobals && jQuery.active++ === 0 ) {
  15872. jQuery.event.trigger( "ajaxStart" );
  15873. }
  15874. // Uppercase the type
  15875. s.type = s.type.toUpperCase();
  15876. // Determine if request has content
  15877. s.hasContent = !rnoContent.test( s.type );
  15878. // Save the URL in case we're toying with the If-Modified-Since
  15879. // and/or If-None-Match header later on
  15880. // Remove hash to simplify url manipulation
  15881. cacheURL = s.url.replace( rhash, "" );
  15882. // More options handling for requests with no content
  15883. if ( !s.hasContent ) {
  15884. // Remember the hash so we can put it back
  15885. uncached = s.url.slice( cacheURL.length );
  15886. // If data is available and should be processed, append data to url
  15887. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  15888. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  15889. // #9682: remove data so that it's not used in an eventual retry
  15890. delete s.data;
  15891. }
  15892. // Add or update anti-cache param if needed
  15893. if ( s.cache === false ) {
  15894. cacheURL = cacheURL.replace( rantiCache, "$1" );
  15895. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  15896. }
  15897. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  15898. s.url = cacheURL + uncached;
  15899. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  15900. } else if ( s.data && s.processData &&
  15901. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  15902. s.data = s.data.replace( r20, "+" );
  15903. }
  15904. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15905. if ( s.ifModified ) {
  15906. if ( jQuery.lastModified[ cacheURL ] ) {
  15907. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  15908. }
  15909. if ( jQuery.etag[ cacheURL ] ) {
  15910. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  15911. }
  15912. }
  15913. // Set the correct header, if data is being sent
  15914. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  15915. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  15916. }
  15917. // Set the Accepts header for the server, depending on the dataType
  15918. jqXHR.setRequestHeader(
  15919. "Accept",
  15920. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  15921. s.accepts[ s.dataTypes[ 0 ] ] +
  15922. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  15923. s.accepts[ "*" ]
  15924. );
  15925. // Check for headers option
  15926. for ( i in s.headers ) {
  15927. jqXHR.setRequestHeader( i, s.headers[ i ] );
  15928. }
  15929. // Allow custom headers/mimetypes and early abort
  15930. if ( s.beforeSend &&
  15931. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  15932. // Abort if not done already and return
  15933. return jqXHR.abort();
  15934. }
  15935. // Aborting is no longer a cancellation
  15936. strAbort = "abort";
  15937. // Install callbacks on deferreds
  15938. completeDeferred.add( s.complete );
  15939. jqXHR.done( s.success );
  15940. jqXHR.fail( s.error );
  15941. // Get transport
  15942. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  15943. // If no transport, we auto-abort
  15944. if ( !transport ) {
  15945. done( -1, "No Transport" );
  15946. } else {
  15947. jqXHR.readyState = 1;
  15948. // Send global event
  15949. if ( fireGlobals ) {
  15950. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  15951. }
  15952. // If request was aborted inside ajaxSend, stop there
  15953. if ( completed ) {
  15954. return jqXHR;
  15955. }
  15956. // Timeout
  15957. if ( s.async && s.timeout > 0 ) {
  15958. timeoutTimer = window.setTimeout( function() {
  15959. jqXHR.abort( "timeout" );
  15960. }, s.timeout );
  15961. }
  15962. try {
  15963. completed = false;
  15964. transport.send( requestHeaders, done );
  15965. } catch ( e ) {
  15966. // Rethrow post-completion exceptions
  15967. if ( completed ) {
  15968. throw e;
  15969. }
  15970. // Propagate others as results
  15971. done( -1, e );
  15972. }
  15973. }
  15974. // Callback for when everything is done
  15975. function done( status, nativeStatusText, responses, headers ) {
  15976. var isSuccess, success, error, response, modified,
  15977. statusText = nativeStatusText;
  15978. // Ignore repeat invocations
  15979. if ( completed ) {
  15980. return;
  15981. }
  15982. completed = true;
  15983. // Clear timeout if it exists
  15984. if ( timeoutTimer ) {
  15985. window.clearTimeout( timeoutTimer );
  15986. }
  15987. // Dereference transport for early garbage collection
  15988. // (no matter how long the jqXHR object will be used)
  15989. transport = undefined;
  15990. // Cache response headers
  15991. responseHeadersString = headers || "";
  15992. // Set readyState
  15993. jqXHR.readyState = status > 0 ? 4 : 0;
  15994. // Determine if successful
  15995. isSuccess = status >= 200 && status < 300 || status === 304;
  15996. // Get response data
  15997. if ( responses ) {
  15998. response = ajaxHandleResponses( s, jqXHR, responses );
  15999. }
  16000. // Convert no matter what (that way responseXXX fields are always set)
  16001. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16002. // If successful, handle type chaining
  16003. if ( isSuccess ) {
  16004. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16005. if ( s.ifModified ) {
  16006. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16007. if ( modified ) {
  16008. jQuery.lastModified[ cacheURL ] = modified;
  16009. }
  16010. modified = jqXHR.getResponseHeader( "etag" );
  16011. if ( modified ) {
  16012. jQuery.etag[ cacheURL ] = modified;
  16013. }
  16014. }
  16015. // if no content
  16016. if ( status === 204 || s.type === "HEAD" ) {
  16017. statusText = "nocontent";
  16018. // if not modified
  16019. } else if ( status === 304 ) {
  16020. statusText = "notmodified";
  16021. // If we have data, let's convert it
  16022. } else {
  16023. statusText = response.state;
  16024. success = response.data;
  16025. error = response.error;
  16026. isSuccess = !error;
  16027. }
  16028. } else {
  16029. // Extract error from statusText and normalize for non-aborts
  16030. error = statusText;
  16031. if ( status || !statusText ) {
  16032. statusText = "error";
  16033. if ( status < 0 ) {
  16034. status = 0;
  16035. }
  16036. }
  16037. }
  16038. // Set data for the fake xhr object
  16039. jqXHR.status = status;
  16040. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16041. // Success/Error
  16042. if ( isSuccess ) {
  16043. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16044. } else {
  16045. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16046. }
  16047. // Status-dependent callbacks
  16048. jqXHR.statusCode( statusCode );
  16049. statusCode = undefined;
  16050. if ( fireGlobals ) {
  16051. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16052. [ jqXHR, s, isSuccess ? success : error ] );
  16053. }
  16054. // Complete
  16055. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16056. if ( fireGlobals ) {
  16057. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16058. // Handle the global AJAX counter
  16059. if ( !( --jQuery.active ) ) {
  16060. jQuery.event.trigger( "ajaxStop" );
  16061. }
  16062. }
  16063. }
  16064. return jqXHR;
  16065. },
  16066. getJSON: function( url, data, callback ) {
  16067. return jQuery.get( url, data, callback, "json" );
  16068. },
  16069. getScript: function( url, callback ) {
  16070. return jQuery.get( url, undefined, callback, "script" );
  16071. }
  16072. } );
  16073. jQuery.each( [ "get", "post" ], function( i, method ) {
  16074. jQuery[ method ] = function( url, data, callback, type ) {
  16075. // Shift arguments if data argument was omitted
  16076. if ( isFunction( data ) ) {
  16077. type = type || callback;
  16078. callback = data;
  16079. data = undefined;
  16080. }
  16081. // The url can be an options object (which then must have .url)
  16082. return jQuery.ajax( jQuery.extend( {
  16083. url: url,
  16084. type: method,
  16085. dataType: type,
  16086. data: data,
  16087. success: callback
  16088. }, jQuery.isPlainObject( url ) && url ) );
  16089. };
  16090. } );
  16091. jQuery._evalUrl = function( url, options ) {
  16092. return jQuery.ajax( {
  16093. url: url,
  16094. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16095. type: "GET",
  16096. dataType: "script",
  16097. cache: true,
  16098. async: false,
  16099. global: false,
  16100. // Only evaluate the response if it is successful (gh-4126)
  16101. // dataFilter is not invoked for failure responses, so using it instead
  16102. // of the default converter is kludgy but it works.
  16103. converters: {
  16104. "text script": function() {}
  16105. },
  16106. dataFilter: function( response ) {
  16107. jQuery.globalEval( response, options );
  16108. }
  16109. } );
  16110. };
  16111. jQuery.fn.extend( {
  16112. wrapAll: function( html ) {
  16113. var wrap;
  16114. if ( this[ 0 ] ) {
  16115. if ( isFunction( html ) ) {
  16116. html = html.call( this[ 0 ] );
  16117. }
  16118. // The elements to wrap the target around
  16119. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16120. if ( this[ 0 ].parentNode ) {
  16121. wrap.insertBefore( this[ 0 ] );
  16122. }
  16123. wrap.map( function() {
  16124. var elem = this;
  16125. while ( elem.firstElementChild ) {
  16126. elem = elem.firstElementChild;
  16127. }
  16128. return elem;
  16129. } ).append( this );
  16130. }
  16131. return this;
  16132. },
  16133. wrapInner: function( html ) {
  16134. if ( isFunction( html ) ) {
  16135. return this.each( function( i ) {
  16136. jQuery( this ).wrapInner( html.call( this, i ) );
  16137. } );
  16138. }
  16139. return this.each( function() {
  16140. var self = jQuery( this ),
  16141. contents = self.contents();
  16142. if ( contents.length ) {
  16143. contents.wrapAll( html );
  16144. } else {
  16145. self.append( html );
  16146. }
  16147. } );
  16148. },
  16149. wrap: function( html ) {
  16150. var htmlIsFunction = isFunction( html );
  16151. return this.each( function( i ) {
  16152. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16153. } );
  16154. },
  16155. unwrap: function( selector ) {
  16156. this.parent( selector ).not( "body" ).each( function() {
  16157. jQuery( this ).replaceWith( this.childNodes );
  16158. } );
  16159. return this;
  16160. }
  16161. } );
  16162. jQuery.expr.pseudos.hidden = function( elem ) {
  16163. return !jQuery.expr.pseudos.visible( elem );
  16164. };
  16165. jQuery.expr.pseudos.visible = function( elem ) {
  16166. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16167. };
  16168. jQuery.ajaxSettings.xhr = function() {
  16169. try {
  16170. return new window.XMLHttpRequest();
  16171. } catch ( e ) {}
  16172. };
  16173. var xhrSuccessStatus = {
  16174. // File protocol always yields status code 0, assume 200
  16175. 0: 200,
  16176. // Support: IE <=9 only
  16177. // #1450: sometimes IE returns 1223 when it should be 204
  16178. 1223: 204
  16179. },
  16180. xhrSupported = jQuery.ajaxSettings.xhr();
  16181. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16182. support.ajax = xhrSupported = !!xhrSupported;
  16183. jQuery.ajaxTransport( function( options ) {
  16184. var callback, errorCallback;
  16185. // Cross domain only allowed if supported through XMLHttpRequest
  16186. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16187. return {
  16188. send: function( headers, complete ) {
  16189. var i,
  16190. xhr = options.xhr();
  16191. xhr.open(
  16192. options.type,
  16193. options.url,
  16194. options.async,
  16195. options.username,
  16196. options.password
  16197. );
  16198. // Apply custom fields if provided
  16199. if ( options.xhrFields ) {
  16200. for ( i in options.xhrFields ) {
  16201. xhr[ i ] = options.xhrFields[ i ];
  16202. }
  16203. }
  16204. // Override mime type if needed
  16205. if ( options.mimeType && xhr.overrideMimeType ) {
  16206. xhr.overrideMimeType( options.mimeType );
  16207. }
  16208. // X-Requested-With header
  16209. // For cross-domain requests, seeing as conditions for a preflight are
  16210. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16211. // (it can always be set on a per-request basis or even using ajaxSetup)
  16212. // For same-domain requests, won't change header if already provided.
  16213. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16214. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16215. }
  16216. // Set headers
  16217. for ( i in headers ) {
  16218. xhr.setRequestHeader( i, headers[ i ] );
  16219. }
  16220. // Callback
  16221. callback = function( type ) {
  16222. return function() {
  16223. if ( callback ) {
  16224. callback = errorCallback = xhr.onload =
  16225. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16226. xhr.onreadystatechange = null;
  16227. if ( type === "abort" ) {
  16228. xhr.abort();
  16229. } else if ( type === "error" ) {
  16230. // Support: IE <=9 only
  16231. // On a manual native abort, IE9 throws
  16232. // errors on any property access that is not readyState
  16233. if ( typeof xhr.status !== "number" ) {
  16234. complete( 0, "error" );
  16235. } else {
  16236. complete(
  16237. // File: protocol always yields status 0; see #8605, #14207
  16238. xhr.status,
  16239. xhr.statusText
  16240. );
  16241. }
  16242. } else {
  16243. complete(
  16244. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16245. xhr.statusText,
  16246. // Support: IE <=9 only
  16247. // IE9 has no XHR2 but throws on binary (trac-11426)
  16248. // For XHR2 non-text, let the caller handle it (gh-2498)
  16249. ( xhr.responseType || "text" ) !== "text" ||
  16250. typeof xhr.responseText !== "string" ?
  16251. { binary: xhr.response } :
  16252. { text: xhr.responseText },
  16253. xhr.getAllResponseHeaders()
  16254. );
  16255. }
  16256. }
  16257. };
  16258. };
  16259. // Listen to events
  16260. xhr.onload = callback();
  16261. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16262. // Support: IE 9 only
  16263. // Use onreadystatechange to replace onabort
  16264. // to handle uncaught aborts
  16265. if ( xhr.onabort !== undefined ) {
  16266. xhr.onabort = errorCallback;
  16267. } else {
  16268. xhr.onreadystatechange = function() {
  16269. // Check readyState before timeout as it changes
  16270. if ( xhr.readyState === 4 ) {
  16271. // Allow onerror to be called first,
  16272. // but that will not handle a native abort
  16273. // Also, save errorCallback to a variable
  16274. // as xhr.onerror cannot be accessed
  16275. window.setTimeout( function() {
  16276. if ( callback ) {
  16277. errorCallback();
  16278. }
  16279. } );
  16280. }
  16281. };
  16282. }
  16283. // Create the abort callback
  16284. callback = callback( "abort" );
  16285. try {
  16286. // Do send the request (this may raise an exception)
  16287. xhr.send( options.hasContent && options.data || null );
  16288. } catch ( e ) {
  16289. // #14683: Only rethrow if this hasn't been notified as an error yet
  16290. if ( callback ) {
  16291. throw e;
  16292. }
  16293. }
  16294. },
  16295. abort: function() {
  16296. if ( callback ) {
  16297. callback();
  16298. }
  16299. }
  16300. };
  16301. }
  16302. } );
  16303. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16304. jQuery.ajaxPrefilter( function( s ) {
  16305. if ( s.crossDomain ) {
  16306. s.contents.script = false;
  16307. }
  16308. } );
  16309. // Install script dataType
  16310. jQuery.ajaxSetup( {
  16311. accepts: {
  16312. script: "text/javascript, application/javascript, " +
  16313. "application/ecmascript, application/x-ecmascript"
  16314. },
  16315. contents: {
  16316. script: /\b(?:java|ecma)script\b/
  16317. },
  16318. converters: {
  16319. "text script": function( text ) {
  16320. jQuery.globalEval( text );
  16321. return text;
  16322. }
  16323. }
  16324. } );
  16325. // Handle cache's special case and crossDomain
  16326. jQuery.ajaxPrefilter( "script", function( s ) {
  16327. if ( s.cache === undefined ) {
  16328. s.cache = false;
  16329. }
  16330. if ( s.crossDomain ) {
  16331. s.type = "GET";
  16332. }
  16333. } );
  16334. // Bind script tag hack transport
  16335. jQuery.ajaxTransport( "script", function( s ) {
  16336. // This transport only deals with cross domain or forced-by-attrs requests
  16337. if ( s.crossDomain || s.scriptAttrs ) {
  16338. var script, callback;
  16339. return {
  16340. send: function( _, complete ) {
  16341. script = jQuery( "<script>" )
  16342. .attr( s.scriptAttrs || {} )
  16343. .prop( { charset: s.scriptCharset, src: s.url } )
  16344. .on( "load error", callback = function( evt ) {
  16345. script.remove();
  16346. callback = null;
  16347. if ( evt ) {
  16348. complete( evt.type === "error" ? 404 : 200, evt.type );
  16349. }
  16350. } );
  16351. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16352. document.head.appendChild( script[ 0 ] );
  16353. },
  16354. abort: function() {
  16355. if ( callback ) {
  16356. callback();
  16357. }
  16358. }
  16359. };
  16360. }
  16361. } );
  16362. var oldCallbacks = [],
  16363. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16364. // Default jsonp settings
  16365. jQuery.ajaxSetup( {
  16366. jsonp: "callback",
  16367. jsonpCallback: function() {
  16368. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16369. this[ callback ] = true;
  16370. return callback;
  16371. }
  16372. } );
  16373. // Detect, normalize options and install callbacks for jsonp requests
  16374. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16375. var callbackName, overwritten, responseContainer,
  16376. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16377. "url" :
  16378. typeof s.data === "string" &&
  16379. ( s.contentType || "" )
  16380. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16381. rjsonp.test( s.data ) && "data"
  16382. );
  16383. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16384. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16385. // Get callback name, remembering preexisting value associated with it
  16386. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16387. s.jsonpCallback() :
  16388. s.jsonpCallback;
  16389. // Insert callback into url or form data
  16390. if ( jsonProp ) {
  16391. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16392. } else if ( s.jsonp !== false ) {
  16393. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16394. }
  16395. // Use data converter to retrieve json after script execution
  16396. s.converters[ "script json" ] = function() {
  16397. if ( !responseContainer ) {
  16398. jQuery.error( callbackName + " was not called" );
  16399. }
  16400. return responseContainer[ 0 ];
  16401. };
  16402. // Force json dataType
  16403. s.dataTypes[ 0 ] = "json";
  16404. // Install callback
  16405. overwritten = window[ callbackName ];
  16406. window[ callbackName ] = function() {
  16407. responseContainer = arguments;
  16408. };
  16409. // Clean-up function (fires after converters)
  16410. jqXHR.always( function() {
  16411. // If previous value didn't exist - remove it
  16412. if ( overwritten === undefined ) {
  16413. jQuery( window ).removeProp( callbackName );
  16414. // Otherwise restore preexisting value
  16415. } else {
  16416. window[ callbackName ] = overwritten;
  16417. }
  16418. // Save back as free
  16419. if ( s[ callbackName ] ) {
  16420. // Make sure that re-using the options doesn't screw things around
  16421. s.jsonpCallback = originalSettings.jsonpCallback;
  16422. // Save the callback name for future use
  16423. oldCallbacks.push( callbackName );
  16424. }
  16425. // Call if it was a function and we have a response
  16426. if ( responseContainer && isFunction( overwritten ) ) {
  16427. overwritten( responseContainer[ 0 ] );
  16428. }
  16429. responseContainer = overwritten = undefined;
  16430. } );
  16431. // Delegate to script
  16432. return "script";
  16433. }
  16434. } );
  16435. // Support: Safari 8 only
  16436. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16437. // collapse sibling forms: the second one becomes a child of the first one.
  16438. // Because of that, this security measure has to be disabled in Safari 8.
  16439. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16440. support.createHTMLDocument = ( function() {
  16441. var body = document.implementation.createHTMLDocument( "" ).body;
  16442. body.innerHTML = "<form></form><form></form>";
  16443. return body.childNodes.length === 2;
  16444. } )();
  16445. // Argument "data" should be string of html
  16446. // context (optional): If specified, the fragment will be created in this context,
  16447. // defaults to document
  16448. // keepScripts (optional): If true, will include scripts passed in the html string
  16449. jQuery.parseHTML = function( data, context, keepScripts ) {
  16450. if ( typeof data !== "string" ) {
  16451. return [];
  16452. }
  16453. if ( typeof context === "boolean" ) {
  16454. keepScripts = context;
  16455. context = false;
  16456. }
  16457. var base, parsed, scripts;
  16458. if ( !context ) {
  16459. // Stop scripts or inline event handlers from being executed immediately
  16460. // by using document.implementation
  16461. if ( support.createHTMLDocument ) {
  16462. context = document.implementation.createHTMLDocument( "" );
  16463. // Set the base href for the created document
  16464. // so any parsed elements with URLs
  16465. // are based on the document's URL (gh-2965)
  16466. base = context.createElement( "base" );
  16467. base.href = document.location.href;
  16468. context.head.appendChild( base );
  16469. } else {
  16470. context = document;
  16471. }
  16472. }
  16473. parsed = rsingleTag.exec( data );
  16474. scripts = !keepScripts && [];
  16475. // Single tag
  16476. if ( parsed ) {
  16477. return [ context.createElement( parsed[ 1 ] ) ];
  16478. }
  16479. parsed = buildFragment( [ data ], context, scripts );
  16480. if ( scripts && scripts.length ) {
  16481. jQuery( scripts ).remove();
  16482. }
  16483. return jQuery.merge( [], parsed.childNodes );
  16484. };
  16485. /**
  16486. * Load a url into a page
  16487. */
  16488. jQuery.fn.load = function( url, params, callback ) {
  16489. var selector, type, response,
  16490. self = this,
  16491. off = url.indexOf( " " );
  16492. if ( off > -1 ) {
  16493. selector = stripAndCollapse( url.slice( off ) );
  16494. url = url.slice( 0, off );
  16495. }
  16496. // If it's a function
  16497. if ( isFunction( params ) ) {
  16498. // We assume that it's the callback
  16499. callback = params;
  16500. params = undefined;
  16501. // Otherwise, build a param string
  16502. } else if ( params && typeof params === "object" ) {
  16503. type = "POST";
  16504. }
  16505. // If we have elements to modify, make the request
  16506. if ( self.length > 0 ) {
  16507. jQuery.ajax( {
  16508. url: url,
  16509. // If "type" variable is undefined, then "GET" method will be used.
  16510. // Make value of this field explicit since
  16511. // user can override it through ajaxSetup method
  16512. type: type || "GET",
  16513. dataType: "html",
  16514. data: params
  16515. } ).done( function( responseText ) {
  16516. // Save response for use in complete callback
  16517. response = arguments;
  16518. self.html( selector ?
  16519. // If a selector was specified, locate the right elements in a dummy div
  16520. // Exclude scripts to avoid IE 'Permission Denied' errors
  16521. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16522. // Otherwise use the full result
  16523. responseText );
  16524. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16525. // but they are ignored because response was set above.
  16526. // If it fails, this function gets "jqXHR", "status", "error"
  16527. } ).always( callback && function( jqXHR, status ) {
  16528. self.each( function() {
  16529. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16530. } );
  16531. } );
  16532. }
  16533. return this;
  16534. };
  16535. // Attach a bunch of functions for handling common AJAX events
  16536. jQuery.each( [
  16537. "ajaxStart",
  16538. "ajaxStop",
  16539. "ajaxComplete",
  16540. "ajaxError",
  16541. "ajaxSuccess",
  16542. "ajaxSend"
  16543. ], function( i, type ) {
  16544. jQuery.fn[ type ] = function( fn ) {
  16545. return this.on( type, fn );
  16546. };
  16547. } );
  16548. jQuery.expr.pseudos.animated = function( elem ) {
  16549. return jQuery.grep( jQuery.timers, function( fn ) {
  16550. return elem === fn.elem;
  16551. } ).length;
  16552. };
  16553. jQuery.offset = {
  16554. setOffset: function( elem, options, i ) {
  16555. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16556. position = jQuery.css( elem, "position" ),
  16557. curElem = jQuery( elem ),
  16558. props = {};
  16559. // Set position first, in-case top/left are set even on static elem
  16560. if ( position === "static" ) {
  16561. elem.style.position = "relative";
  16562. }
  16563. curOffset = curElem.offset();
  16564. curCSSTop = jQuery.css( elem, "top" );
  16565. curCSSLeft = jQuery.css( elem, "left" );
  16566. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16567. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16568. // Need to be able to calculate position if either
  16569. // top or left is auto and position is either absolute or fixed
  16570. if ( calculatePosition ) {
  16571. curPosition = curElem.position();
  16572. curTop = curPosition.top;
  16573. curLeft = curPosition.left;
  16574. } else {
  16575. curTop = parseFloat( curCSSTop ) || 0;
  16576. curLeft = parseFloat( curCSSLeft ) || 0;
  16577. }
  16578. if ( isFunction( options ) ) {
  16579. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16580. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16581. }
  16582. if ( options.top != null ) {
  16583. props.top = ( options.top - curOffset.top ) + curTop;
  16584. }
  16585. if ( options.left != null ) {
  16586. props.left = ( options.left - curOffset.left ) + curLeft;
  16587. }
  16588. if ( "using" in options ) {
  16589. options.using.call( elem, props );
  16590. } else {
  16591. curElem.css( props );
  16592. }
  16593. }
  16594. };
  16595. jQuery.fn.extend( {
  16596. // offset() relates an element's border box to the document origin
  16597. offset: function( options ) {
  16598. // Preserve chaining for setter
  16599. if ( arguments.length ) {
  16600. return options === undefined ?
  16601. this :
  16602. this.each( function( i ) {
  16603. jQuery.offset.setOffset( this, options, i );
  16604. } );
  16605. }
  16606. var rect, win,
  16607. elem = this[ 0 ];
  16608. if ( !elem ) {
  16609. return;
  16610. }
  16611. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16612. // Support: IE <=11 only
  16613. // Running getBoundingClientRect on a
  16614. // disconnected node in IE throws an error
  16615. if ( !elem.getClientRects().length ) {
  16616. return { top: 0, left: 0 };
  16617. }
  16618. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16619. rect = elem.getBoundingClientRect();
  16620. win = elem.ownerDocument.defaultView;
  16621. return {
  16622. top: rect.top + win.pageYOffset,
  16623. left: rect.left + win.pageXOffset
  16624. };
  16625. },
  16626. // position() relates an element's margin box to its offset parent's padding box
  16627. // This corresponds to the behavior of CSS absolute positioning
  16628. position: function() {
  16629. if ( !this[ 0 ] ) {
  16630. return;
  16631. }
  16632. var offsetParent, offset, doc,
  16633. elem = this[ 0 ],
  16634. parentOffset = { top: 0, left: 0 };
  16635. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16636. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16637. // Assume position:fixed implies availability of getBoundingClientRect
  16638. offset = elem.getBoundingClientRect();
  16639. } else {
  16640. offset = this.offset();
  16641. // Account for the *real* offset parent, which can be the document or its root element
  16642. // when a statically positioned element is identified
  16643. doc = elem.ownerDocument;
  16644. offsetParent = elem.offsetParent || doc.documentElement;
  16645. while ( offsetParent &&
  16646. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16647. jQuery.css( offsetParent, "position" ) === "static" ) {
  16648. offsetParent = offsetParent.parentNode;
  16649. }
  16650. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16651. // Incorporate borders into its offset, since they are outside its content origin
  16652. parentOffset = jQuery( offsetParent ).offset();
  16653. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16654. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16655. }
  16656. }
  16657. // Subtract parent offsets and element margins
  16658. return {
  16659. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16660. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16661. };
  16662. },
  16663. // This method will return documentElement in the following cases:
  16664. // 1) For the element inside the iframe without offsetParent, this method will return
  16665. // documentElement of the parent window
  16666. // 2) For the hidden or detached element
  16667. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16668. //
  16669. // but those exceptions were never presented as a real life use-cases
  16670. // and might be considered as more preferable results.
  16671. //
  16672. // This logic, however, is not guaranteed and can change at any point in the future
  16673. offsetParent: function() {
  16674. return this.map( function() {
  16675. var offsetParent = this.offsetParent;
  16676. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16677. offsetParent = offsetParent.offsetParent;
  16678. }
  16679. return offsetParent || documentElement;
  16680. } );
  16681. }
  16682. } );
  16683. // Create scrollLeft and scrollTop methods
  16684. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16685. var top = "pageYOffset" === prop;
  16686. jQuery.fn[ method ] = function( val ) {
  16687. return access( this, function( elem, method, val ) {
  16688. // Coalesce documents and windows
  16689. var win;
  16690. if ( isWindow( elem ) ) {
  16691. win = elem;
  16692. } else if ( elem.nodeType === 9 ) {
  16693. win = elem.defaultView;
  16694. }
  16695. if ( val === undefined ) {
  16696. return win ? win[ prop ] : elem[ method ];
  16697. }
  16698. if ( win ) {
  16699. win.scrollTo(
  16700. !top ? val : win.pageXOffset,
  16701. top ? val : win.pageYOffset
  16702. );
  16703. } else {
  16704. elem[ method ] = val;
  16705. }
  16706. }, method, val, arguments.length );
  16707. };
  16708. } );
  16709. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16710. // Add the top/left cssHooks using jQuery.fn.position
  16711. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16712. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16713. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16714. // rather than make the css module depend on the offset module, just check for it here
  16715. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16716. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16717. function( elem, computed ) {
  16718. if ( computed ) {
  16719. computed = curCSS( elem, prop );
  16720. // If curCSS returns percentage, fallback to offset
  16721. return rnumnonpx.test( computed ) ?
  16722. jQuery( elem ).position()[ prop ] + "px" :
  16723. computed;
  16724. }
  16725. }
  16726. );
  16727. } );
  16728. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16729. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16730. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16731. function( defaultExtra, funcName ) {
  16732. // Margin is only for outerHeight, outerWidth
  16733. jQuery.fn[ funcName ] = function( margin, value ) {
  16734. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  16735. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  16736. return access( this, function( elem, type, value ) {
  16737. var doc;
  16738. if ( isWindow( elem ) ) {
  16739. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  16740. return funcName.indexOf( "outer" ) === 0 ?
  16741. elem[ "inner" + name ] :
  16742. elem.document.documentElement[ "client" + name ];
  16743. }
  16744. // Get document width or height
  16745. if ( elem.nodeType === 9 ) {
  16746. doc = elem.documentElement;
  16747. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  16748. // whichever is greatest
  16749. return Math.max(
  16750. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  16751. elem.body[ "offset" + name ], doc[ "offset" + name ],
  16752. doc[ "client" + name ]
  16753. );
  16754. }
  16755. return value === undefined ?
  16756. // Get width or height on the element, requesting but not forcing parseFloat
  16757. jQuery.css( elem, type, extra ) :
  16758. // Set width or height on the element
  16759. jQuery.style( elem, type, value, extra );
  16760. }, type, chainable ? margin : undefined, chainable );
  16761. };
  16762. } );
  16763. } );
  16764. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  16765. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  16766. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  16767. function( i, name ) {
  16768. // Handle event binding
  16769. jQuery.fn[ name ] = function( data, fn ) {
  16770. return arguments.length > 0 ?
  16771. this.on( name, null, data, fn ) :
  16772. this.trigger( name );
  16773. };
  16774. } );
  16775. jQuery.fn.extend( {
  16776. hover: function( fnOver, fnOut ) {
  16777. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  16778. }
  16779. } );
  16780. jQuery.fn.extend( {
  16781. bind: function( types, data, fn ) {
  16782. return this.on( types, null, data, fn );
  16783. },
  16784. unbind: function( types, fn ) {
  16785. return this.off( types, null, fn );
  16786. },
  16787. delegate: function( selector, types, data, fn ) {
  16788. return this.on( types, selector, data, fn );
  16789. },
  16790. undelegate: function( selector, types, fn ) {
  16791. // ( namespace ) or ( selector, types [, fn] )
  16792. return arguments.length === 1 ?
  16793. this.off( selector, "**" ) :
  16794. this.off( types, selector || "**", fn );
  16795. }
  16796. } );
  16797. // Bind a function to a context, optionally partially applying any
  16798. // arguments.
  16799. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  16800. // However, it is not slated for removal any time soon
  16801. jQuery.proxy = function( fn, context ) {
  16802. var tmp, args, proxy;
  16803. if ( typeof context === "string" ) {
  16804. tmp = fn[ context ];
  16805. context = fn;
  16806. fn = tmp;
  16807. }
  16808. // Quick check to determine if target is callable, in the spec
  16809. // this throws a TypeError, but we will just return undefined.
  16810. if ( !isFunction( fn ) ) {
  16811. return undefined;
  16812. }
  16813. // Simulated bind
  16814. args = slice.call( arguments, 2 );
  16815. proxy = function() {
  16816. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  16817. };
  16818. // Set the guid of unique handler to the same of original handler, so it can be removed
  16819. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  16820. return proxy;
  16821. };
  16822. jQuery.holdReady = function( hold ) {
  16823. if ( hold ) {
  16824. jQuery.readyWait++;
  16825. } else {
  16826. jQuery.ready( true );
  16827. }
  16828. };
  16829. jQuery.isArray = Array.isArray;
  16830. jQuery.parseJSON = JSON.parse;
  16831. jQuery.nodeName = nodeName;
  16832. jQuery.isFunction = isFunction;
  16833. jQuery.isWindow = isWindow;
  16834. jQuery.camelCase = camelCase;
  16835. jQuery.type = toType;
  16836. jQuery.now = Date.now;
  16837. jQuery.isNumeric = function( obj ) {
  16838. // As of jQuery 3.0, isNumeric is limited to
  16839. // strings and numbers (primitives or objects)
  16840. // that can be coerced to finite numbers (gh-2662)
  16841. var type = jQuery.type( obj );
  16842. return ( type === "number" || type === "string" ) &&
  16843. // parseFloat NaNs numeric-cast false positives ("")
  16844. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  16845. // subtraction forces infinities to NaN
  16846. !isNaN( obj - parseFloat( obj ) );
  16847. };
  16848. // Register as a named AMD module, since jQuery can be concatenated with other
  16849. // files that may use define, but not via a proper concatenation script that
  16850. // understands anonymous AMD modules. A named AMD is safest and most robust
  16851. // way to register. Lowercase jquery is used because AMD module names are
  16852. // derived from file names, and jQuery is normally delivered in a lowercase
  16853. // file name. Do this after creating the global so that if an AMD module wants
  16854. // to call noConflict to hide this version of jQuery, it will work.
  16855. // Note that for maximum portability, libraries that are not jQuery should
  16856. // declare themselves as anonymous modules, and avoid setting a global if an
  16857. // AMD loader is present. jQuery is a special case. For more information, see
  16858. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  16859. if ( true ) {
  16860. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  16861. return jQuery;
  16862. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  16863. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16864. }
  16865. var
  16866. // Map over jQuery in case of overwrite
  16867. _jQuery = window.jQuery,
  16868. // Map over the $ in case of overwrite
  16869. _$ = window.$;
  16870. jQuery.noConflict = function( deep ) {
  16871. if ( window.$ === jQuery ) {
  16872. window.$ = _$;
  16873. }
  16874. if ( deep && window.jQuery === jQuery ) {
  16875. window.jQuery = _jQuery;
  16876. }
  16877. return jQuery;
  16878. };
  16879. // Expose jQuery and $ identifiers, even in AMD
  16880. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  16881. // and CommonJS for browser emulators (#13566)
  16882. if ( !noGlobal ) {
  16883. window.jQuery = window.$ = jQuery;
  16884. }
  16885. return jQuery;
  16886. } );
  16887. /***/ }),
  16888. /***/ "./node_modules/laravel-echo/dist/echo.js":
  16889. /*!************************************************!*\
  16890. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  16891. \************************************************/
  16892. /*! exports provided: default */
  16893. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  16894. "use strict";
  16895. __webpack_require__.r(__webpack_exports__);
  16896. var classCallCheck = function (instance, Constructor) {
  16897. if (!(instance instanceof Constructor)) {
  16898. throw new TypeError("Cannot call a class as a function");
  16899. }
  16900. };
  16901. var createClass = function () {
  16902. function defineProperties(target, props) {
  16903. for (var i = 0; i < props.length; i++) {
  16904. var descriptor = props[i];
  16905. descriptor.enumerable = descriptor.enumerable || false;
  16906. descriptor.configurable = true;
  16907. if ("value" in descriptor) descriptor.writable = true;
  16908. Object.defineProperty(target, descriptor.key, descriptor);
  16909. }
  16910. }
  16911. return function (Constructor, protoProps, staticProps) {
  16912. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  16913. if (staticProps) defineProperties(Constructor, staticProps);
  16914. return Constructor;
  16915. };
  16916. }();
  16917. var _extends = Object.assign || function (target) {
  16918. for (var i = 1; i < arguments.length; i++) {
  16919. var source = arguments[i];
  16920. for (var key in source) {
  16921. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16922. target[key] = source[key];
  16923. }
  16924. }
  16925. }
  16926. return target;
  16927. };
  16928. var inherits = function (subClass, superClass) {
  16929. if (typeof superClass !== "function" && superClass !== null) {
  16930. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  16931. }
  16932. subClass.prototype = Object.create(superClass && superClass.prototype, {
  16933. constructor: {
  16934. value: subClass,
  16935. enumerable: false,
  16936. writable: true,
  16937. configurable: true
  16938. }
  16939. });
  16940. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  16941. };
  16942. var possibleConstructorReturn = function (self, call) {
  16943. if (!self) {
  16944. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  16945. }
  16946. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  16947. };
  16948. var Connector = function () {
  16949. /**
  16950. * Create a new class instance.
  16951. */
  16952. function Connector(options) {
  16953. classCallCheck(this, Connector);
  16954. /**
  16955. * Default connector options.
  16956. */
  16957. this._defaultOptions = {
  16958. auth: {
  16959. headers: {}
  16960. },
  16961. authEndpoint: '/broadcasting/auth',
  16962. broadcaster: 'pusher',
  16963. csrfToken: null,
  16964. host: null,
  16965. key: null,
  16966. namespace: 'App.Events'
  16967. };
  16968. this.setOptions(options);
  16969. this.connect();
  16970. }
  16971. /**
  16972. * Merge the custom options with the defaults.
  16973. */
  16974. createClass(Connector, [{
  16975. key: 'setOptions',
  16976. value: function setOptions(options) {
  16977. this.options = _extends(this._defaultOptions, options);
  16978. if (this.csrfToken()) {
  16979. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  16980. }
  16981. return options;
  16982. }
  16983. /**
  16984. * Extract the CSRF token from the page.
  16985. */
  16986. }, {
  16987. key: 'csrfToken',
  16988. value: function csrfToken() {
  16989. var selector = void 0;
  16990. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  16991. return window['Laravel'].csrfToken;
  16992. } else if (this.options.csrfToken) {
  16993. return this.options.csrfToken;
  16994. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  16995. return selector.getAttribute('content');
  16996. }
  16997. return null;
  16998. }
  16999. }]);
  17000. return Connector;
  17001. }();
  17002. /**
  17003. * This class represents a basic channel.
  17004. */
  17005. var Channel = function () {
  17006. function Channel() {
  17007. classCallCheck(this, Channel);
  17008. }
  17009. createClass(Channel, [{
  17010. key: 'listenForWhisper',
  17011. /**
  17012. * Listen for a whisper event on the channel instance.
  17013. */
  17014. value: function listenForWhisper(event, callback) {
  17015. return this.listen('.client-' + event, callback);
  17016. }
  17017. /**
  17018. * Listen for an event on the channel instance.
  17019. */
  17020. }, {
  17021. key: 'notification',
  17022. value: function notification(callback) {
  17023. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17024. }
  17025. /**
  17026. * Stop listening for a whispser event on the channel instance.
  17027. */
  17028. }, {
  17029. key: 'stopListeningForWhisper',
  17030. value: function stopListeningForWhisper(event) {
  17031. return this.stopListening('.client-' + event);
  17032. }
  17033. }]);
  17034. return Channel;
  17035. }();
  17036. /**
  17037. * Event name formatter
  17038. */
  17039. var EventFormatter = function () {
  17040. /**
  17041. * Create a new class instance.
  17042. */
  17043. function EventFormatter(namespace) {
  17044. classCallCheck(this, EventFormatter);
  17045. this.setNamespace(namespace);
  17046. }
  17047. /**
  17048. * Format the given event name.
  17049. */
  17050. createClass(EventFormatter, [{
  17051. key: 'format',
  17052. value: function format(event) {
  17053. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17054. return event.substr(1);
  17055. } else if (this.namespace) {
  17056. event = this.namespace + '.' + event;
  17057. }
  17058. return event.replace(/\./g, '\\');
  17059. }
  17060. /**
  17061. * Set the event namespace.
  17062. */
  17063. }, {
  17064. key: 'setNamespace',
  17065. value: function setNamespace(value) {
  17066. this.namespace = value;
  17067. }
  17068. }]);
  17069. return EventFormatter;
  17070. }();
  17071. /**
  17072. * This class represents a Pusher channel.
  17073. */
  17074. var PusherChannel = function (_Channel) {
  17075. inherits(PusherChannel, _Channel);
  17076. /**
  17077. * Create a new class instance.
  17078. */
  17079. function PusherChannel(pusher, name, options) {
  17080. classCallCheck(this, PusherChannel);
  17081. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17082. _this.name = name;
  17083. _this.pusher = pusher;
  17084. _this.options = options;
  17085. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17086. _this.subscribe();
  17087. return _this;
  17088. }
  17089. /**
  17090. * Subscribe to a Pusher channel.
  17091. */
  17092. createClass(PusherChannel, [{
  17093. key: 'subscribe',
  17094. value: function subscribe() {
  17095. this.subscription = this.pusher.subscribe(this.name);
  17096. }
  17097. /**
  17098. * Unsubscribe from a Pusher channel.
  17099. */
  17100. }, {
  17101. key: 'unsubscribe',
  17102. value: function unsubscribe() {
  17103. this.pusher.unsubscribe(this.name);
  17104. }
  17105. /**
  17106. * Listen for an event on the channel instance.
  17107. */
  17108. }, {
  17109. key: 'listen',
  17110. value: function listen(event, callback) {
  17111. this.on(this.eventFormatter.format(event), callback);
  17112. return this;
  17113. }
  17114. /**
  17115. * Stop listening for an event on the channel instance.
  17116. */
  17117. }, {
  17118. key: 'stopListening',
  17119. value: function stopListening(event) {
  17120. this.subscription.unbind(this.eventFormatter.format(event));
  17121. return this;
  17122. }
  17123. /**
  17124. * Bind a channel to an event.
  17125. */
  17126. }, {
  17127. key: 'on',
  17128. value: function on(event, callback) {
  17129. this.subscription.bind(event, callback);
  17130. return this;
  17131. }
  17132. }]);
  17133. return PusherChannel;
  17134. }(Channel);
  17135. /**
  17136. * This class represents a Pusher private channel.
  17137. */
  17138. var PusherPrivateChannel = function (_PusherChannel) {
  17139. inherits(PusherPrivateChannel, _PusherChannel);
  17140. function PusherPrivateChannel() {
  17141. classCallCheck(this, PusherPrivateChannel);
  17142. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17143. }
  17144. createClass(PusherPrivateChannel, [{
  17145. key: 'whisper',
  17146. /**
  17147. * Trigger client event on the channel.
  17148. */
  17149. value: function whisper(eventName, data) {
  17150. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17151. return this;
  17152. }
  17153. }]);
  17154. return PusherPrivateChannel;
  17155. }(PusherChannel);
  17156. /**
  17157. * This class represents a Pusher presence channel.
  17158. */
  17159. var PusherPresenceChannel = function (_PusherChannel) {
  17160. inherits(PusherPresenceChannel, _PusherChannel);
  17161. function PusherPresenceChannel() {
  17162. classCallCheck(this, PusherPresenceChannel);
  17163. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17164. }
  17165. createClass(PusherPresenceChannel, [{
  17166. key: 'here',
  17167. /**
  17168. * Register a callback to be called anytime the member list changes.
  17169. */
  17170. value: function here(callback) {
  17171. this.on('pusher:subscription_succeeded', function (data) {
  17172. callback(Object.keys(data.members).map(function (k) {
  17173. return data.members[k];
  17174. }));
  17175. });
  17176. return this;
  17177. }
  17178. /**
  17179. * Listen for someone joining the channel.
  17180. */
  17181. }, {
  17182. key: 'joining',
  17183. value: function joining(callback) {
  17184. this.on('pusher:member_added', function (member) {
  17185. callback(member.info);
  17186. });
  17187. return this;
  17188. }
  17189. /**
  17190. * Listen for someone leaving the channel.
  17191. */
  17192. }, {
  17193. key: 'leaving',
  17194. value: function leaving(callback) {
  17195. this.on('pusher:member_removed', function (member) {
  17196. callback(member.info);
  17197. });
  17198. return this;
  17199. }
  17200. /**
  17201. * Trigger client event on the channel.
  17202. */
  17203. }, {
  17204. key: 'whisper',
  17205. value: function whisper(eventName, data) {
  17206. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17207. return this;
  17208. }
  17209. }]);
  17210. return PusherPresenceChannel;
  17211. }(PusherChannel);
  17212. /**
  17213. * This class represents a Socket.io channel.
  17214. */
  17215. var SocketIoChannel = function (_Channel) {
  17216. inherits(SocketIoChannel, _Channel);
  17217. /**
  17218. * Create a new class instance.
  17219. */
  17220. function SocketIoChannel(socket, name, options) {
  17221. classCallCheck(this, SocketIoChannel);
  17222. /**
  17223. * The event callbacks applied to the channel.
  17224. */
  17225. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17226. _this.events = {};
  17227. _this.name = name;
  17228. _this.socket = socket;
  17229. _this.options = options;
  17230. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17231. _this.subscribe();
  17232. _this.configureReconnector();
  17233. return _this;
  17234. }
  17235. /**
  17236. * Subscribe to a Socket.io channel.
  17237. */
  17238. createClass(SocketIoChannel, [{
  17239. key: 'subscribe',
  17240. value: function subscribe() {
  17241. this.socket.emit('subscribe', {
  17242. channel: this.name,
  17243. auth: this.options.auth || {}
  17244. });
  17245. }
  17246. /**
  17247. * Unsubscribe from channel and ubind event callbacks.
  17248. */
  17249. }, {
  17250. key: 'unsubscribe',
  17251. value: function unsubscribe() {
  17252. this.unbind();
  17253. this.socket.emit('unsubscribe', {
  17254. channel: this.name,
  17255. auth: this.options.auth || {}
  17256. });
  17257. }
  17258. /**
  17259. * Listen for an event on the channel instance.
  17260. */
  17261. }, {
  17262. key: 'listen',
  17263. value: function listen(event, callback) {
  17264. this.on(this.eventFormatter.format(event), callback);
  17265. return this;
  17266. }
  17267. /**
  17268. * Stop listening for an event on the channel instance.
  17269. */
  17270. }, {
  17271. key: 'stopListening',
  17272. value: function stopListening(event) {
  17273. var name = this.eventFormatter.format(event);
  17274. this.socket.removeListener(name);
  17275. delete this.events[name];
  17276. return this;
  17277. }
  17278. /**
  17279. * Bind the channel's socket to an event and store the callback.
  17280. */
  17281. }, {
  17282. key: 'on',
  17283. value: function on(event, callback) {
  17284. var _this2 = this;
  17285. var listener = function listener(channel, data) {
  17286. if (_this2.name == channel) {
  17287. callback(data);
  17288. }
  17289. };
  17290. this.socket.on(event, listener);
  17291. this.bind(event, listener);
  17292. }
  17293. /**
  17294. * Attach a 'reconnect' listener and bind the event.
  17295. */
  17296. }, {
  17297. key: 'configureReconnector',
  17298. value: function configureReconnector() {
  17299. var _this3 = this;
  17300. var listener = function listener() {
  17301. _this3.subscribe();
  17302. };
  17303. this.socket.on('reconnect', listener);
  17304. this.bind('reconnect', listener);
  17305. }
  17306. /**
  17307. * Bind the channel's socket to an event and store the callback.
  17308. */
  17309. }, {
  17310. key: 'bind',
  17311. value: function bind(event, callback) {
  17312. this.events[event] = this.events[event] || [];
  17313. this.events[event].push(callback);
  17314. }
  17315. /**
  17316. * Unbind the channel's socket from all stored event callbacks.
  17317. */
  17318. }, {
  17319. key: 'unbind',
  17320. value: function unbind() {
  17321. var _this4 = this;
  17322. Object.keys(this.events).forEach(function (event) {
  17323. _this4.events[event].forEach(function (callback) {
  17324. _this4.socket.removeListener(event, callback);
  17325. });
  17326. delete _this4.events[event];
  17327. });
  17328. }
  17329. }]);
  17330. return SocketIoChannel;
  17331. }(Channel);
  17332. /**
  17333. * This class represents a Socket.io presence channel.
  17334. */
  17335. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17336. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17337. function SocketIoPrivateChannel() {
  17338. classCallCheck(this, SocketIoPrivateChannel);
  17339. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17340. }
  17341. createClass(SocketIoPrivateChannel, [{
  17342. key: 'whisper',
  17343. /**
  17344. * Trigger client event on the channel.
  17345. */
  17346. value: function whisper(eventName, data) {
  17347. this.socket.emit('client event', {
  17348. channel: this.name,
  17349. event: 'client-' + eventName,
  17350. data: data
  17351. });
  17352. return this;
  17353. }
  17354. }]);
  17355. return SocketIoPrivateChannel;
  17356. }(SocketIoChannel);
  17357. /**
  17358. * This class represents a Socket.io presence channel.
  17359. */
  17360. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17361. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17362. function SocketIoPresenceChannel() {
  17363. classCallCheck(this, SocketIoPresenceChannel);
  17364. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17365. }
  17366. createClass(SocketIoPresenceChannel, [{
  17367. key: 'here',
  17368. /**
  17369. * Register a callback to be called anytime the member list changes.
  17370. */
  17371. value: function here(callback) {
  17372. this.on('presence:subscribed', function (members) {
  17373. callback(members.map(function (m) {
  17374. return m.user_info;
  17375. }));
  17376. });
  17377. return this;
  17378. }
  17379. /**
  17380. * Listen for someone joining the channel.
  17381. */
  17382. }, {
  17383. key: 'joining',
  17384. value: function joining(callback) {
  17385. this.on('presence:joining', function (member) {
  17386. return callback(member.user_info);
  17387. });
  17388. return this;
  17389. }
  17390. /**
  17391. * Listen for someone leaving the channel.
  17392. */
  17393. }, {
  17394. key: 'leaving',
  17395. value: function leaving(callback) {
  17396. this.on('presence:leaving', function (member) {
  17397. return callback(member.user_info);
  17398. });
  17399. return this;
  17400. }
  17401. }]);
  17402. return SocketIoPresenceChannel;
  17403. }(SocketIoPrivateChannel);
  17404. /**
  17405. * This class represents a null channel.
  17406. */
  17407. var NullChannel = function (_Channel) {
  17408. inherits(NullChannel, _Channel);
  17409. function NullChannel() {
  17410. classCallCheck(this, NullChannel);
  17411. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17412. }
  17413. createClass(NullChannel, [{
  17414. key: 'subscribe',
  17415. /**
  17416. * Subscribe to a channel.
  17417. */
  17418. value: function subscribe() {}
  17419. //
  17420. /**
  17421. * Unsubscribe from a channel.
  17422. */
  17423. }, {
  17424. key: 'unsubscribe',
  17425. value: function unsubscribe() {}
  17426. //
  17427. /**
  17428. * Listen for an event on the channel instance.
  17429. */
  17430. }, {
  17431. key: 'listen',
  17432. value: function listen(event, callback) {
  17433. return this;
  17434. }
  17435. /**
  17436. * Stop listening for an event on the channel instance.
  17437. */
  17438. }, {
  17439. key: 'stopListening',
  17440. value: function stopListening(event) {
  17441. return this;
  17442. }
  17443. /**
  17444. * Bind a channel to an event.
  17445. */
  17446. }, {
  17447. key: 'on',
  17448. value: function on(event, callback) {
  17449. return this;
  17450. }
  17451. }]);
  17452. return NullChannel;
  17453. }(Channel);
  17454. /**
  17455. * This class represents a null private channel.
  17456. */
  17457. var NullPrivateChannel = function (_NullChannel) {
  17458. inherits(NullPrivateChannel, _NullChannel);
  17459. function NullPrivateChannel() {
  17460. classCallCheck(this, NullPrivateChannel);
  17461. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17462. }
  17463. createClass(NullPrivateChannel, [{
  17464. key: 'whisper',
  17465. /**
  17466. * Trigger client event on the channel.
  17467. */
  17468. value: function whisper(eventName, data) {
  17469. return this;
  17470. }
  17471. }]);
  17472. return NullPrivateChannel;
  17473. }(NullChannel);
  17474. /**
  17475. * This class represents a null presence channel.
  17476. */
  17477. var NullPresenceChannel = function (_NullChannel) {
  17478. inherits(NullPresenceChannel, _NullChannel);
  17479. function NullPresenceChannel() {
  17480. classCallCheck(this, NullPresenceChannel);
  17481. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17482. }
  17483. createClass(NullPresenceChannel, [{
  17484. key: 'here',
  17485. /**
  17486. * Register a callback to be called anytime the member list changes.
  17487. */
  17488. value: function here(callback) {
  17489. return this;
  17490. }
  17491. /**
  17492. * Listen for someone joining the channel.
  17493. */
  17494. }, {
  17495. key: 'joining',
  17496. value: function joining(callback) {
  17497. return this;
  17498. }
  17499. /**
  17500. * Listen for someone leaving the channel.
  17501. */
  17502. }, {
  17503. key: 'leaving',
  17504. value: function leaving(callback) {
  17505. return this;
  17506. }
  17507. /**
  17508. * Trigger client event on the channel.
  17509. */
  17510. }, {
  17511. key: 'whisper',
  17512. value: function whisper(eventName, data) {
  17513. return this;
  17514. }
  17515. }]);
  17516. return NullPresenceChannel;
  17517. }(NullChannel);
  17518. /**
  17519. * This class creates a connector to Pusher.
  17520. */
  17521. var PusherConnector = function (_Connector) {
  17522. inherits(PusherConnector, _Connector);
  17523. function PusherConnector() {
  17524. classCallCheck(this, PusherConnector);
  17525. /**
  17526. * All of the subscribed channel names.
  17527. */
  17528. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17529. _this.channels = {};
  17530. return _this;
  17531. }
  17532. /**
  17533. * Create a fresh Pusher connection.
  17534. */
  17535. createClass(PusherConnector, [{
  17536. key: 'connect',
  17537. value: function connect() {
  17538. if (typeof this.options.client !== 'undefined') {
  17539. this.pusher = this.options.client;
  17540. } else {
  17541. this.pusher = new Pusher(this.options.key, this.options);
  17542. }
  17543. }
  17544. /**
  17545. * Listen for an event on a channel instance.
  17546. */
  17547. }, {
  17548. key: 'listen',
  17549. value: function listen(name, event, callback) {
  17550. return this.channel(name).listen(event, callback);
  17551. }
  17552. /**
  17553. * Get a channel instance by name.
  17554. */
  17555. }, {
  17556. key: 'channel',
  17557. value: function channel(name) {
  17558. if (!this.channels[name]) {
  17559. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17560. }
  17561. return this.channels[name];
  17562. }
  17563. /**
  17564. * Get a private channel instance by name.
  17565. */
  17566. }, {
  17567. key: 'privateChannel',
  17568. value: function privateChannel(name) {
  17569. if (!this.channels['private-' + name]) {
  17570. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17571. }
  17572. return this.channels['private-' + name];
  17573. }
  17574. /**
  17575. * Get a presence channel instance by name.
  17576. */
  17577. }, {
  17578. key: 'presenceChannel',
  17579. value: function presenceChannel(name) {
  17580. if (!this.channels['presence-' + name]) {
  17581. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17582. }
  17583. return this.channels['presence-' + name];
  17584. }
  17585. /**
  17586. * Leave the given channel, as well as its private and presence variants.
  17587. */
  17588. }, {
  17589. key: 'leave',
  17590. value: function leave(name) {
  17591. var _this2 = this;
  17592. var channels = [name, 'private-' + name, 'presence-' + name];
  17593. channels.forEach(function (name, index) {
  17594. _this2.leaveChannel(name);
  17595. });
  17596. }
  17597. /**
  17598. * Leave the given channel.
  17599. */
  17600. }, {
  17601. key: 'leaveChannel',
  17602. value: function leaveChannel(name) {
  17603. if (this.channels[name]) {
  17604. this.channels[name].unsubscribe();
  17605. delete this.channels[name];
  17606. }
  17607. }
  17608. /**
  17609. * Get the socket ID for the connection.
  17610. */
  17611. }, {
  17612. key: 'socketId',
  17613. value: function socketId() {
  17614. return this.pusher.connection.socket_id;
  17615. }
  17616. /**
  17617. * Disconnect Pusher connection.
  17618. */
  17619. }, {
  17620. key: 'disconnect',
  17621. value: function disconnect() {
  17622. this.pusher.disconnect();
  17623. }
  17624. }]);
  17625. return PusherConnector;
  17626. }(Connector);
  17627. /**
  17628. * This class creates a connnector to a Socket.io server.
  17629. */
  17630. var SocketIoConnector = function (_Connector) {
  17631. inherits(SocketIoConnector, _Connector);
  17632. function SocketIoConnector() {
  17633. classCallCheck(this, SocketIoConnector);
  17634. /**
  17635. * All of the subscribed channel names.
  17636. */
  17637. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17638. _this.channels = {};
  17639. return _this;
  17640. }
  17641. /**
  17642. * Create a fresh Socket.io connection.
  17643. */
  17644. createClass(SocketIoConnector, [{
  17645. key: 'connect',
  17646. value: function connect() {
  17647. var io = this.getSocketIO();
  17648. this.socket = io(this.options.host, this.options);
  17649. return this.socket;
  17650. }
  17651. /**
  17652. * Get socket.io module from global scope or options.
  17653. */
  17654. }, {
  17655. key: 'getSocketIO',
  17656. value: function getSocketIO() {
  17657. if (typeof this.options.client !== 'undefined') {
  17658. return this.options.client;
  17659. }
  17660. if (typeof io !== 'undefined') {
  17661. return io;
  17662. }
  17663. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17664. }
  17665. /**
  17666. * Listen for an event on a channel instance.
  17667. */
  17668. }, {
  17669. key: 'listen',
  17670. value: function listen(name, event, callback) {
  17671. return this.channel(name).listen(event, callback);
  17672. }
  17673. /**
  17674. * Get a channel instance by name.
  17675. */
  17676. }, {
  17677. key: 'channel',
  17678. value: function channel(name) {
  17679. if (!this.channels[name]) {
  17680. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17681. }
  17682. return this.channels[name];
  17683. }
  17684. /**
  17685. * Get a private channel instance by name.
  17686. */
  17687. }, {
  17688. key: 'privateChannel',
  17689. value: function privateChannel(name) {
  17690. if (!this.channels['private-' + name]) {
  17691. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17692. }
  17693. return this.channels['private-' + name];
  17694. }
  17695. /**
  17696. * Get a presence channel instance by name.
  17697. */
  17698. }, {
  17699. key: 'presenceChannel',
  17700. value: function presenceChannel(name) {
  17701. if (!this.channels['presence-' + name]) {
  17702. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17703. }
  17704. return this.channels['presence-' + name];
  17705. }
  17706. /**
  17707. * Leave the given channel, as well as its private and presence variants.
  17708. */
  17709. }, {
  17710. key: 'leave',
  17711. value: function leave(name) {
  17712. var _this2 = this;
  17713. var channels = [name, 'private-' + name, 'presence-' + name];
  17714. channels.forEach(function (name) {
  17715. _this2.leaveChannel(name);
  17716. });
  17717. }
  17718. /**
  17719. * Leave the given channel.
  17720. */
  17721. }, {
  17722. key: 'leaveChannel',
  17723. value: function leaveChannel(name) {
  17724. if (this.channels[name]) {
  17725. this.channels[name].unsubscribe();
  17726. delete this.channels[name];
  17727. }
  17728. }
  17729. /**
  17730. * Get the socket ID for the connection.
  17731. */
  17732. }, {
  17733. key: 'socketId',
  17734. value: function socketId() {
  17735. return this.socket.id;
  17736. }
  17737. /**
  17738. * Disconnect Socketio connection.
  17739. */
  17740. }, {
  17741. key: 'disconnect',
  17742. value: function disconnect() {
  17743. this.socket.disconnect();
  17744. }
  17745. }]);
  17746. return SocketIoConnector;
  17747. }(Connector);
  17748. /**
  17749. * This class creates a null connector.
  17750. */
  17751. var NullConnector = function (_Connector) {
  17752. inherits(NullConnector, _Connector);
  17753. function NullConnector() {
  17754. classCallCheck(this, NullConnector);
  17755. /**
  17756. * All of the subscribed channel names.
  17757. */
  17758. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  17759. _this.channels = {};
  17760. return _this;
  17761. }
  17762. /**
  17763. * Create a fresh connection.
  17764. */
  17765. createClass(NullConnector, [{
  17766. key: 'connect',
  17767. value: function connect() {}
  17768. //
  17769. /**
  17770. * Listen for an event on a channel instance.
  17771. */
  17772. }, {
  17773. key: 'listen',
  17774. value: function listen(name, event, callback) {
  17775. return new NullChannel();
  17776. }
  17777. /**
  17778. * Get a channel instance by name.
  17779. */
  17780. }, {
  17781. key: 'channel',
  17782. value: function channel(name) {
  17783. return new NullChannel();
  17784. }
  17785. /**
  17786. * Get a private channel instance by name.
  17787. */
  17788. }, {
  17789. key: 'privateChannel',
  17790. value: function privateChannel(name) {
  17791. return new NullPrivateChannel();
  17792. }
  17793. /**
  17794. * Get a presence channel instance by name.
  17795. */
  17796. }, {
  17797. key: 'presenceChannel',
  17798. value: function presenceChannel(name) {
  17799. return new NullPresenceChannel();
  17800. }
  17801. /**
  17802. * Leave the given channel, as well as its private and presence variants.
  17803. */
  17804. }, {
  17805. key: 'leave',
  17806. value: function leave(name) {}
  17807. //
  17808. /**
  17809. * Leave the given channel.
  17810. */
  17811. }, {
  17812. key: 'leaveChannel',
  17813. value: function leaveChannel(name) {}
  17814. //
  17815. /**
  17816. * Get the socket ID for the connection.
  17817. */
  17818. }, {
  17819. key: 'socketId',
  17820. value: function socketId() {
  17821. return 'fake-socket-id';
  17822. }
  17823. /**
  17824. * Disconnect the connection.
  17825. */
  17826. }, {
  17827. key: 'disconnect',
  17828. value: function disconnect() {
  17829. //
  17830. }
  17831. }]);
  17832. return NullConnector;
  17833. }(Connector);
  17834. /**
  17835. * This class is the primary API for interacting with broadcasting.
  17836. */
  17837. var Echo = function () {
  17838. /**
  17839. * Create a new class instance.
  17840. */
  17841. function Echo(options) {
  17842. classCallCheck(this, Echo);
  17843. this.options = options;
  17844. this.connect();
  17845. if (!this.options.withoutInterceptors) {
  17846. this.registerInterceptors();
  17847. }
  17848. }
  17849. /**
  17850. * Get a channel instance by name.
  17851. */
  17852. createClass(Echo, [{
  17853. key: 'channel',
  17854. value: function channel(_channel) {
  17855. return this.connector.channel(_channel);
  17856. }
  17857. /**
  17858. * Create a new connection.
  17859. */
  17860. }, {
  17861. key: 'connect',
  17862. value: function connect() {
  17863. if (this.options.broadcaster == 'pusher') {
  17864. this.connector = new PusherConnector(this.options);
  17865. } else if (this.options.broadcaster == 'socket.io') {
  17866. this.connector = new SocketIoConnector(this.options);
  17867. } else if (this.options.broadcaster == 'null') {
  17868. this.connector = new NullConnector(this.options);
  17869. } else if (typeof this.options.broadcaster == 'function') {
  17870. this.connector = new this.options.broadcaster(this.options);
  17871. }
  17872. }
  17873. /**
  17874. * Disconnect from the Echo server.
  17875. */
  17876. }, {
  17877. key: 'disconnect',
  17878. value: function disconnect() {
  17879. this.connector.disconnect();
  17880. }
  17881. /**
  17882. * Get a presence channel instance by name.
  17883. */
  17884. }, {
  17885. key: 'join',
  17886. value: function join(channel) {
  17887. return this.connector.presenceChannel(channel);
  17888. }
  17889. /**
  17890. * Leave the given channel, as well as its private and presence variants.
  17891. */
  17892. }, {
  17893. key: 'leave',
  17894. value: function leave(channel) {
  17895. this.connector.leave(channel);
  17896. }
  17897. /**
  17898. * Leave the given channel.
  17899. */
  17900. }, {
  17901. key: 'leaveChannel',
  17902. value: function leaveChannel(channel) {
  17903. this.connector.leaveChannel(channel);
  17904. }
  17905. /**
  17906. * Listen for an event on a channel instance.
  17907. */
  17908. }, {
  17909. key: 'listen',
  17910. value: function listen(channel, event, callback) {
  17911. return this.connector.listen(channel, event, callback);
  17912. }
  17913. /**
  17914. * Get a private channel instance by name.
  17915. */
  17916. }, {
  17917. key: 'private',
  17918. value: function _private(channel) {
  17919. return this.connector.privateChannel(channel);
  17920. }
  17921. /**
  17922. * Get the Socket ID for the connection.
  17923. */
  17924. }, {
  17925. key: 'socketId',
  17926. value: function socketId() {
  17927. return this.connector.socketId();
  17928. }
  17929. /**
  17930. * Register 3rd party request interceptiors. These are used to automatically
  17931. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  17932. */
  17933. }, {
  17934. key: 'registerInterceptors',
  17935. value: function registerInterceptors() {
  17936. if (typeof Vue === 'function' && Vue.http) {
  17937. this.registerVueRequestInterceptor();
  17938. }
  17939. if (typeof axios === 'function') {
  17940. this.registerAxiosRequestInterceptor();
  17941. }
  17942. if (typeof jQuery === 'function') {
  17943. this.registerjQueryAjaxSetup();
  17944. }
  17945. }
  17946. /**
  17947. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  17948. */
  17949. }, {
  17950. key: 'registerVueRequestInterceptor',
  17951. value: function registerVueRequestInterceptor() {
  17952. var _this = this;
  17953. Vue.http.interceptors.push(function (request, next) {
  17954. if (_this.socketId()) {
  17955. request.headers.set('X-Socket-ID', _this.socketId());
  17956. }
  17957. next();
  17958. });
  17959. }
  17960. /**
  17961. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  17962. */
  17963. }, {
  17964. key: 'registerAxiosRequestInterceptor',
  17965. value: function registerAxiosRequestInterceptor() {
  17966. var _this2 = this;
  17967. axios.interceptors.request.use(function (config) {
  17968. if (_this2.socketId()) {
  17969. config.headers['X-Socket-Id'] = _this2.socketId();
  17970. }
  17971. return config;
  17972. });
  17973. }
  17974. /**
  17975. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  17976. */
  17977. }, {
  17978. key: 'registerjQueryAjaxSetup',
  17979. value: function registerjQueryAjaxSetup() {
  17980. var _this3 = this;
  17981. if (typeof jQuery.ajax != 'undefined') {
  17982. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  17983. if (_this3.socketId()) {
  17984. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  17985. }
  17986. });
  17987. }
  17988. }
  17989. }]);
  17990. return Echo;
  17991. }();
  17992. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  17993. /***/ }),
  17994. /***/ "./node_modules/lodash/lodash.js":
  17995. /*!***************************************!*\
  17996. !*** ./node_modules/lodash/lodash.js ***!
  17997. \***************************************/
  17998. /*! no static exports found */
  17999. /***/ (function(module, exports, __webpack_require__) {
  18000. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18001. * @license
  18002. * Lodash <https://lodash.com/>
  18003. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18004. * Released under MIT license <https://lodash.com/license>
  18005. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18006. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18007. */
  18008. ;(function() {
  18009. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18010. var undefined;
  18011. /** Used as the semantic version number. */
  18012. var VERSION = '4.17.15';
  18013. /** Used as the size to enable large array optimizations. */
  18014. var LARGE_ARRAY_SIZE = 200;
  18015. /** Error message constants. */
  18016. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18017. FUNC_ERROR_TEXT = 'Expected a function';
  18018. /** Used to stand-in for `undefined` hash values. */
  18019. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18020. /** Used as the maximum memoize cache size. */
  18021. var MAX_MEMOIZE_SIZE = 500;
  18022. /** Used as the internal argument placeholder. */
  18023. var PLACEHOLDER = '__lodash_placeholder__';
  18024. /** Used to compose bitmasks for cloning. */
  18025. var CLONE_DEEP_FLAG = 1,
  18026. CLONE_FLAT_FLAG = 2,
  18027. CLONE_SYMBOLS_FLAG = 4;
  18028. /** Used to compose bitmasks for value comparisons. */
  18029. var COMPARE_PARTIAL_FLAG = 1,
  18030. COMPARE_UNORDERED_FLAG = 2;
  18031. /** Used to compose bitmasks for function metadata. */
  18032. var WRAP_BIND_FLAG = 1,
  18033. WRAP_BIND_KEY_FLAG = 2,
  18034. WRAP_CURRY_BOUND_FLAG = 4,
  18035. WRAP_CURRY_FLAG = 8,
  18036. WRAP_CURRY_RIGHT_FLAG = 16,
  18037. WRAP_PARTIAL_FLAG = 32,
  18038. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18039. WRAP_ARY_FLAG = 128,
  18040. WRAP_REARG_FLAG = 256,
  18041. WRAP_FLIP_FLAG = 512;
  18042. /** Used as default options for `_.truncate`. */
  18043. var DEFAULT_TRUNC_LENGTH = 30,
  18044. DEFAULT_TRUNC_OMISSION = '...';
  18045. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18046. var HOT_COUNT = 800,
  18047. HOT_SPAN = 16;
  18048. /** Used to indicate the type of lazy iteratees. */
  18049. var LAZY_FILTER_FLAG = 1,
  18050. LAZY_MAP_FLAG = 2,
  18051. LAZY_WHILE_FLAG = 3;
  18052. /** Used as references for various `Number` constants. */
  18053. var INFINITY = 1 / 0,
  18054. MAX_SAFE_INTEGER = 9007199254740991,
  18055. MAX_INTEGER = 1.7976931348623157e+308,
  18056. NAN = 0 / 0;
  18057. /** Used as references for the maximum length and index of an array. */
  18058. var MAX_ARRAY_LENGTH = 4294967295,
  18059. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18060. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18061. /** Used to associate wrap methods with their bit flags. */
  18062. var wrapFlags = [
  18063. ['ary', WRAP_ARY_FLAG],
  18064. ['bind', WRAP_BIND_FLAG],
  18065. ['bindKey', WRAP_BIND_KEY_FLAG],
  18066. ['curry', WRAP_CURRY_FLAG],
  18067. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18068. ['flip', WRAP_FLIP_FLAG],
  18069. ['partial', WRAP_PARTIAL_FLAG],
  18070. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18071. ['rearg', WRAP_REARG_FLAG]
  18072. ];
  18073. /** `Object#toString` result references. */
  18074. var argsTag = '[object Arguments]',
  18075. arrayTag = '[object Array]',
  18076. asyncTag = '[object AsyncFunction]',
  18077. boolTag = '[object Boolean]',
  18078. dateTag = '[object Date]',
  18079. domExcTag = '[object DOMException]',
  18080. errorTag = '[object Error]',
  18081. funcTag = '[object Function]',
  18082. genTag = '[object GeneratorFunction]',
  18083. mapTag = '[object Map]',
  18084. numberTag = '[object Number]',
  18085. nullTag = '[object Null]',
  18086. objectTag = '[object Object]',
  18087. promiseTag = '[object Promise]',
  18088. proxyTag = '[object Proxy]',
  18089. regexpTag = '[object RegExp]',
  18090. setTag = '[object Set]',
  18091. stringTag = '[object String]',
  18092. symbolTag = '[object Symbol]',
  18093. undefinedTag = '[object Undefined]',
  18094. weakMapTag = '[object WeakMap]',
  18095. weakSetTag = '[object WeakSet]';
  18096. var arrayBufferTag = '[object ArrayBuffer]',
  18097. dataViewTag = '[object DataView]',
  18098. float32Tag = '[object Float32Array]',
  18099. float64Tag = '[object Float64Array]',
  18100. int8Tag = '[object Int8Array]',
  18101. int16Tag = '[object Int16Array]',
  18102. int32Tag = '[object Int32Array]',
  18103. uint8Tag = '[object Uint8Array]',
  18104. uint8ClampedTag = '[object Uint8ClampedArray]',
  18105. uint16Tag = '[object Uint16Array]',
  18106. uint32Tag = '[object Uint32Array]';
  18107. /** Used to match empty string literals in compiled template source. */
  18108. var reEmptyStringLeading = /\b__p \+= '';/g,
  18109. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18110. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18111. /** Used to match HTML entities and HTML characters. */
  18112. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18113. reUnescapedHtml = /[&<>"']/g,
  18114. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18115. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18116. /** Used to match template delimiters. */
  18117. var reEscape = /<%-([\s\S]+?)%>/g,
  18118. reEvaluate = /<%([\s\S]+?)%>/g,
  18119. reInterpolate = /<%=([\s\S]+?)%>/g;
  18120. /** Used to match property names within property paths. */
  18121. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18122. reIsPlainProp = /^\w*$/,
  18123. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18124. /**
  18125. * Used to match `RegExp`
  18126. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18127. */
  18128. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18129. reHasRegExpChar = RegExp(reRegExpChar.source);
  18130. /** Used to match leading and trailing whitespace. */
  18131. var reTrim = /^\s+|\s+$/g,
  18132. reTrimStart = /^\s+/,
  18133. reTrimEnd = /\s+$/;
  18134. /** Used to match wrap detail comments. */
  18135. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18136. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18137. reSplitDetails = /,? & /;
  18138. /** Used to match words composed of alphanumeric characters. */
  18139. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18140. /** Used to match backslashes in property paths. */
  18141. var reEscapeChar = /\\(\\)?/g;
  18142. /**
  18143. * Used to match
  18144. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18145. */
  18146. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18147. /** Used to match `RegExp` flags from their coerced string values. */
  18148. var reFlags = /\w*$/;
  18149. /** Used to detect bad signed hexadecimal string values. */
  18150. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18151. /** Used to detect binary string values. */
  18152. var reIsBinary = /^0b[01]+$/i;
  18153. /** Used to detect host constructors (Safari). */
  18154. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18155. /** Used to detect octal string values. */
  18156. var reIsOctal = /^0o[0-7]+$/i;
  18157. /** Used to detect unsigned integer values. */
  18158. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18159. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18160. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18161. /** Used to ensure capturing order of template delimiters. */
  18162. var reNoMatch = /($^)/;
  18163. /** Used to match unescaped characters in compiled string literals. */
  18164. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18165. /** Used to compose unicode character classes. */
  18166. var rsAstralRange = '\\ud800-\\udfff',
  18167. rsComboMarksRange = '\\u0300-\\u036f',
  18168. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18169. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18170. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18171. rsDingbatRange = '\\u2700-\\u27bf',
  18172. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18173. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18174. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18175. rsPunctuationRange = '\\u2000-\\u206f',
  18176. 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',
  18177. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18178. rsVarRange = '\\ufe0e\\ufe0f',
  18179. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18180. /** Used to compose unicode capture groups. */
  18181. var rsApos = "['\u2019]",
  18182. rsAstral = '[' + rsAstralRange + ']',
  18183. rsBreak = '[' + rsBreakRange + ']',
  18184. rsCombo = '[' + rsComboRange + ']',
  18185. rsDigits = '\\d+',
  18186. rsDingbat = '[' + rsDingbatRange + ']',
  18187. rsLower = '[' + rsLowerRange + ']',
  18188. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18189. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18190. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18191. rsNonAstral = '[^' + rsAstralRange + ']',
  18192. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18193. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18194. rsUpper = '[' + rsUpperRange + ']',
  18195. rsZWJ = '\\u200d';
  18196. /** Used to compose unicode regexes. */
  18197. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18198. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18199. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18200. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18201. reOptMod = rsModifier + '?',
  18202. rsOptVar = '[' + rsVarRange + ']?',
  18203. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18204. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18205. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18206. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18207. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18208. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18209. /** Used to match apostrophes. */
  18210. var reApos = RegExp(rsApos, 'g');
  18211. /**
  18212. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18213. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18214. */
  18215. var reComboMark = RegExp(rsCombo, 'g');
  18216. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18217. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18218. /** Used to match complex or compound words. */
  18219. var reUnicodeWord = RegExp([
  18220. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18221. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18222. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18223. rsUpper + '+' + rsOptContrUpper,
  18224. rsOrdUpper,
  18225. rsOrdLower,
  18226. rsDigits,
  18227. rsEmoji
  18228. ].join('|'), 'g');
  18229. /** 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/). */
  18230. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18231. /** Used to detect strings that need a more robust regexp to match words. */
  18232. 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 ]/;
  18233. /** Used to assign default `context` object properties. */
  18234. var contextProps = [
  18235. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18236. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18237. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18238. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18239. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18240. ];
  18241. /** Used to make template sourceURLs easier to identify. */
  18242. var templateCounter = -1;
  18243. /** Used to identify `toStringTag` values of typed arrays. */
  18244. var typedArrayTags = {};
  18245. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18246. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18247. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18248. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18249. typedArrayTags[uint32Tag] = true;
  18250. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18251. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18252. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18253. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18254. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18255. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18256. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18257. typedArrayTags[weakMapTag] = false;
  18258. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18259. var cloneableTags = {};
  18260. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18261. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18262. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18263. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18264. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18265. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18266. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18267. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18268. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18269. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18270. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18271. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18272. cloneableTags[weakMapTag] = false;
  18273. /** Used to map Latin Unicode letters to basic Latin letters. */
  18274. var deburredLetters = {
  18275. // Latin-1 Supplement block.
  18276. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18277. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18278. '\xc7': 'C', '\xe7': 'c',
  18279. '\xd0': 'D', '\xf0': 'd',
  18280. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18281. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18282. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18283. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18284. '\xd1': 'N', '\xf1': 'n',
  18285. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18286. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18287. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18288. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18289. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18290. '\xc6': 'Ae', '\xe6': 'ae',
  18291. '\xde': 'Th', '\xfe': 'th',
  18292. '\xdf': 'ss',
  18293. // Latin Extended-A block.
  18294. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18295. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18296. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18297. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18298. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18299. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18300. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18301. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18302. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18303. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18304. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18305. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18306. '\u0134': 'J', '\u0135': 'j',
  18307. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18308. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18309. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18310. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18311. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18312. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18313. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18314. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18315. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18316. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18317. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18318. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18319. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18320. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18321. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18322. '\u0174': 'W', '\u0175': 'w',
  18323. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18324. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18325. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18326. '\u0132': 'IJ', '\u0133': 'ij',
  18327. '\u0152': 'Oe', '\u0153': 'oe',
  18328. '\u0149': "'n", '\u017f': 's'
  18329. };
  18330. /** Used to map characters to HTML entities. */
  18331. var htmlEscapes = {
  18332. '&': '&amp;',
  18333. '<': '&lt;',
  18334. '>': '&gt;',
  18335. '"': '&quot;',
  18336. "'": '&#39;'
  18337. };
  18338. /** Used to map HTML entities to characters. */
  18339. var htmlUnescapes = {
  18340. '&amp;': '&',
  18341. '&lt;': '<',
  18342. '&gt;': '>',
  18343. '&quot;': '"',
  18344. '&#39;': "'"
  18345. };
  18346. /** Used to escape characters for inclusion in compiled string literals. */
  18347. var stringEscapes = {
  18348. '\\': '\\',
  18349. "'": "'",
  18350. '\n': 'n',
  18351. '\r': 'r',
  18352. '\u2028': 'u2028',
  18353. '\u2029': 'u2029'
  18354. };
  18355. /** Built-in method references without a dependency on `root`. */
  18356. var freeParseFloat = parseFloat,
  18357. freeParseInt = parseInt;
  18358. /** Detect free variable `global` from Node.js. */
  18359. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18360. /** Detect free variable `self`. */
  18361. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18362. /** Used as a reference to the global object. */
  18363. var root = freeGlobal || freeSelf || Function('return this')();
  18364. /** Detect free variable `exports`. */
  18365. var freeExports = true && exports && !exports.nodeType && exports;
  18366. /** Detect free variable `module`. */
  18367. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18368. /** Detect the popular CommonJS extension `module.exports`. */
  18369. var moduleExports = freeModule && freeModule.exports === freeExports;
  18370. /** Detect free variable `process` from Node.js. */
  18371. var freeProcess = moduleExports && freeGlobal.process;
  18372. /** Used to access faster Node.js helpers. */
  18373. var nodeUtil = (function() {
  18374. try {
  18375. // Use `util.types` for Node.js 10+.
  18376. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18377. if (types) {
  18378. return types;
  18379. }
  18380. // Legacy `process.binding('util')` for Node.js < 10.
  18381. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18382. } catch (e) {}
  18383. }());
  18384. /* Node.js helper references. */
  18385. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18386. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18387. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18388. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18389. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18390. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18391. /*--------------------------------------------------------------------------*/
  18392. /**
  18393. * A faster alternative to `Function#apply`, this function invokes `func`
  18394. * with the `this` binding of `thisArg` and the arguments of `args`.
  18395. *
  18396. * @private
  18397. * @param {Function} func The function to invoke.
  18398. * @param {*} thisArg The `this` binding of `func`.
  18399. * @param {Array} args The arguments to invoke `func` with.
  18400. * @returns {*} Returns the result of `func`.
  18401. */
  18402. function apply(func, thisArg, args) {
  18403. switch (args.length) {
  18404. case 0: return func.call(thisArg);
  18405. case 1: return func.call(thisArg, args[0]);
  18406. case 2: return func.call(thisArg, args[0], args[1]);
  18407. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18408. }
  18409. return func.apply(thisArg, args);
  18410. }
  18411. /**
  18412. * A specialized version of `baseAggregator` for arrays.
  18413. *
  18414. * @private
  18415. * @param {Array} [array] The array to iterate over.
  18416. * @param {Function} setter The function to set `accumulator` values.
  18417. * @param {Function} iteratee The iteratee to transform keys.
  18418. * @param {Object} accumulator The initial aggregated object.
  18419. * @returns {Function} Returns `accumulator`.
  18420. */
  18421. function arrayAggregator(array, setter, iteratee, accumulator) {
  18422. var index = -1,
  18423. length = array == null ? 0 : array.length;
  18424. while (++index < length) {
  18425. var value = array[index];
  18426. setter(accumulator, value, iteratee(value), array);
  18427. }
  18428. return accumulator;
  18429. }
  18430. /**
  18431. * A specialized version of `_.forEach` for arrays without support for
  18432. * iteratee shorthands.
  18433. *
  18434. * @private
  18435. * @param {Array} [array] The array to iterate over.
  18436. * @param {Function} iteratee The function invoked per iteration.
  18437. * @returns {Array} Returns `array`.
  18438. */
  18439. function arrayEach(array, iteratee) {
  18440. var index = -1,
  18441. length = array == null ? 0 : array.length;
  18442. while (++index < length) {
  18443. if (iteratee(array[index], index, array) === false) {
  18444. break;
  18445. }
  18446. }
  18447. return array;
  18448. }
  18449. /**
  18450. * A specialized version of `_.forEachRight` for arrays without support for
  18451. * iteratee shorthands.
  18452. *
  18453. * @private
  18454. * @param {Array} [array] The array to iterate over.
  18455. * @param {Function} iteratee The function invoked per iteration.
  18456. * @returns {Array} Returns `array`.
  18457. */
  18458. function arrayEachRight(array, iteratee) {
  18459. var length = array == null ? 0 : array.length;
  18460. while (length--) {
  18461. if (iteratee(array[length], length, array) === false) {
  18462. break;
  18463. }
  18464. }
  18465. return array;
  18466. }
  18467. /**
  18468. * A specialized version of `_.every` for arrays without support for
  18469. * iteratee shorthands.
  18470. *
  18471. * @private
  18472. * @param {Array} [array] The array to iterate over.
  18473. * @param {Function} predicate The function invoked per iteration.
  18474. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18475. * else `false`.
  18476. */
  18477. function arrayEvery(array, predicate) {
  18478. var index = -1,
  18479. length = array == null ? 0 : array.length;
  18480. while (++index < length) {
  18481. if (!predicate(array[index], index, array)) {
  18482. return false;
  18483. }
  18484. }
  18485. return true;
  18486. }
  18487. /**
  18488. * A specialized version of `_.filter` for arrays without support for
  18489. * iteratee shorthands.
  18490. *
  18491. * @private
  18492. * @param {Array} [array] The array to iterate over.
  18493. * @param {Function} predicate The function invoked per iteration.
  18494. * @returns {Array} Returns the new filtered array.
  18495. */
  18496. function arrayFilter(array, predicate) {
  18497. var index = -1,
  18498. length = array == null ? 0 : array.length,
  18499. resIndex = 0,
  18500. result = [];
  18501. while (++index < length) {
  18502. var value = array[index];
  18503. if (predicate(value, index, array)) {
  18504. result[resIndex++] = value;
  18505. }
  18506. }
  18507. return result;
  18508. }
  18509. /**
  18510. * A specialized version of `_.includes` for arrays without support for
  18511. * specifying an index to search from.
  18512. *
  18513. * @private
  18514. * @param {Array} [array] The array to inspect.
  18515. * @param {*} target The value to search for.
  18516. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18517. */
  18518. function arrayIncludes(array, value) {
  18519. var length = array == null ? 0 : array.length;
  18520. return !!length && baseIndexOf(array, value, 0) > -1;
  18521. }
  18522. /**
  18523. * This function is like `arrayIncludes` except that it accepts a comparator.
  18524. *
  18525. * @private
  18526. * @param {Array} [array] The array to inspect.
  18527. * @param {*} target The value to search for.
  18528. * @param {Function} comparator The comparator invoked per element.
  18529. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18530. */
  18531. function arrayIncludesWith(array, value, comparator) {
  18532. var index = -1,
  18533. length = array == null ? 0 : array.length;
  18534. while (++index < length) {
  18535. if (comparator(value, array[index])) {
  18536. return true;
  18537. }
  18538. }
  18539. return false;
  18540. }
  18541. /**
  18542. * A specialized version of `_.map` for arrays without support for iteratee
  18543. * shorthands.
  18544. *
  18545. * @private
  18546. * @param {Array} [array] The array to iterate over.
  18547. * @param {Function} iteratee The function invoked per iteration.
  18548. * @returns {Array} Returns the new mapped array.
  18549. */
  18550. function arrayMap(array, iteratee) {
  18551. var index = -1,
  18552. length = array == null ? 0 : array.length,
  18553. result = Array(length);
  18554. while (++index < length) {
  18555. result[index] = iteratee(array[index], index, array);
  18556. }
  18557. return result;
  18558. }
  18559. /**
  18560. * Appends the elements of `values` to `array`.
  18561. *
  18562. * @private
  18563. * @param {Array} array The array to modify.
  18564. * @param {Array} values The values to append.
  18565. * @returns {Array} Returns `array`.
  18566. */
  18567. function arrayPush(array, values) {
  18568. var index = -1,
  18569. length = values.length,
  18570. offset = array.length;
  18571. while (++index < length) {
  18572. array[offset + index] = values[index];
  18573. }
  18574. return array;
  18575. }
  18576. /**
  18577. * A specialized version of `_.reduce` for arrays without support for
  18578. * iteratee shorthands.
  18579. *
  18580. * @private
  18581. * @param {Array} [array] The array to iterate over.
  18582. * @param {Function} iteratee The function invoked per iteration.
  18583. * @param {*} [accumulator] The initial value.
  18584. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18585. * the initial value.
  18586. * @returns {*} Returns the accumulated value.
  18587. */
  18588. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18589. var index = -1,
  18590. length = array == null ? 0 : array.length;
  18591. if (initAccum && length) {
  18592. accumulator = array[++index];
  18593. }
  18594. while (++index < length) {
  18595. accumulator = iteratee(accumulator, array[index], index, array);
  18596. }
  18597. return accumulator;
  18598. }
  18599. /**
  18600. * A specialized version of `_.reduceRight` for arrays without support for
  18601. * iteratee shorthands.
  18602. *
  18603. * @private
  18604. * @param {Array} [array] The array to iterate over.
  18605. * @param {Function} iteratee The function invoked per iteration.
  18606. * @param {*} [accumulator] The initial value.
  18607. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18608. * the initial value.
  18609. * @returns {*} Returns the accumulated value.
  18610. */
  18611. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18612. var length = array == null ? 0 : array.length;
  18613. if (initAccum && length) {
  18614. accumulator = array[--length];
  18615. }
  18616. while (length--) {
  18617. accumulator = iteratee(accumulator, array[length], length, array);
  18618. }
  18619. return accumulator;
  18620. }
  18621. /**
  18622. * A specialized version of `_.some` for arrays without support for iteratee
  18623. * shorthands.
  18624. *
  18625. * @private
  18626. * @param {Array} [array] The array to iterate over.
  18627. * @param {Function} predicate The function invoked per iteration.
  18628. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18629. * else `false`.
  18630. */
  18631. function arraySome(array, predicate) {
  18632. var index = -1,
  18633. length = array == null ? 0 : array.length;
  18634. while (++index < length) {
  18635. if (predicate(array[index], index, array)) {
  18636. return true;
  18637. }
  18638. }
  18639. return false;
  18640. }
  18641. /**
  18642. * Gets the size of an ASCII `string`.
  18643. *
  18644. * @private
  18645. * @param {string} string The string inspect.
  18646. * @returns {number} Returns the string size.
  18647. */
  18648. var asciiSize = baseProperty('length');
  18649. /**
  18650. * Converts an ASCII `string` to an array.
  18651. *
  18652. * @private
  18653. * @param {string} string The string to convert.
  18654. * @returns {Array} Returns the converted array.
  18655. */
  18656. function asciiToArray(string) {
  18657. return string.split('');
  18658. }
  18659. /**
  18660. * Splits an ASCII `string` into an array of its words.
  18661. *
  18662. * @private
  18663. * @param {string} The string to inspect.
  18664. * @returns {Array} Returns the words of `string`.
  18665. */
  18666. function asciiWords(string) {
  18667. return string.match(reAsciiWord) || [];
  18668. }
  18669. /**
  18670. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18671. * without support for iteratee shorthands, which iterates over `collection`
  18672. * using `eachFunc`.
  18673. *
  18674. * @private
  18675. * @param {Array|Object} collection The collection to inspect.
  18676. * @param {Function} predicate The function invoked per iteration.
  18677. * @param {Function} eachFunc The function to iterate over `collection`.
  18678. * @returns {*} Returns the found element or its key, else `undefined`.
  18679. */
  18680. function baseFindKey(collection, predicate, eachFunc) {
  18681. var result;
  18682. eachFunc(collection, function(value, key, collection) {
  18683. if (predicate(value, key, collection)) {
  18684. result = key;
  18685. return false;
  18686. }
  18687. });
  18688. return result;
  18689. }
  18690. /**
  18691. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18692. * support for iteratee shorthands.
  18693. *
  18694. * @private
  18695. * @param {Array} array The array to inspect.
  18696. * @param {Function} predicate The function invoked per iteration.
  18697. * @param {number} fromIndex The index to search from.
  18698. * @param {boolean} [fromRight] Specify iterating from right to left.
  18699. * @returns {number} Returns the index of the matched value, else `-1`.
  18700. */
  18701. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18702. var length = array.length,
  18703. index = fromIndex + (fromRight ? 1 : -1);
  18704. while ((fromRight ? index-- : ++index < length)) {
  18705. if (predicate(array[index], index, array)) {
  18706. return index;
  18707. }
  18708. }
  18709. return -1;
  18710. }
  18711. /**
  18712. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18713. *
  18714. * @private
  18715. * @param {Array} array The array to inspect.
  18716. * @param {*} value The value to search for.
  18717. * @param {number} fromIndex The index to search from.
  18718. * @returns {number} Returns the index of the matched value, else `-1`.
  18719. */
  18720. function baseIndexOf(array, value, fromIndex) {
  18721. return value === value
  18722. ? strictIndexOf(array, value, fromIndex)
  18723. : baseFindIndex(array, baseIsNaN, fromIndex);
  18724. }
  18725. /**
  18726. * This function is like `baseIndexOf` except that it accepts a comparator.
  18727. *
  18728. * @private
  18729. * @param {Array} array The array to inspect.
  18730. * @param {*} value The value to search for.
  18731. * @param {number} fromIndex The index to search from.
  18732. * @param {Function} comparator The comparator invoked per element.
  18733. * @returns {number} Returns the index of the matched value, else `-1`.
  18734. */
  18735. function baseIndexOfWith(array, value, fromIndex, comparator) {
  18736. var index = fromIndex - 1,
  18737. length = array.length;
  18738. while (++index < length) {
  18739. if (comparator(array[index], value)) {
  18740. return index;
  18741. }
  18742. }
  18743. return -1;
  18744. }
  18745. /**
  18746. * The base implementation of `_.isNaN` without support for number objects.
  18747. *
  18748. * @private
  18749. * @param {*} value The value to check.
  18750. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  18751. */
  18752. function baseIsNaN(value) {
  18753. return value !== value;
  18754. }
  18755. /**
  18756. * The base implementation of `_.mean` and `_.meanBy` without support for
  18757. * iteratee shorthands.
  18758. *
  18759. * @private
  18760. * @param {Array} array The array to iterate over.
  18761. * @param {Function} iteratee The function invoked per iteration.
  18762. * @returns {number} Returns the mean.
  18763. */
  18764. function baseMean(array, iteratee) {
  18765. var length = array == null ? 0 : array.length;
  18766. return length ? (baseSum(array, iteratee) / length) : NAN;
  18767. }
  18768. /**
  18769. * The base implementation of `_.property` without support for deep paths.
  18770. *
  18771. * @private
  18772. * @param {string} key The key of the property to get.
  18773. * @returns {Function} Returns the new accessor function.
  18774. */
  18775. function baseProperty(key) {
  18776. return function(object) {
  18777. return object == null ? undefined : object[key];
  18778. };
  18779. }
  18780. /**
  18781. * The base implementation of `_.propertyOf` without support for deep paths.
  18782. *
  18783. * @private
  18784. * @param {Object} object The object to query.
  18785. * @returns {Function} Returns the new accessor function.
  18786. */
  18787. function basePropertyOf(object) {
  18788. return function(key) {
  18789. return object == null ? undefined : object[key];
  18790. };
  18791. }
  18792. /**
  18793. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  18794. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  18795. *
  18796. * @private
  18797. * @param {Array|Object} collection The collection to iterate over.
  18798. * @param {Function} iteratee The function invoked per iteration.
  18799. * @param {*} accumulator The initial value.
  18800. * @param {boolean} initAccum Specify using the first or last element of
  18801. * `collection` as the initial value.
  18802. * @param {Function} eachFunc The function to iterate over `collection`.
  18803. * @returns {*} Returns the accumulated value.
  18804. */
  18805. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  18806. eachFunc(collection, function(value, index, collection) {
  18807. accumulator = initAccum
  18808. ? (initAccum = false, value)
  18809. : iteratee(accumulator, value, index, collection);
  18810. });
  18811. return accumulator;
  18812. }
  18813. /**
  18814. * The base implementation of `_.sortBy` which uses `comparer` to define the
  18815. * sort order of `array` and replaces criteria objects with their corresponding
  18816. * values.
  18817. *
  18818. * @private
  18819. * @param {Array} array The array to sort.
  18820. * @param {Function} comparer The function to define sort order.
  18821. * @returns {Array} Returns `array`.
  18822. */
  18823. function baseSortBy(array, comparer) {
  18824. var length = array.length;
  18825. array.sort(comparer);
  18826. while (length--) {
  18827. array[length] = array[length].value;
  18828. }
  18829. return array;
  18830. }
  18831. /**
  18832. * The base implementation of `_.sum` and `_.sumBy` without support for
  18833. * iteratee shorthands.
  18834. *
  18835. * @private
  18836. * @param {Array} array The array to iterate over.
  18837. * @param {Function} iteratee The function invoked per iteration.
  18838. * @returns {number} Returns the sum.
  18839. */
  18840. function baseSum(array, iteratee) {
  18841. var result,
  18842. index = -1,
  18843. length = array.length;
  18844. while (++index < length) {
  18845. var current = iteratee(array[index]);
  18846. if (current !== undefined) {
  18847. result = result === undefined ? current : (result + current);
  18848. }
  18849. }
  18850. return result;
  18851. }
  18852. /**
  18853. * The base implementation of `_.times` without support for iteratee shorthands
  18854. * or max array length checks.
  18855. *
  18856. * @private
  18857. * @param {number} n The number of times to invoke `iteratee`.
  18858. * @param {Function} iteratee The function invoked per iteration.
  18859. * @returns {Array} Returns the array of results.
  18860. */
  18861. function baseTimes(n, iteratee) {
  18862. var index = -1,
  18863. result = Array(n);
  18864. while (++index < n) {
  18865. result[index] = iteratee(index);
  18866. }
  18867. return result;
  18868. }
  18869. /**
  18870. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  18871. * of key-value pairs for `object` corresponding to the property names of `props`.
  18872. *
  18873. * @private
  18874. * @param {Object} object The object to query.
  18875. * @param {Array} props The property names to get values for.
  18876. * @returns {Object} Returns the key-value pairs.
  18877. */
  18878. function baseToPairs(object, props) {
  18879. return arrayMap(props, function(key) {
  18880. return [key, object[key]];
  18881. });
  18882. }
  18883. /**
  18884. * The base implementation of `_.unary` without support for storing metadata.
  18885. *
  18886. * @private
  18887. * @param {Function} func The function to cap arguments for.
  18888. * @returns {Function} Returns the new capped function.
  18889. */
  18890. function baseUnary(func) {
  18891. return function(value) {
  18892. return func(value);
  18893. };
  18894. }
  18895. /**
  18896. * The base implementation of `_.values` and `_.valuesIn` which creates an
  18897. * array of `object` property values corresponding to the property names
  18898. * of `props`.
  18899. *
  18900. * @private
  18901. * @param {Object} object The object to query.
  18902. * @param {Array} props The property names to get values for.
  18903. * @returns {Object} Returns the array of property values.
  18904. */
  18905. function baseValues(object, props) {
  18906. return arrayMap(props, function(key) {
  18907. return object[key];
  18908. });
  18909. }
  18910. /**
  18911. * Checks if a `cache` value for `key` exists.
  18912. *
  18913. * @private
  18914. * @param {Object} cache The cache to query.
  18915. * @param {string} key The key of the entry to check.
  18916. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  18917. */
  18918. function cacheHas(cache, key) {
  18919. return cache.has(key);
  18920. }
  18921. /**
  18922. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  18923. * that is not found in the character symbols.
  18924. *
  18925. * @private
  18926. * @param {Array} strSymbols The string symbols to inspect.
  18927. * @param {Array} chrSymbols The character symbols to find.
  18928. * @returns {number} Returns the index of the first unmatched string symbol.
  18929. */
  18930. function charsStartIndex(strSymbols, chrSymbols) {
  18931. var index = -1,
  18932. length = strSymbols.length;
  18933. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18934. return index;
  18935. }
  18936. /**
  18937. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  18938. * that is not found in the character symbols.
  18939. *
  18940. * @private
  18941. * @param {Array} strSymbols The string symbols to inspect.
  18942. * @param {Array} chrSymbols The character symbols to find.
  18943. * @returns {number} Returns the index of the last unmatched string symbol.
  18944. */
  18945. function charsEndIndex(strSymbols, chrSymbols) {
  18946. var index = strSymbols.length;
  18947. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18948. return index;
  18949. }
  18950. /**
  18951. * Gets the number of `placeholder` occurrences in `array`.
  18952. *
  18953. * @private
  18954. * @param {Array} array The array to inspect.
  18955. * @param {*} placeholder The placeholder to search for.
  18956. * @returns {number} Returns the placeholder count.
  18957. */
  18958. function countHolders(array, placeholder) {
  18959. var length = array.length,
  18960. result = 0;
  18961. while (length--) {
  18962. if (array[length] === placeholder) {
  18963. ++result;
  18964. }
  18965. }
  18966. return result;
  18967. }
  18968. /**
  18969. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  18970. * letters to basic Latin letters.
  18971. *
  18972. * @private
  18973. * @param {string} letter The matched letter to deburr.
  18974. * @returns {string} Returns the deburred letter.
  18975. */
  18976. var deburrLetter = basePropertyOf(deburredLetters);
  18977. /**
  18978. * Used by `_.escape` to convert characters to HTML entities.
  18979. *
  18980. * @private
  18981. * @param {string} chr The matched character to escape.
  18982. * @returns {string} Returns the escaped character.
  18983. */
  18984. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  18985. /**
  18986. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  18987. *
  18988. * @private
  18989. * @param {string} chr The matched character to escape.
  18990. * @returns {string} Returns the escaped character.
  18991. */
  18992. function escapeStringChar(chr) {
  18993. return '\\' + stringEscapes[chr];
  18994. }
  18995. /**
  18996. * Gets the value at `key` of `object`.
  18997. *
  18998. * @private
  18999. * @param {Object} [object] The object to query.
  19000. * @param {string} key The key of the property to get.
  19001. * @returns {*} Returns the property value.
  19002. */
  19003. function getValue(object, key) {
  19004. return object == null ? undefined : object[key];
  19005. }
  19006. /**
  19007. * Checks if `string` contains Unicode symbols.
  19008. *
  19009. * @private
  19010. * @param {string} string The string to inspect.
  19011. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19012. */
  19013. function hasUnicode(string) {
  19014. return reHasUnicode.test(string);
  19015. }
  19016. /**
  19017. * Checks if `string` contains a word composed of Unicode symbols.
  19018. *
  19019. * @private
  19020. * @param {string} string The string to inspect.
  19021. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19022. */
  19023. function hasUnicodeWord(string) {
  19024. return reHasUnicodeWord.test(string);
  19025. }
  19026. /**
  19027. * Converts `iterator` to an array.
  19028. *
  19029. * @private
  19030. * @param {Object} iterator The iterator to convert.
  19031. * @returns {Array} Returns the converted array.
  19032. */
  19033. function iteratorToArray(iterator) {
  19034. var data,
  19035. result = [];
  19036. while (!(data = iterator.next()).done) {
  19037. result.push(data.value);
  19038. }
  19039. return result;
  19040. }
  19041. /**
  19042. * Converts `map` to its key-value pairs.
  19043. *
  19044. * @private
  19045. * @param {Object} map The map to convert.
  19046. * @returns {Array} Returns the key-value pairs.
  19047. */
  19048. function mapToArray(map) {
  19049. var index = -1,
  19050. result = Array(map.size);
  19051. map.forEach(function(value, key) {
  19052. result[++index] = [key, value];
  19053. });
  19054. return result;
  19055. }
  19056. /**
  19057. * Creates a unary function that invokes `func` with its argument transformed.
  19058. *
  19059. * @private
  19060. * @param {Function} func The function to wrap.
  19061. * @param {Function} transform The argument transform.
  19062. * @returns {Function} Returns the new function.
  19063. */
  19064. function overArg(func, transform) {
  19065. return function(arg) {
  19066. return func(transform(arg));
  19067. };
  19068. }
  19069. /**
  19070. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19071. * and returns an array of their indexes.
  19072. *
  19073. * @private
  19074. * @param {Array} array The array to modify.
  19075. * @param {*} placeholder The placeholder to replace.
  19076. * @returns {Array} Returns the new array of placeholder indexes.
  19077. */
  19078. function replaceHolders(array, placeholder) {
  19079. var index = -1,
  19080. length = array.length,
  19081. resIndex = 0,
  19082. result = [];
  19083. while (++index < length) {
  19084. var value = array[index];
  19085. if (value === placeholder || value === PLACEHOLDER) {
  19086. array[index] = PLACEHOLDER;
  19087. result[resIndex++] = index;
  19088. }
  19089. }
  19090. return result;
  19091. }
  19092. /**
  19093. * Converts `set` to an array of its values.
  19094. *
  19095. * @private
  19096. * @param {Object} set The set to convert.
  19097. * @returns {Array} Returns the values.
  19098. */
  19099. function setToArray(set) {
  19100. var index = -1,
  19101. result = Array(set.size);
  19102. set.forEach(function(value) {
  19103. result[++index] = value;
  19104. });
  19105. return result;
  19106. }
  19107. /**
  19108. * Converts `set` to its value-value pairs.
  19109. *
  19110. * @private
  19111. * @param {Object} set The set to convert.
  19112. * @returns {Array} Returns the value-value pairs.
  19113. */
  19114. function setToPairs(set) {
  19115. var index = -1,
  19116. result = Array(set.size);
  19117. set.forEach(function(value) {
  19118. result[++index] = [value, value];
  19119. });
  19120. return result;
  19121. }
  19122. /**
  19123. * A specialized version of `_.indexOf` which performs strict equality
  19124. * comparisons of values, i.e. `===`.
  19125. *
  19126. * @private
  19127. * @param {Array} array The array to inspect.
  19128. * @param {*} value The value to search for.
  19129. * @param {number} fromIndex The index to search from.
  19130. * @returns {number} Returns the index of the matched value, else `-1`.
  19131. */
  19132. function strictIndexOf(array, value, fromIndex) {
  19133. var index = fromIndex - 1,
  19134. length = array.length;
  19135. while (++index < length) {
  19136. if (array[index] === value) {
  19137. return index;
  19138. }
  19139. }
  19140. return -1;
  19141. }
  19142. /**
  19143. * A specialized version of `_.lastIndexOf` which performs strict equality
  19144. * comparisons of values, i.e. `===`.
  19145. *
  19146. * @private
  19147. * @param {Array} array The array to inspect.
  19148. * @param {*} value The value to search for.
  19149. * @param {number} fromIndex The index to search from.
  19150. * @returns {number} Returns the index of the matched value, else `-1`.
  19151. */
  19152. function strictLastIndexOf(array, value, fromIndex) {
  19153. var index = fromIndex + 1;
  19154. while (index--) {
  19155. if (array[index] === value) {
  19156. return index;
  19157. }
  19158. }
  19159. return index;
  19160. }
  19161. /**
  19162. * Gets the number of symbols in `string`.
  19163. *
  19164. * @private
  19165. * @param {string} string The string to inspect.
  19166. * @returns {number} Returns the string size.
  19167. */
  19168. function stringSize(string) {
  19169. return hasUnicode(string)
  19170. ? unicodeSize(string)
  19171. : asciiSize(string);
  19172. }
  19173. /**
  19174. * Converts `string` to an array.
  19175. *
  19176. * @private
  19177. * @param {string} string The string to convert.
  19178. * @returns {Array} Returns the converted array.
  19179. */
  19180. function stringToArray(string) {
  19181. return hasUnicode(string)
  19182. ? unicodeToArray(string)
  19183. : asciiToArray(string);
  19184. }
  19185. /**
  19186. * Used by `_.unescape` to convert HTML entities to characters.
  19187. *
  19188. * @private
  19189. * @param {string} chr The matched character to unescape.
  19190. * @returns {string} Returns the unescaped character.
  19191. */
  19192. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19193. /**
  19194. * Gets the size of a Unicode `string`.
  19195. *
  19196. * @private
  19197. * @param {string} string The string inspect.
  19198. * @returns {number} Returns the string size.
  19199. */
  19200. function unicodeSize(string) {
  19201. var result = reUnicode.lastIndex = 0;
  19202. while (reUnicode.test(string)) {
  19203. ++result;
  19204. }
  19205. return result;
  19206. }
  19207. /**
  19208. * Converts a Unicode `string` to an array.
  19209. *
  19210. * @private
  19211. * @param {string} string The string to convert.
  19212. * @returns {Array} Returns the converted array.
  19213. */
  19214. function unicodeToArray(string) {
  19215. return string.match(reUnicode) || [];
  19216. }
  19217. /**
  19218. * Splits a Unicode `string` into an array of its words.
  19219. *
  19220. * @private
  19221. * @param {string} The string to inspect.
  19222. * @returns {Array} Returns the words of `string`.
  19223. */
  19224. function unicodeWords(string) {
  19225. return string.match(reUnicodeWord) || [];
  19226. }
  19227. /*--------------------------------------------------------------------------*/
  19228. /**
  19229. * Create a new pristine `lodash` function using the `context` object.
  19230. *
  19231. * @static
  19232. * @memberOf _
  19233. * @since 1.1.0
  19234. * @category Util
  19235. * @param {Object} [context=root] The context object.
  19236. * @returns {Function} Returns a new `lodash` function.
  19237. * @example
  19238. *
  19239. * _.mixin({ 'foo': _.constant('foo') });
  19240. *
  19241. * var lodash = _.runInContext();
  19242. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19243. *
  19244. * _.isFunction(_.foo);
  19245. * // => true
  19246. * _.isFunction(_.bar);
  19247. * // => false
  19248. *
  19249. * lodash.isFunction(lodash.foo);
  19250. * // => false
  19251. * lodash.isFunction(lodash.bar);
  19252. * // => true
  19253. *
  19254. * // Create a suped-up `defer` in Node.js.
  19255. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19256. */
  19257. var runInContext = (function runInContext(context) {
  19258. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19259. /** Built-in constructor references. */
  19260. var Array = context.Array,
  19261. Date = context.Date,
  19262. Error = context.Error,
  19263. Function = context.Function,
  19264. Math = context.Math,
  19265. Object = context.Object,
  19266. RegExp = context.RegExp,
  19267. String = context.String,
  19268. TypeError = context.TypeError;
  19269. /** Used for built-in method references. */
  19270. var arrayProto = Array.prototype,
  19271. funcProto = Function.prototype,
  19272. objectProto = Object.prototype;
  19273. /** Used to detect overreaching core-js shims. */
  19274. var coreJsData = context['__core-js_shared__'];
  19275. /** Used to resolve the decompiled source of functions. */
  19276. var funcToString = funcProto.toString;
  19277. /** Used to check objects for own properties. */
  19278. var hasOwnProperty = objectProto.hasOwnProperty;
  19279. /** Used to generate unique IDs. */
  19280. var idCounter = 0;
  19281. /** Used to detect methods masquerading as native. */
  19282. var maskSrcKey = (function() {
  19283. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19284. return uid ? ('Symbol(src)_1.' + uid) : '';
  19285. }());
  19286. /**
  19287. * Used to resolve the
  19288. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19289. * of values.
  19290. */
  19291. var nativeObjectToString = objectProto.toString;
  19292. /** Used to infer the `Object` constructor. */
  19293. var objectCtorString = funcToString.call(Object);
  19294. /** Used to restore the original `_` reference in `_.noConflict`. */
  19295. var oldDash = root._;
  19296. /** Used to detect if a method is native. */
  19297. var reIsNative = RegExp('^' +
  19298. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19299. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19300. );
  19301. /** Built-in value references. */
  19302. var Buffer = moduleExports ? context.Buffer : undefined,
  19303. Symbol = context.Symbol,
  19304. Uint8Array = context.Uint8Array,
  19305. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19306. getPrototype = overArg(Object.getPrototypeOf, Object),
  19307. objectCreate = Object.create,
  19308. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19309. splice = arrayProto.splice,
  19310. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19311. symIterator = Symbol ? Symbol.iterator : undefined,
  19312. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19313. var defineProperty = (function() {
  19314. try {
  19315. var func = getNative(Object, 'defineProperty');
  19316. func({}, '', {});
  19317. return func;
  19318. } catch (e) {}
  19319. }());
  19320. /** Mocked built-ins. */
  19321. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19322. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19323. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19324. /* Built-in method references for those with the same name as other `lodash` methods. */
  19325. var nativeCeil = Math.ceil,
  19326. nativeFloor = Math.floor,
  19327. nativeGetSymbols = Object.getOwnPropertySymbols,
  19328. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19329. nativeIsFinite = context.isFinite,
  19330. nativeJoin = arrayProto.join,
  19331. nativeKeys = overArg(Object.keys, Object),
  19332. nativeMax = Math.max,
  19333. nativeMin = Math.min,
  19334. nativeNow = Date.now,
  19335. nativeParseInt = context.parseInt,
  19336. nativeRandom = Math.random,
  19337. nativeReverse = arrayProto.reverse;
  19338. /* Built-in method references that are verified to be native. */
  19339. var DataView = getNative(context, 'DataView'),
  19340. Map = getNative(context, 'Map'),
  19341. Promise = getNative(context, 'Promise'),
  19342. Set = getNative(context, 'Set'),
  19343. WeakMap = getNative(context, 'WeakMap'),
  19344. nativeCreate = getNative(Object, 'create');
  19345. /** Used to store function metadata. */
  19346. var metaMap = WeakMap && new WeakMap;
  19347. /** Used to lookup unminified function names. */
  19348. var realNames = {};
  19349. /** Used to detect maps, sets, and weakmaps. */
  19350. var dataViewCtorString = toSource(DataView),
  19351. mapCtorString = toSource(Map),
  19352. promiseCtorString = toSource(Promise),
  19353. setCtorString = toSource(Set),
  19354. weakMapCtorString = toSource(WeakMap);
  19355. /** Used to convert symbols to primitives and strings. */
  19356. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19357. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19358. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19359. /*------------------------------------------------------------------------*/
  19360. /**
  19361. * Creates a `lodash` object which wraps `value` to enable implicit method
  19362. * chain sequences. Methods that operate on and return arrays, collections,
  19363. * and functions can be chained together. Methods that retrieve a single value
  19364. * or may return a primitive value will automatically end the chain sequence
  19365. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19366. * with `_#value`.
  19367. *
  19368. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19369. * enabled using `_.chain`.
  19370. *
  19371. * The execution of chained methods is lazy, that is, it's deferred until
  19372. * `_#value` is implicitly or explicitly called.
  19373. *
  19374. * Lazy evaluation allows several methods to support shortcut fusion.
  19375. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19376. * the creation of intermediate arrays and can greatly reduce the number of
  19377. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19378. * fusion if the section is applied to an array and iteratees accept only
  19379. * one argument. The heuristic for whether a section qualifies for shortcut
  19380. * fusion is subject to change.
  19381. *
  19382. * Chaining is supported in custom builds as long as the `_#value` method is
  19383. * directly or indirectly included in the build.
  19384. *
  19385. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19386. *
  19387. * The wrapper `Array` methods are:
  19388. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19389. *
  19390. * The wrapper `String` methods are:
  19391. * `replace` and `split`
  19392. *
  19393. * The wrapper methods that support shortcut fusion are:
  19394. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19395. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19396. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19397. *
  19398. * The chainable wrapper methods are:
  19399. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19400. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19401. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19402. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19403. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19404. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19405. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19406. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19407. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19408. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19409. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19410. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19411. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19412. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19413. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19414. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19415. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19416. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19417. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19418. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19419. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19420. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19421. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19422. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19423. *
  19424. * The wrapper methods that are **not** chainable by default are:
  19425. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19426. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19427. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19428. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19429. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19430. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19431. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19432. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19433. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19434. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19435. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19436. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19437. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19438. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19439. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19440. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19441. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19442. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19443. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19444. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19445. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19446. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19447. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19448. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19449. * `upperFirst`, `value`, and `words`
  19450. *
  19451. * @name _
  19452. * @constructor
  19453. * @category Seq
  19454. * @param {*} value The value to wrap in a `lodash` instance.
  19455. * @returns {Object} Returns the new `lodash` wrapper instance.
  19456. * @example
  19457. *
  19458. * function square(n) {
  19459. * return n * n;
  19460. * }
  19461. *
  19462. * var wrapped = _([1, 2, 3]);
  19463. *
  19464. * // Returns an unwrapped value.
  19465. * wrapped.reduce(_.add);
  19466. * // => 6
  19467. *
  19468. * // Returns a wrapped value.
  19469. * var squares = wrapped.map(square);
  19470. *
  19471. * _.isArray(squares);
  19472. * // => false
  19473. *
  19474. * _.isArray(squares.value());
  19475. * // => true
  19476. */
  19477. function lodash(value) {
  19478. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19479. if (value instanceof LodashWrapper) {
  19480. return value;
  19481. }
  19482. if (hasOwnProperty.call(value, '__wrapped__')) {
  19483. return wrapperClone(value);
  19484. }
  19485. }
  19486. return new LodashWrapper(value);
  19487. }
  19488. /**
  19489. * The base implementation of `_.create` without support for assigning
  19490. * properties to the created object.
  19491. *
  19492. * @private
  19493. * @param {Object} proto The object to inherit from.
  19494. * @returns {Object} Returns the new object.
  19495. */
  19496. var baseCreate = (function() {
  19497. function object() {}
  19498. return function(proto) {
  19499. if (!isObject(proto)) {
  19500. return {};
  19501. }
  19502. if (objectCreate) {
  19503. return objectCreate(proto);
  19504. }
  19505. object.prototype = proto;
  19506. var result = new object;
  19507. object.prototype = undefined;
  19508. return result;
  19509. };
  19510. }());
  19511. /**
  19512. * The function whose prototype chain sequence wrappers inherit from.
  19513. *
  19514. * @private
  19515. */
  19516. function baseLodash() {
  19517. // No operation performed.
  19518. }
  19519. /**
  19520. * The base constructor for creating `lodash` wrapper objects.
  19521. *
  19522. * @private
  19523. * @param {*} value The value to wrap.
  19524. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19525. */
  19526. function LodashWrapper(value, chainAll) {
  19527. this.__wrapped__ = value;
  19528. this.__actions__ = [];
  19529. this.__chain__ = !!chainAll;
  19530. this.__index__ = 0;
  19531. this.__values__ = undefined;
  19532. }
  19533. /**
  19534. * By default, the template delimiters used by lodash are like those in
  19535. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19536. * following template settings to use alternative delimiters.
  19537. *
  19538. * @static
  19539. * @memberOf _
  19540. * @type {Object}
  19541. */
  19542. lodash.templateSettings = {
  19543. /**
  19544. * Used to detect `data` property values to be HTML-escaped.
  19545. *
  19546. * @memberOf _.templateSettings
  19547. * @type {RegExp}
  19548. */
  19549. 'escape': reEscape,
  19550. /**
  19551. * Used to detect code to be evaluated.
  19552. *
  19553. * @memberOf _.templateSettings
  19554. * @type {RegExp}
  19555. */
  19556. 'evaluate': reEvaluate,
  19557. /**
  19558. * Used to detect `data` property values to inject.
  19559. *
  19560. * @memberOf _.templateSettings
  19561. * @type {RegExp}
  19562. */
  19563. 'interpolate': reInterpolate,
  19564. /**
  19565. * Used to reference the data object in the template text.
  19566. *
  19567. * @memberOf _.templateSettings
  19568. * @type {string}
  19569. */
  19570. 'variable': '',
  19571. /**
  19572. * Used to import variables into the compiled template.
  19573. *
  19574. * @memberOf _.templateSettings
  19575. * @type {Object}
  19576. */
  19577. 'imports': {
  19578. /**
  19579. * A reference to the `lodash` function.
  19580. *
  19581. * @memberOf _.templateSettings.imports
  19582. * @type {Function}
  19583. */
  19584. '_': lodash
  19585. }
  19586. };
  19587. // Ensure wrappers are instances of `baseLodash`.
  19588. lodash.prototype = baseLodash.prototype;
  19589. lodash.prototype.constructor = lodash;
  19590. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19591. LodashWrapper.prototype.constructor = LodashWrapper;
  19592. /*------------------------------------------------------------------------*/
  19593. /**
  19594. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19595. *
  19596. * @private
  19597. * @constructor
  19598. * @param {*} value The value to wrap.
  19599. */
  19600. function LazyWrapper(value) {
  19601. this.__wrapped__ = value;
  19602. this.__actions__ = [];
  19603. this.__dir__ = 1;
  19604. this.__filtered__ = false;
  19605. this.__iteratees__ = [];
  19606. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19607. this.__views__ = [];
  19608. }
  19609. /**
  19610. * Creates a clone of the lazy wrapper object.
  19611. *
  19612. * @private
  19613. * @name clone
  19614. * @memberOf LazyWrapper
  19615. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19616. */
  19617. function lazyClone() {
  19618. var result = new LazyWrapper(this.__wrapped__);
  19619. result.__actions__ = copyArray(this.__actions__);
  19620. result.__dir__ = this.__dir__;
  19621. result.__filtered__ = this.__filtered__;
  19622. result.__iteratees__ = copyArray(this.__iteratees__);
  19623. result.__takeCount__ = this.__takeCount__;
  19624. result.__views__ = copyArray(this.__views__);
  19625. return result;
  19626. }
  19627. /**
  19628. * Reverses the direction of lazy iteration.
  19629. *
  19630. * @private
  19631. * @name reverse
  19632. * @memberOf LazyWrapper
  19633. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19634. */
  19635. function lazyReverse() {
  19636. if (this.__filtered__) {
  19637. var result = new LazyWrapper(this);
  19638. result.__dir__ = -1;
  19639. result.__filtered__ = true;
  19640. } else {
  19641. result = this.clone();
  19642. result.__dir__ *= -1;
  19643. }
  19644. return result;
  19645. }
  19646. /**
  19647. * Extracts the unwrapped value from its lazy wrapper.
  19648. *
  19649. * @private
  19650. * @name value
  19651. * @memberOf LazyWrapper
  19652. * @returns {*} Returns the unwrapped value.
  19653. */
  19654. function lazyValue() {
  19655. var array = this.__wrapped__.value(),
  19656. dir = this.__dir__,
  19657. isArr = isArray(array),
  19658. isRight = dir < 0,
  19659. arrLength = isArr ? array.length : 0,
  19660. view = getView(0, arrLength, this.__views__),
  19661. start = view.start,
  19662. end = view.end,
  19663. length = end - start,
  19664. index = isRight ? end : (start - 1),
  19665. iteratees = this.__iteratees__,
  19666. iterLength = iteratees.length,
  19667. resIndex = 0,
  19668. takeCount = nativeMin(length, this.__takeCount__);
  19669. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19670. return baseWrapperValue(array, this.__actions__);
  19671. }
  19672. var result = [];
  19673. outer:
  19674. while (length-- && resIndex < takeCount) {
  19675. index += dir;
  19676. var iterIndex = -1,
  19677. value = array[index];
  19678. while (++iterIndex < iterLength) {
  19679. var data = iteratees[iterIndex],
  19680. iteratee = data.iteratee,
  19681. type = data.type,
  19682. computed = iteratee(value);
  19683. if (type == LAZY_MAP_FLAG) {
  19684. value = computed;
  19685. } else if (!computed) {
  19686. if (type == LAZY_FILTER_FLAG) {
  19687. continue outer;
  19688. } else {
  19689. break outer;
  19690. }
  19691. }
  19692. }
  19693. result[resIndex++] = value;
  19694. }
  19695. return result;
  19696. }
  19697. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19698. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19699. LazyWrapper.prototype.constructor = LazyWrapper;
  19700. /*------------------------------------------------------------------------*/
  19701. /**
  19702. * Creates a hash object.
  19703. *
  19704. * @private
  19705. * @constructor
  19706. * @param {Array} [entries] The key-value pairs to cache.
  19707. */
  19708. function Hash(entries) {
  19709. var index = -1,
  19710. length = entries == null ? 0 : entries.length;
  19711. this.clear();
  19712. while (++index < length) {
  19713. var entry = entries[index];
  19714. this.set(entry[0], entry[1]);
  19715. }
  19716. }
  19717. /**
  19718. * Removes all key-value entries from the hash.
  19719. *
  19720. * @private
  19721. * @name clear
  19722. * @memberOf Hash
  19723. */
  19724. function hashClear() {
  19725. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19726. this.size = 0;
  19727. }
  19728. /**
  19729. * Removes `key` and its value from the hash.
  19730. *
  19731. * @private
  19732. * @name delete
  19733. * @memberOf Hash
  19734. * @param {Object} hash The hash to modify.
  19735. * @param {string} key The key of the value to remove.
  19736. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19737. */
  19738. function hashDelete(key) {
  19739. var result = this.has(key) && delete this.__data__[key];
  19740. this.size -= result ? 1 : 0;
  19741. return result;
  19742. }
  19743. /**
  19744. * Gets the hash value for `key`.
  19745. *
  19746. * @private
  19747. * @name get
  19748. * @memberOf Hash
  19749. * @param {string} key The key of the value to get.
  19750. * @returns {*} Returns the entry value.
  19751. */
  19752. function hashGet(key) {
  19753. var data = this.__data__;
  19754. if (nativeCreate) {
  19755. var result = data[key];
  19756. return result === HASH_UNDEFINED ? undefined : result;
  19757. }
  19758. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  19759. }
  19760. /**
  19761. * Checks if a hash value for `key` exists.
  19762. *
  19763. * @private
  19764. * @name has
  19765. * @memberOf Hash
  19766. * @param {string} key The key of the entry to check.
  19767. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19768. */
  19769. function hashHas(key) {
  19770. var data = this.__data__;
  19771. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  19772. }
  19773. /**
  19774. * Sets the hash `key` to `value`.
  19775. *
  19776. * @private
  19777. * @name set
  19778. * @memberOf Hash
  19779. * @param {string} key The key of the value to set.
  19780. * @param {*} value The value to set.
  19781. * @returns {Object} Returns the hash instance.
  19782. */
  19783. function hashSet(key, value) {
  19784. var data = this.__data__;
  19785. this.size += this.has(key) ? 0 : 1;
  19786. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  19787. return this;
  19788. }
  19789. // Add methods to `Hash`.
  19790. Hash.prototype.clear = hashClear;
  19791. Hash.prototype['delete'] = hashDelete;
  19792. Hash.prototype.get = hashGet;
  19793. Hash.prototype.has = hashHas;
  19794. Hash.prototype.set = hashSet;
  19795. /*------------------------------------------------------------------------*/
  19796. /**
  19797. * Creates an list cache object.
  19798. *
  19799. * @private
  19800. * @constructor
  19801. * @param {Array} [entries] The key-value pairs to cache.
  19802. */
  19803. function ListCache(entries) {
  19804. var index = -1,
  19805. length = entries == null ? 0 : entries.length;
  19806. this.clear();
  19807. while (++index < length) {
  19808. var entry = entries[index];
  19809. this.set(entry[0], entry[1]);
  19810. }
  19811. }
  19812. /**
  19813. * Removes all key-value entries from the list cache.
  19814. *
  19815. * @private
  19816. * @name clear
  19817. * @memberOf ListCache
  19818. */
  19819. function listCacheClear() {
  19820. this.__data__ = [];
  19821. this.size = 0;
  19822. }
  19823. /**
  19824. * Removes `key` and its value from the list cache.
  19825. *
  19826. * @private
  19827. * @name delete
  19828. * @memberOf ListCache
  19829. * @param {string} key The key of the value to remove.
  19830. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19831. */
  19832. function listCacheDelete(key) {
  19833. var data = this.__data__,
  19834. index = assocIndexOf(data, key);
  19835. if (index < 0) {
  19836. return false;
  19837. }
  19838. var lastIndex = data.length - 1;
  19839. if (index == lastIndex) {
  19840. data.pop();
  19841. } else {
  19842. splice.call(data, index, 1);
  19843. }
  19844. --this.size;
  19845. return true;
  19846. }
  19847. /**
  19848. * Gets the list cache value for `key`.
  19849. *
  19850. * @private
  19851. * @name get
  19852. * @memberOf ListCache
  19853. * @param {string} key The key of the value to get.
  19854. * @returns {*} Returns the entry value.
  19855. */
  19856. function listCacheGet(key) {
  19857. var data = this.__data__,
  19858. index = assocIndexOf(data, key);
  19859. return index < 0 ? undefined : data[index][1];
  19860. }
  19861. /**
  19862. * Checks if a list cache value for `key` exists.
  19863. *
  19864. * @private
  19865. * @name has
  19866. * @memberOf ListCache
  19867. * @param {string} key The key of the entry to check.
  19868. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19869. */
  19870. function listCacheHas(key) {
  19871. return assocIndexOf(this.__data__, key) > -1;
  19872. }
  19873. /**
  19874. * Sets the list cache `key` to `value`.
  19875. *
  19876. * @private
  19877. * @name set
  19878. * @memberOf ListCache
  19879. * @param {string} key The key of the value to set.
  19880. * @param {*} value The value to set.
  19881. * @returns {Object} Returns the list cache instance.
  19882. */
  19883. function listCacheSet(key, value) {
  19884. var data = this.__data__,
  19885. index = assocIndexOf(data, key);
  19886. if (index < 0) {
  19887. ++this.size;
  19888. data.push([key, value]);
  19889. } else {
  19890. data[index][1] = value;
  19891. }
  19892. return this;
  19893. }
  19894. // Add methods to `ListCache`.
  19895. ListCache.prototype.clear = listCacheClear;
  19896. ListCache.prototype['delete'] = listCacheDelete;
  19897. ListCache.prototype.get = listCacheGet;
  19898. ListCache.prototype.has = listCacheHas;
  19899. ListCache.prototype.set = listCacheSet;
  19900. /*------------------------------------------------------------------------*/
  19901. /**
  19902. * Creates a map cache object to store key-value pairs.
  19903. *
  19904. * @private
  19905. * @constructor
  19906. * @param {Array} [entries] The key-value pairs to cache.
  19907. */
  19908. function MapCache(entries) {
  19909. var index = -1,
  19910. length = entries == null ? 0 : entries.length;
  19911. this.clear();
  19912. while (++index < length) {
  19913. var entry = entries[index];
  19914. this.set(entry[0], entry[1]);
  19915. }
  19916. }
  19917. /**
  19918. * Removes all key-value entries from the map.
  19919. *
  19920. * @private
  19921. * @name clear
  19922. * @memberOf MapCache
  19923. */
  19924. function mapCacheClear() {
  19925. this.size = 0;
  19926. this.__data__ = {
  19927. 'hash': new Hash,
  19928. 'map': new (Map || ListCache),
  19929. 'string': new Hash
  19930. };
  19931. }
  19932. /**
  19933. * Removes `key` and its value from the map.
  19934. *
  19935. * @private
  19936. * @name delete
  19937. * @memberOf MapCache
  19938. * @param {string} key The key of the value to remove.
  19939. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19940. */
  19941. function mapCacheDelete(key) {
  19942. var result = getMapData(this, key)['delete'](key);
  19943. this.size -= result ? 1 : 0;
  19944. return result;
  19945. }
  19946. /**
  19947. * Gets the map value for `key`.
  19948. *
  19949. * @private
  19950. * @name get
  19951. * @memberOf MapCache
  19952. * @param {string} key The key of the value to get.
  19953. * @returns {*} Returns the entry value.
  19954. */
  19955. function mapCacheGet(key) {
  19956. return getMapData(this, key).get(key);
  19957. }
  19958. /**
  19959. * Checks if a map value for `key` exists.
  19960. *
  19961. * @private
  19962. * @name has
  19963. * @memberOf MapCache
  19964. * @param {string} key The key of the entry to check.
  19965. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19966. */
  19967. function mapCacheHas(key) {
  19968. return getMapData(this, key).has(key);
  19969. }
  19970. /**
  19971. * Sets the map `key` to `value`.
  19972. *
  19973. * @private
  19974. * @name set
  19975. * @memberOf MapCache
  19976. * @param {string} key The key of the value to set.
  19977. * @param {*} value The value to set.
  19978. * @returns {Object} Returns the map cache instance.
  19979. */
  19980. function mapCacheSet(key, value) {
  19981. var data = getMapData(this, key),
  19982. size = data.size;
  19983. data.set(key, value);
  19984. this.size += data.size == size ? 0 : 1;
  19985. return this;
  19986. }
  19987. // Add methods to `MapCache`.
  19988. MapCache.prototype.clear = mapCacheClear;
  19989. MapCache.prototype['delete'] = mapCacheDelete;
  19990. MapCache.prototype.get = mapCacheGet;
  19991. MapCache.prototype.has = mapCacheHas;
  19992. MapCache.prototype.set = mapCacheSet;
  19993. /*------------------------------------------------------------------------*/
  19994. /**
  19995. *
  19996. * Creates an array cache object to store unique values.
  19997. *
  19998. * @private
  19999. * @constructor
  20000. * @param {Array} [values] The values to cache.
  20001. */
  20002. function SetCache(values) {
  20003. var index = -1,
  20004. length = values == null ? 0 : values.length;
  20005. this.__data__ = new MapCache;
  20006. while (++index < length) {
  20007. this.add(values[index]);
  20008. }
  20009. }
  20010. /**
  20011. * Adds `value` to the array cache.
  20012. *
  20013. * @private
  20014. * @name add
  20015. * @memberOf SetCache
  20016. * @alias push
  20017. * @param {*} value The value to cache.
  20018. * @returns {Object} Returns the cache instance.
  20019. */
  20020. function setCacheAdd(value) {
  20021. this.__data__.set(value, HASH_UNDEFINED);
  20022. return this;
  20023. }
  20024. /**
  20025. * Checks if `value` is in the array cache.
  20026. *
  20027. * @private
  20028. * @name has
  20029. * @memberOf SetCache
  20030. * @param {*} value The value to search for.
  20031. * @returns {number} Returns `true` if `value` is found, else `false`.
  20032. */
  20033. function setCacheHas(value) {
  20034. return this.__data__.has(value);
  20035. }
  20036. // Add methods to `SetCache`.
  20037. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20038. SetCache.prototype.has = setCacheHas;
  20039. /*------------------------------------------------------------------------*/
  20040. /**
  20041. * Creates a stack cache object to store key-value pairs.
  20042. *
  20043. * @private
  20044. * @constructor
  20045. * @param {Array} [entries] The key-value pairs to cache.
  20046. */
  20047. function Stack(entries) {
  20048. var data = this.__data__ = new ListCache(entries);
  20049. this.size = data.size;
  20050. }
  20051. /**
  20052. * Removes all key-value entries from the stack.
  20053. *
  20054. * @private
  20055. * @name clear
  20056. * @memberOf Stack
  20057. */
  20058. function stackClear() {
  20059. this.__data__ = new ListCache;
  20060. this.size = 0;
  20061. }
  20062. /**
  20063. * Removes `key` and its value from the stack.
  20064. *
  20065. * @private
  20066. * @name delete
  20067. * @memberOf Stack
  20068. * @param {string} key The key of the value to remove.
  20069. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20070. */
  20071. function stackDelete(key) {
  20072. var data = this.__data__,
  20073. result = data['delete'](key);
  20074. this.size = data.size;
  20075. return result;
  20076. }
  20077. /**
  20078. * Gets the stack value for `key`.
  20079. *
  20080. * @private
  20081. * @name get
  20082. * @memberOf Stack
  20083. * @param {string} key The key of the value to get.
  20084. * @returns {*} Returns the entry value.
  20085. */
  20086. function stackGet(key) {
  20087. return this.__data__.get(key);
  20088. }
  20089. /**
  20090. * Checks if a stack value for `key` exists.
  20091. *
  20092. * @private
  20093. * @name has
  20094. * @memberOf Stack
  20095. * @param {string} key The key of the entry to check.
  20096. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20097. */
  20098. function stackHas(key) {
  20099. return this.__data__.has(key);
  20100. }
  20101. /**
  20102. * Sets the stack `key` to `value`.
  20103. *
  20104. * @private
  20105. * @name set
  20106. * @memberOf Stack
  20107. * @param {string} key The key of the value to set.
  20108. * @param {*} value The value to set.
  20109. * @returns {Object} Returns the stack cache instance.
  20110. */
  20111. function stackSet(key, value) {
  20112. var data = this.__data__;
  20113. if (data instanceof ListCache) {
  20114. var pairs = data.__data__;
  20115. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20116. pairs.push([key, value]);
  20117. this.size = ++data.size;
  20118. return this;
  20119. }
  20120. data = this.__data__ = new MapCache(pairs);
  20121. }
  20122. data.set(key, value);
  20123. this.size = data.size;
  20124. return this;
  20125. }
  20126. // Add methods to `Stack`.
  20127. Stack.prototype.clear = stackClear;
  20128. Stack.prototype['delete'] = stackDelete;
  20129. Stack.prototype.get = stackGet;
  20130. Stack.prototype.has = stackHas;
  20131. Stack.prototype.set = stackSet;
  20132. /*------------------------------------------------------------------------*/
  20133. /**
  20134. * Creates an array of the enumerable property names of the array-like `value`.
  20135. *
  20136. * @private
  20137. * @param {*} value The value to query.
  20138. * @param {boolean} inherited Specify returning inherited property names.
  20139. * @returns {Array} Returns the array of property names.
  20140. */
  20141. function arrayLikeKeys(value, inherited) {
  20142. var isArr = isArray(value),
  20143. isArg = !isArr && isArguments(value),
  20144. isBuff = !isArr && !isArg && isBuffer(value),
  20145. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20146. skipIndexes = isArr || isArg || isBuff || isType,
  20147. result = skipIndexes ? baseTimes(value.length, String) : [],
  20148. length = result.length;
  20149. for (var key in value) {
  20150. if ((inherited || hasOwnProperty.call(value, key)) &&
  20151. !(skipIndexes && (
  20152. // Safari 9 has enumerable `arguments.length` in strict mode.
  20153. key == 'length' ||
  20154. // Node.js 0.10 has enumerable non-index properties on buffers.
  20155. (isBuff && (key == 'offset' || key == 'parent')) ||
  20156. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20157. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20158. // Skip index properties.
  20159. isIndex(key, length)
  20160. ))) {
  20161. result.push(key);
  20162. }
  20163. }
  20164. return result;
  20165. }
  20166. /**
  20167. * A specialized version of `_.sample` for arrays.
  20168. *
  20169. * @private
  20170. * @param {Array} array The array to sample.
  20171. * @returns {*} Returns the random element.
  20172. */
  20173. function arraySample(array) {
  20174. var length = array.length;
  20175. return length ? array[baseRandom(0, length - 1)] : undefined;
  20176. }
  20177. /**
  20178. * A specialized version of `_.sampleSize` for arrays.
  20179. *
  20180. * @private
  20181. * @param {Array} array The array to sample.
  20182. * @param {number} n The number of elements to sample.
  20183. * @returns {Array} Returns the random elements.
  20184. */
  20185. function arraySampleSize(array, n) {
  20186. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20187. }
  20188. /**
  20189. * A specialized version of `_.shuffle` for arrays.
  20190. *
  20191. * @private
  20192. * @param {Array} array The array to shuffle.
  20193. * @returns {Array} Returns the new shuffled array.
  20194. */
  20195. function arrayShuffle(array) {
  20196. return shuffleSelf(copyArray(array));
  20197. }
  20198. /**
  20199. * This function is like `assignValue` except that it doesn't assign
  20200. * `undefined` values.
  20201. *
  20202. * @private
  20203. * @param {Object} object The object to modify.
  20204. * @param {string} key The key of the property to assign.
  20205. * @param {*} value The value to assign.
  20206. */
  20207. function assignMergeValue(object, key, value) {
  20208. if ((value !== undefined && !eq(object[key], value)) ||
  20209. (value === undefined && !(key in object))) {
  20210. baseAssignValue(object, key, value);
  20211. }
  20212. }
  20213. /**
  20214. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20215. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20216. * for equality comparisons.
  20217. *
  20218. * @private
  20219. * @param {Object} object The object to modify.
  20220. * @param {string} key The key of the property to assign.
  20221. * @param {*} value The value to assign.
  20222. */
  20223. function assignValue(object, key, value) {
  20224. var objValue = object[key];
  20225. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20226. (value === undefined && !(key in object))) {
  20227. baseAssignValue(object, key, value);
  20228. }
  20229. }
  20230. /**
  20231. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20232. *
  20233. * @private
  20234. * @param {Array} array The array to inspect.
  20235. * @param {*} key The key to search for.
  20236. * @returns {number} Returns the index of the matched value, else `-1`.
  20237. */
  20238. function assocIndexOf(array, key) {
  20239. var length = array.length;
  20240. while (length--) {
  20241. if (eq(array[length][0], key)) {
  20242. return length;
  20243. }
  20244. }
  20245. return -1;
  20246. }
  20247. /**
  20248. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20249. * by `iteratee` and values set by `setter`.
  20250. *
  20251. * @private
  20252. * @param {Array|Object} collection The collection to iterate over.
  20253. * @param {Function} setter The function to set `accumulator` values.
  20254. * @param {Function} iteratee The iteratee to transform keys.
  20255. * @param {Object} accumulator The initial aggregated object.
  20256. * @returns {Function} Returns `accumulator`.
  20257. */
  20258. function baseAggregator(collection, setter, iteratee, accumulator) {
  20259. baseEach(collection, function(value, key, collection) {
  20260. setter(accumulator, value, iteratee(value), collection);
  20261. });
  20262. return accumulator;
  20263. }
  20264. /**
  20265. * The base implementation of `_.assign` without support for multiple sources
  20266. * or `customizer` functions.
  20267. *
  20268. * @private
  20269. * @param {Object} object The destination object.
  20270. * @param {Object} source The source object.
  20271. * @returns {Object} Returns `object`.
  20272. */
  20273. function baseAssign(object, source) {
  20274. return object && copyObject(source, keys(source), object);
  20275. }
  20276. /**
  20277. * The base implementation of `_.assignIn` without support for multiple sources
  20278. * or `customizer` functions.
  20279. *
  20280. * @private
  20281. * @param {Object} object The destination object.
  20282. * @param {Object} source The source object.
  20283. * @returns {Object} Returns `object`.
  20284. */
  20285. function baseAssignIn(object, source) {
  20286. return object && copyObject(source, keysIn(source), object);
  20287. }
  20288. /**
  20289. * The base implementation of `assignValue` and `assignMergeValue` without
  20290. * value checks.
  20291. *
  20292. * @private
  20293. * @param {Object} object The object to modify.
  20294. * @param {string} key The key of the property to assign.
  20295. * @param {*} value The value to assign.
  20296. */
  20297. function baseAssignValue(object, key, value) {
  20298. if (key == '__proto__' && defineProperty) {
  20299. defineProperty(object, key, {
  20300. 'configurable': true,
  20301. 'enumerable': true,
  20302. 'value': value,
  20303. 'writable': true
  20304. });
  20305. } else {
  20306. object[key] = value;
  20307. }
  20308. }
  20309. /**
  20310. * The base implementation of `_.at` without support for individual paths.
  20311. *
  20312. * @private
  20313. * @param {Object} object The object to iterate over.
  20314. * @param {string[]} paths The property paths to pick.
  20315. * @returns {Array} Returns the picked elements.
  20316. */
  20317. function baseAt(object, paths) {
  20318. var index = -1,
  20319. length = paths.length,
  20320. result = Array(length),
  20321. skip = object == null;
  20322. while (++index < length) {
  20323. result[index] = skip ? undefined : get(object, paths[index]);
  20324. }
  20325. return result;
  20326. }
  20327. /**
  20328. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20329. *
  20330. * @private
  20331. * @param {number} number The number to clamp.
  20332. * @param {number} [lower] The lower bound.
  20333. * @param {number} upper The upper bound.
  20334. * @returns {number} Returns the clamped number.
  20335. */
  20336. function baseClamp(number, lower, upper) {
  20337. if (number === number) {
  20338. if (upper !== undefined) {
  20339. number = number <= upper ? number : upper;
  20340. }
  20341. if (lower !== undefined) {
  20342. number = number >= lower ? number : lower;
  20343. }
  20344. }
  20345. return number;
  20346. }
  20347. /**
  20348. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20349. * traversed objects.
  20350. *
  20351. * @private
  20352. * @param {*} value The value to clone.
  20353. * @param {boolean} bitmask The bitmask flags.
  20354. * 1 - Deep clone
  20355. * 2 - Flatten inherited properties
  20356. * 4 - Clone symbols
  20357. * @param {Function} [customizer] The function to customize cloning.
  20358. * @param {string} [key] The key of `value`.
  20359. * @param {Object} [object] The parent object of `value`.
  20360. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20361. * @returns {*} Returns the cloned value.
  20362. */
  20363. function baseClone(value, bitmask, customizer, key, object, stack) {
  20364. var result,
  20365. isDeep = bitmask & CLONE_DEEP_FLAG,
  20366. isFlat = bitmask & CLONE_FLAT_FLAG,
  20367. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20368. if (customizer) {
  20369. result = object ? customizer(value, key, object, stack) : customizer(value);
  20370. }
  20371. if (result !== undefined) {
  20372. return result;
  20373. }
  20374. if (!isObject(value)) {
  20375. return value;
  20376. }
  20377. var isArr = isArray(value);
  20378. if (isArr) {
  20379. result = initCloneArray(value);
  20380. if (!isDeep) {
  20381. return copyArray(value, result);
  20382. }
  20383. } else {
  20384. var tag = getTag(value),
  20385. isFunc = tag == funcTag || tag == genTag;
  20386. if (isBuffer(value)) {
  20387. return cloneBuffer(value, isDeep);
  20388. }
  20389. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20390. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20391. if (!isDeep) {
  20392. return isFlat
  20393. ? copySymbolsIn(value, baseAssignIn(result, value))
  20394. : copySymbols(value, baseAssign(result, value));
  20395. }
  20396. } else {
  20397. if (!cloneableTags[tag]) {
  20398. return object ? value : {};
  20399. }
  20400. result = initCloneByTag(value, tag, isDeep);
  20401. }
  20402. }
  20403. // Check for circular references and return its corresponding clone.
  20404. stack || (stack = new Stack);
  20405. var stacked = stack.get(value);
  20406. if (stacked) {
  20407. return stacked;
  20408. }
  20409. stack.set(value, result);
  20410. if (isSet(value)) {
  20411. value.forEach(function(subValue) {
  20412. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20413. });
  20414. } else if (isMap(value)) {
  20415. value.forEach(function(subValue, key) {
  20416. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20417. });
  20418. }
  20419. var keysFunc = isFull
  20420. ? (isFlat ? getAllKeysIn : getAllKeys)
  20421. : (isFlat ? keysIn : keys);
  20422. var props = isArr ? undefined : keysFunc(value);
  20423. arrayEach(props || value, function(subValue, key) {
  20424. if (props) {
  20425. key = subValue;
  20426. subValue = value[key];
  20427. }
  20428. // Recursively populate clone (susceptible to call stack limits).
  20429. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20430. });
  20431. return result;
  20432. }
  20433. /**
  20434. * The base implementation of `_.conforms` which doesn't clone `source`.
  20435. *
  20436. * @private
  20437. * @param {Object} source The object of property predicates to conform to.
  20438. * @returns {Function} Returns the new spec function.
  20439. */
  20440. function baseConforms(source) {
  20441. var props = keys(source);
  20442. return function(object) {
  20443. return baseConformsTo(object, source, props);
  20444. };
  20445. }
  20446. /**
  20447. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20448. *
  20449. * @private
  20450. * @param {Object} object The object to inspect.
  20451. * @param {Object} source The object of property predicates to conform to.
  20452. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20453. */
  20454. function baseConformsTo(object, source, props) {
  20455. var length = props.length;
  20456. if (object == null) {
  20457. return !length;
  20458. }
  20459. object = Object(object);
  20460. while (length--) {
  20461. var key = props[length],
  20462. predicate = source[key],
  20463. value = object[key];
  20464. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20465. return false;
  20466. }
  20467. }
  20468. return true;
  20469. }
  20470. /**
  20471. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20472. * to provide to `func`.
  20473. *
  20474. * @private
  20475. * @param {Function} func The function to delay.
  20476. * @param {number} wait The number of milliseconds to delay invocation.
  20477. * @param {Array} args The arguments to provide to `func`.
  20478. * @returns {number|Object} Returns the timer id or timeout object.
  20479. */
  20480. function baseDelay(func, wait, args) {
  20481. if (typeof func != 'function') {
  20482. throw new TypeError(FUNC_ERROR_TEXT);
  20483. }
  20484. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20485. }
  20486. /**
  20487. * The base implementation of methods like `_.difference` without support
  20488. * for excluding multiple arrays or iteratee shorthands.
  20489. *
  20490. * @private
  20491. * @param {Array} array The array to inspect.
  20492. * @param {Array} values The values to exclude.
  20493. * @param {Function} [iteratee] The iteratee invoked per element.
  20494. * @param {Function} [comparator] The comparator invoked per element.
  20495. * @returns {Array} Returns the new array of filtered values.
  20496. */
  20497. function baseDifference(array, values, iteratee, comparator) {
  20498. var index = -1,
  20499. includes = arrayIncludes,
  20500. isCommon = true,
  20501. length = array.length,
  20502. result = [],
  20503. valuesLength = values.length;
  20504. if (!length) {
  20505. return result;
  20506. }
  20507. if (iteratee) {
  20508. values = arrayMap(values, baseUnary(iteratee));
  20509. }
  20510. if (comparator) {
  20511. includes = arrayIncludesWith;
  20512. isCommon = false;
  20513. }
  20514. else if (values.length >= LARGE_ARRAY_SIZE) {
  20515. includes = cacheHas;
  20516. isCommon = false;
  20517. values = new SetCache(values);
  20518. }
  20519. outer:
  20520. while (++index < length) {
  20521. var value = array[index],
  20522. computed = iteratee == null ? value : iteratee(value);
  20523. value = (comparator || value !== 0) ? value : 0;
  20524. if (isCommon && computed === computed) {
  20525. var valuesIndex = valuesLength;
  20526. while (valuesIndex--) {
  20527. if (values[valuesIndex] === computed) {
  20528. continue outer;
  20529. }
  20530. }
  20531. result.push(value);
  20532. }
  20533. else if (!includes(values, computed, comparator)) {
  20534. result.push(value);
  20535. }
  20536. }
  20537. return result;
  20538. }
  20539. /**
  20540. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20541. *
  20542. * @private
  20543. * @param {Array|Object} collection The collection to iterate over.
  20544. * @param {Function} iteratee The function invoked per iteration.
  20545. * @returns {Array|Object} Returns `collection`.
  20546. */
  20547. var baseEach = createBaseEach(baseForOwn);
  20548. /**
  20549. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20550. *
  20551. * @private
  20552. * @param {Array|Object} collection The collection to iterate over.
  20553. * @param {Function} iteratee The function invoked per iteration.
  20554. * @returns {Array|Object} Returns `collection`.
  20555. */
  20556. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20557. /**
  20558. * The base implementation of `_.every` without support for iteratee shorthands.
  20559. *
  20560. * @private
  20561. * @param {Array|Object} collection The collection to iterate over.
  20562. * @param {Function} predicate The function invoked per iteration.
  20563. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20564. * else `false`
  20565. */
  20566. function baseEvery(collection, predicate) {
  20567. var result = true;
  20568. baseEach(collection, function(value, index, collection) {
  20569. result = !!predicate(value, index, collection);
  20570. return result;
  20571. });
  20572. return result;
  20573. }
  20574. /**
  20575. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20576. * `comparator` to determine the extremum value.
  20577. *
  20578. * @private
  20579. * @param {Array} array The array to iterate over.
  20580. * @param {Function} iteratee The iteratee invoked per iteration.
  20581. * @param {Function} comparator The comparator used to compare values.
  20582. * @returns {*} Returns the extremum value.
  20583. */
  20584. function baseExtremum(array, iteratee, comparator) {
  20585. var index = -1,
  20586. length = array.length;
  20587. while (++index < length) {
  20588. var value = array[index],
  20589. current = iteratee(value);
  20590. if (current != null && (computed === undefined
  20591. ? (current === current && !isSymbol(current))
  20592. : comparator(current, computed)
  20593. )) {
  20594. var computed = current,
  20595. result = value;
  20596. }
  20597. }
  20598. return result;
  20599. }
  20600. /**
  20601. * The base implementation of `_.fill` without an iteratee call guard.
  20602. *
  20603. * @private
  20604. * @param {Array} array The array to fill.
  20605. * @param {*} value The value to fill `array` with.
  20606. * @param {number} [start=0] The start position.
  20607. * @param {number} [end=array.length] The end position.
  20608. * @returns {Array} Returns `array`.
  20609. */
  20610. function baseFill(array, value, start, end) {
  20611. var length = array.length;
  20612. start = toInteger(start);
  20613. if (start < 0) {
  20614. start = -start > length ? 0 : (length + start);
  20615. }
  20616. end = (end === undefined || end > length) ? length : toInteger(end);
  20617. if (end < 0) {
  20618. end += length;
  20619. }
  20620. end = start > end ? 0 : toLength(end);
  20621. while (start < end) {
  20622. array[start++] = value;
  20623. }
  20624. return array;
  20625. }
  20626. /**
  20627. * The base implementation of `_.filter` without support for iteratee shorthands.
  20628. *
  20629. * @private
  20630. * @param {Array|Object} collection The collection to iterate over.
  20631. * @param {Function} predicate The function invoked per iteration.
  20632. * @returns {Array} Returns the new filtered array.
  20633. */
  20634. function baseFilter(collection, predicate) {
  20635. var result = [];
  20636. baseEach(collection, function(value, index, collection) {
  20637. if (predicate(value, index, collection)) {
  20638. result.push(value);
  20639. }
  20640. });
  20641. return result;
  20642. }
  20643. /**
  20644. * The base implementation of `_.flatten` with support for restricting flattening.
  20645. *
  20646. * @private
  20647. * @param {Array} array The array to flatten.
  20648. * @param {number} depth The maximum recursion depth.
  20649. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20650. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20651. * @param {Array} [result=[]] The initial result value.
  20652. * @returns {Array} Returns the new flattened array.
  20653. */
  20654. function baseFlatten(array, depth, predicate, isStrict, result) {
  20655. var index = -1,
  20656. length = array.length;
  20657. predicate || (predicate = isFlattenable);
  20658. result || (result = []);
  20659. while (++index < length) {
  20660. var value = array[index];
  20661. if (depth > 0 && predicate(value)) {
  20662. if (depth > 1) {
  20663. // Recursively flatten arrays (susceptible to call stack limits).
  20664. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20665. } else {
  20666. arrayPush(result, value);
  20667. }
  20668. } else if (!isStrict) {
  20669. result[result.length] = value;
  20670. }
  20671. }
  20672. return result;
  20673. }
  20674. /**
  20675. * The base implementation of `baseForOwn` which iterates over `object`
  20676. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20677. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20678. *
  20679. * @private
  20680. * @param {Object} object The object to iterate over.
  20681. * @param {Function} iteratee The function invoked per iteration.
  20682. * @param {Function} keysFunc The function to get the keys of `object`.
  20683. * @returns {Object} Returns `object`.
  20684. */
  20685. var baseFor = createBaseFor();
  20686. /**
  20687. * This function is like `baseFor` except that it iterates over properties
  20688. * in the opposite order.
  20689. *
  20690. * @private
  20691. * @param {Object} object The object to iterate over.
  20692. * @param {Function} iteratee The function invoked per iteration.
  20693. * @param {Function} keysFunc The function to get the keys of `object`.
  20694. * @returns {Object} Returns `object`.
  20695. */
  20696. var baseForRight = createBaseFor(true);
  20697. /**
  20698. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20699. *
  20700. * @private
  20701. * @param {Object} object The object to iterate over.
  20702. * @param {Function} iteratee The function invoked per iteration.
  20703. * @returns {Object} Returns `object`.
  20704. */
  20705. function baseForOwn(object, iteratee) {
  20706. return object && baseFor(object, iteratee, keys);
  20707. }
  20708. /**
  20709. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20710. *
  20711. * @private
  20712. * @param {Object} object The object to iterate over.
  20713. * @param {Function} iteratee The function invoked per iteration.
  20714. * @returns {Object} Returns `object`.
  20715. */
  20716. function baseForOwnRight(object, iteratee) {
  20717. return object && baseForRight(object, iteratee, keys);
  20718. }
  20719. /**
  20720. * The base implementation of `_.functions` which creates an array of
  20721. * `object` function property names filtered from `props`.
  20722. *
  20723. * @private
  20724. * @param {Object} object The object to inspect.
  20725. * @param {Array} props The property names to filter.
  20726. * @returns {Array} Returns the function names.
  20727. */
  20728. function baseFunctions(object, props) {
  20729. return arrayFilter(props, function(key) {
  20730. return isFunction(object[key]);
  20731. });
  20732. }
  20733. /**
  20734. * The base implementation of `_.get` without support for default values.
  20735. *
  20736. * @private
  20737. * @param {Object} object The object to query.
  20738. * @param {Array|string} path The path of the property to get.
  20739. * @returns {*} Returns the resolved value.
  20740. */
  20741. function baseGet(object, path) {
  20742. path = castPath(path, object);
  20743. var index = 0,
  20744. length = path.length;
  20745. while (object != null && index < length) {
  20746. object = object[toKey(path[index++])];
  20747. }
  20748. return (index && index == length) ? object : undefined;
  20749. }
  20750. /**
  20751. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  20752. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  20753. * symbols of `object`.
  20754. *
  20755. * @private
  20756. * @param {Object} object The object to query.
  20757. * @param {Function} keysFunc The function to get the keys of `object`.
  20758. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  20759. * @returns {Array} Returns the array of property names and symbols.
  20760. */
  20761. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  20762. var result = keysFunc(object);
  20763. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  20764. }
  20765. /**
  20766. * The base implementation of `getTag` without fallbacks for buggy environments.
  20767. *
  20768. * @private
  20769. * @param {*} value The value to query.
  20770. * @returns {string} Returns the `toStringTag`.
  20771. */
  20772. function baseGetTag(value) {
  20773. if (value == null) {
  20774. return value === undefined ? undefinedTag : nullTag;
  20775. }
  20776. return (symToStringTag && symToStringTag in Object(value))
  20777. ? getRawTag(value)
  20778. : objectToString(value);
  20779. }
  20780. /**
  20781. * The base implementation of `_.gt` which doesn't coerce arguments.
  20782. *
  20783. * @private
  20784. * @param {*} value The value to compare.
  20785. * @param {*} other The other value to compare.
  20786. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  20787. * else `false`.
  20788. */
  20789. function baseGt(value, other) {
  20790. return value > other;
  20791. }
  20792. /**
  20793. * The base implementation of `_.has` without support for deep paths.
  20794. *
  20795. * @private
  20796. * @param {Object} [object] The object to query.
  20797. * @param {Array|string} key The key to check.
  20798. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20799. */
  20800. function baseHas(object, key) {
  20801. return object != null && hasOwnProperty.call(object, key);
  20802. }
  20803. /**
  20804. * The base implementation of `_.hasIn` without support for deep paths.
  20805. *
  20806. * @private
  20807. * @param {Object} [object] The object to query.
  20808. * @param {Array|string} key The key to check.
  20809. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20810. */
  20811. function baseHasIn(object, key) {
  20812. return object != null && key in Object(object);
  20813. }
  20814. /**
  20815. * The base implementation of `_.inRange` which doesn't coerce arguments.
  20816. *
  20817. * @private
  20818. * @param {number} number The number to check.
  20819. * @param {number} start The start of the range.
  20820. * @param {number} end The end of the range.
  20821. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  20822. */
  20823. function baseInRange(number, start, end) {
  20824. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  20825. }
  20826. /**
  20827. * The base implementation of methods like `_.intersection`, without support
  20828. * for iteratee shorthands, that accepts an array of arrays to inspect.
  20829. *
  20830. * @private
  20831. * @param {Array} arrays The arrays to inspect.
  20832. * @param {Function} [iteratee] The iteratee invoked per element.
  20833. * @param {Function} [comparator] The comparator invoked per element.
  20834. * @returns {Array} Returns the new array of shared values.
  20835. */
  20836. function baseIntersection(arrays, iteratee, comparator) {
  20837. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  20838. length = arrays[0].length,
  20839. othLength = arrays.length,
  20840. othIndex = othLength,
  20841. caches = Array(othLength),
  20842. maxLength = Infinity,
  20843. result = [];
  20844. while (othIndex--) {
  20845. var array = arrays[othIndex];
  20846. if (othIndex && iteratee) {
  20847. array = arrayMap(array, baseUnary(iteratee));
  20848. }
  20849. maxLength = nativeMin(array.length, maxLength);
  20850. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  20851. ? new SetCache(othIndex && array)
  20852. : undefined;
  20853. }
  20854. array = arrays[0];
  20855. var index = -1,
  20856. seen = caches[0];
  20857. outer:
  20858. while (++index < length && result.length < maxLength) {
  20859. var value = array[index],
  20860. computed = iteratee ? iteratee(value) : value;
  20861. value = (comparator || value !== 0) ? value : 0;
  20862. if (!(seen
  20863. ? cacheHas(seen, computed)
  20864. : includes(result, computed, comparator)
  20865. )) {
  20866. othIndex = othLength;
  20867. while (--othIndex) {
  20868. var cache = caches[othIndex];
  20869. if (!(cache
  20870. ? cacheHas(cache, computed)
  20871. : includes(arrays[othIndex], computed, comparator))
  20872. ) {
  20873. continue outer;
  20874. }
  20875. }
  20876. if (seen) {
  20877. seen.push(computed);
  20878. }
  20879. result.push(value);
  20880. }
  20881. }
  20882. return result;
  20883. }
  20884. /**
  20885. * The base implementation of `_.invert` and `_.invertBy` which inverts
  20886. * `object` with values transformed by `iteratee` and set by `setter`.
  20887. *
  20888. * @private
  20889. * @param {Object} object The object to iterate over.
  20890. * @param {Function} setter The function to set `accumulator` values.
  20891. * @param {Function} iteratee The iteratee to transform values.
  20892. * @param {Object} accumulator The initial inverted object.
  20893. * @returns {Function} Returns `accumulator`.
  20894. */
  20895. function baseInverter(object, setter, iteratee, accumulator) {
  20896. baseForOwn(object, function(value, key, object) {
  20897. setter(accumulator, iteratee(value), key, object);
  20898. });
  20899. return accumulator;
  20900. }
  20901. /**
  20902. * The base implementation of `_.invoke` without support for individual
  20903. * method arguments.
  20904. *
  20905. * @private
  20906. * @param {Object} object The object to query.
  20907. * @param {Array|string} path The path of the method to invoke.
  20908. * @param {Array} args The arguments to invoke the method with.
  20909. * @returns {*} Returns the result of the invoked method.
  20910. */
  20911. function baseInvoke(object, path, args) {
  20912. path = castPath(path, object);
  20913. object = parent(object, path);
  20914. var func = object == null ? object : object[toKey(last(path))];
  20915. return func == null ? undefined : apply(func, object, args);
  20916. }
  20917. /**
  20918. * The base implementation of `_.isArguments`.
  20919. *
  20920. * @private
  20921. * @param {*} value The value to check.
  20922. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  20923. */
  20924. function baseIsArguments(value) {
  20925. return isObjectLike(value) && baseGetTag(value) == argsTag;
  20926. }
  20927. /**
  20928. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  20929. *
  20930. * @private
  20931. * @param {*} value The value to check.
  20932. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  20933. */
  20934. function baseIsArrayBuffer(value) {
  20935. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  20936. }
  20937. /**
  20938. * The base implementation of `_.isDate` without Node.js optimizations.
  20939. *
  20940. * @private
  20941. * @param {*} value The value to check.
  20942. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  20943. */
  20944. function baseIsDate(value) {
  20945. return isObjectLike(value) && baseGetTag(value) == dateTag;
  20946. }
  20947. /**
  20948. * The base implementation of `_.isEqual` which supports partial comparisons
  20949. * and tracks traversed objects.
  20950. *
  20951. * @private
  20952. * @param {*} value The value to compare.
  20953. * @param {*} other The other value to compare.
  20954. * @param {boolean} bitmask The bitmask flags.
  20955. * 1 - Unordered comparison
  20956. * 2 - Partial comparison
  20957. * @param {Function} [customizer] The function to customize comparisons.
  20958. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  20959. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  20960. */
  20961. function baseIsEqual(value, other, bitmask, customizer, stack) {
  20962. if (value === other) {
  20963. return true;
  20964. }
  20965. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  20966. return value !== value && other !== other;
  20967. }
  20968. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  20969. }
  20970. /**
  20971. * A specialized version of `baseIsEqual` for arrays and objects which performs
  20972. * deep comparisons and tracks traversed objects enabling objects with circular
  20973. * references to be compared.
  20974. *
  20975. * @private
  20976. * @param {Object} object The object to compare.
  20977. * @param {Object} other The other object to compare.
  20978. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  20979. * @param {Function} customizer The function to customize comparisons.
  20980. * @param {Function} equalFunc The function to determine equivalents of values.
  20981. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  20982. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  20983. */
  20984. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  20985. var objIsArr = isArray(object),
  20986. othIsArr = isArray(other),
  20987. objTag = objIsArr ? arrayTag : getTag(object),
  20988. othTag = othIsArr ? arrayTag : getTag(other);
  20989. objTag = objTag == argsTag ? objectTag : objTag;
  20990. othTag = othTag == argsTag ? objectTag : othTag;
  20991. var objIsObj = objTag == objectTag,
  20992. othIsObj = othTag == objectTag,
  20993. isSameTag = objTag == othTag;
  20994. if (isSameTag && isBuffer(object)) {
  20995. if (!isBuffer(other)) {
  20996. return false;
  20997. }
  20998. objIsArr = true;
  20999. objIsObj = false;
  21000. }
  21001. if (isSameTag && !objIsObj) {
  21002. stack || (stack = new Stack);
  21003. return (objIsArr || isTypedArray(object))
  21004. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21005. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21006. }
  21007. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21008. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21009. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21010. if (objIsWrapped || othIsWrapped) {
  21011. var objUnwrapped = objIsWrapped ? object.value() : object,
  21012. othUnwrapped = othIsWrapped ? other.value() : other;
  21013. stack || (stack = new Stack);
  21014. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21015. }
  21016. }
  21017. if (!isSameTag) {
  21018. return false;
  21019. }
  21020. stack || (stack = new Stack);
  21021. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21022. }
  21023. /**
  21024. * The base implementation of `_.isMap` without Node.js optimizations.
  21025. *
  21026. * @private
  21027. * @param {*} value The value to check.
  21028. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21029. */
  21030. function baseIsMap(value) {
  21031. return isObjectLike(value) && getTag(value) == mapTag;
  21032. }
  21033. /**
  21034. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21035. *
  21036. * @private
  21037. * @param {Object} object The object to inspect.
  21038. * @param {Object} source The object of property values to match.
  21039. * @param {Array} matchData The property names, values, and compare flags to match.
  21040. * @param {Function} [customizer] The function to customize comparisons.
  21041. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21042. */
  21043. function baseIsMatch(object, source, matchData, customizer) {
  21044. var index = matchData.length,
  21045. length = index,
  21046. noCustomizer = !customizer;
  21047. if (object == null) {
  21048. return !length;
  21049. }
  21050. object = Object(object);
  21051. while (index--) {
  21052. var data = matchData[index];
  21053. if ((noCustomizer && data[2])
  21054. ? data[1] !== object[data[0]]
  21055. : !(data[0] in object)
  21056. ) {
  21057. return false;
  21058. }
  21059. }
  21060. while (++index < length) {
  21061. data = matchData[index];
  21062. var key = data[0],
  21063. objValue = object[key],
  21064. srcValue = data[1];
  21065. if (noCustomizer && data[2]) {
  21066. if (objValue === undefined && !(key in object)) {
  21067. return false;
  21068. }
  21069. } else {
  21070. var stack = new Stack;
  21071. if (customizer) {
  21072. var result = customizer(objValue, srcValue, key, object, source, stack);
  21073. }
  21074. if (!(result === undefined
  21075. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21076. : result
  21077. )) {
  21078. return false;
  21079. }
  21080. }
  21081. }
  21082. return true;
  21083. }
  21084. /**
  21085. * The base implementation of `_.isNative` without bad shim checks.
  21086. *
  21087. * @private
  21088. * @param {*} value The value to check.
  21089. * @returns {boolean} Returns `true` if `value` is a native function,
  21090. * else `false`.
  21091. */
  21092. function baseIsNative(value) {
  21093. if (!isObject(value) || isMasked(value)) {
  21094. return false;
  21095. }
  21096. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21097. return pattern.test(toSource(value));
  21098. }
  21099. /**
  21100. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21101. *
  21102. * @private
  21103. * @param {*} value The value to check.
  21104. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21105. */
  21106. function baseIsRegExp(value) {
  21107. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21108. }
  21109. /**
  21110. * The base implementation of `_.isSet` without Node.js optimizations.
  21111. *
  21112. * @private
  21113. * @param {*} value The value to check.
  21114. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21115. */
  21116. function baseIsSet(value) {
  21117. return isObjectLike(value) && getTag(value) == setTag;
  21118. }
  21119. /**
  21120. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21121. *
  21122. * @private
  21123. * @param {*} value The value to check.
  21124. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21125. */
  21126. function baseIsTypedArray(value) {
  21127. return isObjectLike(value) &&
  21128. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21129. }
  21130. /**
  21131. * The base implementation of `_.iteratee`.
  21132. *
  21133. * @private
  21134. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21135. * @returns {Function} Returns the iteratee.
  21136. */
  21137. function baseIteratee(value) {
  21138. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21139. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21140. if (typeof value == 'function') {
  21141. return value;
  21142. }
  21143. if (value == null) {
  21144. return identity;
  21145. }
  21146. if (typeof value == 'object') {
  21147. return isArray(value)
  21148. ? baseMatchesProperty(value[0], value[1])
  21149. : baseMatches(value);
  21150. }
  21151. return property(value);
  21152. }
  21153. /**
  21154. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21155. *
  21156. * @private
  21157. * @param {Object} object The object to query.
  21158. * @returns {Array} Returns the array of property names.
  21159. */
  21160. function baseKeys(object) {
  21161. if (!isPrototype(object)) {
  21162. return nativeKeys(object);
  21163. }
  21164. var result = [];
  21165. for (var key in Object(object)) {
  21166. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21167. result.push(key);
  21168. }
  21169. }
  21170. return result;
  21171. }
  21172. /**
  21173. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21174. *
  21175. * @private
  21176. * @param {Object} object The object to query.
  21177. * @returns {Array} Returns the array of property names.
  21178. */
  21179. function baseKeysIn(object) {
  21180. if (!isObject(object)) {
  21181. return nativeKeysIn(object);
  21182. }
  21183. var isProto = isPrototype(object),
  21184. result = [];
  21185. for (var key in object) {
  21186. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21187. result.push(key);
  21188. }
  21189. }
  21190. return result;
  21191. }
  21192. /**
  21193. * The base implementation of `_.lt` which doesn't coerce arguments.
  21194. *
  21195. * @private
  21196. * @param {*} value The value to compare.
  21197. * @param {*} other The other value to compare.
  21198. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21199. * else `false`.
  21200. */
  21201. function baseLt(value, other) {
  21202. return value < other;
  21203. }
  21204. /**
  21205. * The base implementation of `_.map` without support for iteratee shorthands.
  21206. *
  21207. * @private
  21208. * @param {Array|Object} collection The collection to iterate over.
  21209. * @param {Function} iteratee The function invoked per iteration.
  21210. * @returns {Array} Returns the new mapped array.
  21211. */
  21212. function baseMap(collection, iteratee) {
  21213. var index = -1,
  21214. result = isArrayLike(collection) ? Array(collection.length) : [];
  21215. baseEach(collection, function(value, key, collection) {
  21216. result[++index] = iteratee(value, key, collection);
  21217. });
  21218. return result;
  21219. }
  21220. /**
  21221. * The base implementation of `_.matches` which doesn't clone `source`.
  21222. *
  21223. * @private
  21224. * @param {Object} source The object of property values to match.
  21225. * @returns {Function} Returns the new spec function.
  21226. */
  21227. function baseMatches(source) {
  21228. var matchData = getMatchData(source);
  21229. if (matchData.length == 1 && matchData[0][2]) {
  21230. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21231. }
  21232. return function(object) {
  21233. return object === source || baseIsMatch(object, source, matchData);
  21234. };
  21235. }
  21236. /**
  21237. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21238. *
  21239. * @private
  21240. * @param {string} path The path of the property to get.
  21241. * @param {*} srcValue The value to match.
  21242. * @returns {Function} Returns the new spec function.
  21243. */
  21244. function baseMatchesProperty(path, srcValue) {
  21245. if (isKey(path) && isStrictComparable(srcValue)) {
  21246. return matchesStrictComparable(toKey(path), srcValue);
  21247. }
  21248. return function(object) {
  21249. var objValue = get(object, path);
  21250. return (objValue === undefined && objValue === srcValue)
  21251. ? hasIn(object, path)
  21252. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21253. };
  21254. }
  21255. /**
  21256. * The base implementation of `_.merge` without support for multiple sources.
  21257. *
  21258. * @private
  21259. * @param {Object} object The destination object.
  21260. * @param {Object} source The source object.
  21261. * @param {number} srcIndex The index of `source`.
  21262. * @param {Function} [customizer] The function to customize merged values.
  21263. * @param {Object} [stack] Tracks traversed source values and their merged
  21264. * counterparts.
  21265. */
  21266. function baseMerge(object, source, srcIndex, customizer, stack) {
  21267. if (object === source) {
  21268. return;
  21269. }
  21270. baseFor(source, function(srcValue, key) {
  21271. stack || (stack = new Stack);
  21272. if (isObject(srcValue)) {
  21273. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21274. }
  21275. else {
  21276. var newValue = customizer
  21277. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21278. : undefined;
  21279. if (newValue === undefined) {
  21280. newValue = srcValue;
  21281. }
  21282. assignMergeValue(object, key, newValue);
  21283. }
  21284. }, keysIn);
  21285. }
  21286. /**
  21287. * A specialized version of `baseMerge` for arrays and objects which performs
  21288. * deep merges and tracks traversed objects enabling objects with circular
  21289. * references to be merged.
  21290. *
  21291. * @private
  21292. * @param {Object} object The destination object.
  21293. * @param {Object} source The source object.
  21294. * @param {string} key The key of the value to merge.
  21295. * @param {number} srcIndex The index of `source`.
  21296. * @param {Function} mergeFunc The function to merge values.
  21297. * @param {Function} [customizer] The function to customize assigned values.
  21298. * @param {Object} [stack] Tracks traversed source values and their merged
  21299. * counterparts.
  21300. */
  21301. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21302. var objValue = safeGet(object, key),
  21303. srcValue = safeGet(source, key),
  21304. stacked = stack.get(srcValue);
  21305. if (stacked) {
  21306. assignMergeValue(object, key, stacked);
  21307. return;
  21308. }
  21309. var newValue = customizer
  21310. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21311. : undefined;
  21312. var isCommon = newValue === undefined;
  21313. if (isCommon) {
  21314. var isArr = isArray(srcValue),
  21315. isBuff = !isArr && isBuffer(srcValue),
  21316. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21317. newValue = srcValue;
  21318. if (isArr || isBuff || isTyped) {
  21319. if (isArray(objValue)) {
  21320. newValue = objValue;
  21321. }
  21322. else if (isArrayLikeObject(objValue)) {
  21323. newValue = copyArray(objValue);
  21324. }
  21325. else if (isBuff) {
  21326. isCommon = false;
  21327. newValue = cloneBuffer(srcValue, true);
  21328. }
  21329. else if (isTyped) {
  21330. isCommon = false;
  21331. newValue = cloneTypedArray(srcValue, true);
  21332. }
  21333. else {
  21334. newValue = [];
  21335. }
  21336. }
  21337. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21338. newValue = objValue;
  21339. if (isArguments(objValue)) {
  21340. newValue = toPlainObject(objValue);
  21341. }
  21342. else if (!isObject(objValue) || isFunction(objValue)) {
  21343. newValue = initCloneObject(srcValue);
  21344. }
  21345. }
  21346. else {
  21347. isCommon = false;
  21348. }
  21349. }
  21350. if (isCommon) {
  21351. // Recursively merge objects and arrays (susceptible to call stack limits).
  21352. stack.set(srcValue, newValue);
  21353. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21354. stack['delete'](srcValue);
  21355. }
  21356. assignMergeValue(object, key, newValue);
  21357. }
  21358. /**
  21359. * The base implementation of `_.nth` which doesn't coerce arguments.
  21360. *
  21361. * @private
  21362. * @param {Array} array The array to query.
  21363. * @param {number} n The index of the element to return.
  21364. * @returns {*} Returns the nth element of `array`.
  21365. */
  21366. function baseNth(array, n) {
  21367. var length = array.length;
  21368. if (!length) {
  21369. return;
  21370. }
  21371. n += n < 0 ? length : 0;
  21372. return isIndex(n, length) ? array[n] : undefined;
  21373. }
  21374. /**
  21375. * The base implementation of `_.orderBy` without param guards.
  21376. *
  21377. * @private
  21378. * @param {Array|Object} collection The collection to iterate over.
  21379. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21380. * @param {string[]} orders The sort orders of `iteratees`.
  21381. * @returns {Array} Returns the new sorted array.
  21382. */
  21383. function baseOrderBy(collection, iteratees, orders) {
  21384. var index = -1;
  21385. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21386. var result = baseMap(collection, function(value, key, collection) {
  21387. var criteria = arrayMap(iteratees, function(iteratee) {
  21388. return iteratee(value);
  21389. });
  21390. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21391. });
  21392. return baseSortBy(result, function(object, other) {
  21393. return compareMultiple(object, other, orders);
  21394. });
  21395. }
  21396. /**
  21397. * The base implementation of `_.pick` without support for individual
  21398. * property identifiers.
  21399. *
  21400. * @private
  21401. * @param {Object} object The source object.
  21402. * @param {string[]} paths The property paths to pick.
  21403. * @returns {Object} Returns the new object.
  21404. */
  21405. function basePick(object, paths) {
  21406. return basePickBy(object, paths, function(value, path) {
  21407. return hasIn(object, path);
  21408. });
  21409. }
  21410. /**
  21411. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21412. *
  21413. * @private
  21414. * @param {Object} object The source object.
  21415. * @param {string[]} paths The property paths to pick.
  21416. * @param {Function} predicate The function invoked per property.
  21417. * @returns {Object} Returns the new object.
  21418. */
  21419. function basePickBy(object, paths, predicate) {
  21420. var index = -1,
  21421. length = paths.length,
  21422. result = {};
  21423. while (++index < length) {
  21424. var path = paths[index],
  21425. value = baseGet(object, path);
  21426. if (predicate(value, path)) {
  21427. baseSet(result, castPath(path, object), value);
  21428. }
  21429. }
  21430. return result;
  21431. }
  21432. /**
  21433. * A specialized version of `baseProperty` which supports deep paths.
  21434. *
  21435. * @private
  21436. * @param {Array|string} path The path of the property to get.
  21437. * @returns {Function} Returns the new accessor function.
  21438. */
  21439. function basePropertyDeep(path) {
  21440. return function(object) {
  21441. return baseGet(object, path);
  21442. };
  21443. }
  21444. /**
  21445. * The base implementation of `_.pullAllBy` without support for iteratee
  21446. * shorthands.
  21447. *
  21448. * @private
  21449. * @param {Array} array The array to modify.
  21450. * @param {Array} values The values to remove.
  21451. * @param {Function} [iteratee] The iteratee invoked per element.
  21452. * @param {Function} [comparator] The comparator invoked per element.
  21453. * @returns {Array} Returns `array`.
  21454. */
  21455. function basePullAll(array, values, iteratee, comparator) {
  21456. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21457. index = -1,
  21458. length = values.length,
  21459. seen = array;
  21460. if (array === values) {
  21461. values = copyArray(values);
  21462. }
  21463. if (iteratee) {
  21464. seen = arrayMap(array, baseUnary(iteratee));
  21465. }
  21466. while (++index < length) {
  21467. var fromIndex = 0,
  21468. value = values[index],
  21469. computed = iteratee ? iteratee(value) : value;
  21470. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21471. if (seen !== array) {
  21472. splice.call(seen, fromIndex, 1);
  21473. }
  21474. splice.call(array, fromIndex, 1);
  21475. }
  21476. }
  21477. return array;
  21478. }
  21479. /**
  21480. * The base implementation of `_.pullAt` without support for individual
  21481. * indexes or capturing the removed elements.
  21482. *
  21483. * @private
  21484. * @param {Array} array The array to modify.
  21485. * @param {number[]} indexes The indexes of elements to remove.
  21486. * @returns {Array} Returns `array`.
  21487. */
  21488. function basePullAt(array, indexes) {
  21489. var length = array ? indexes.length : 0,
  21490. lastIndex = length - 1;
  21491. while (length--) {
  21492. var index = indexes[length];
  21493. if (length == lastIndex || index !== previous) {
  21494. var previous = index;
  21495. if (isIndex(index)) {
  21496. splice.call(array, index, 1);
  21497. } else {
  21498. baseUnset(array, index);
  21499. }
  21500. }
  21501. }
  21502. return array;
  21503. }
  21504. /**
  21505. * The base implementation of `_.random` without support for returning
  21506. * floating-point numbers.
  21507. *
  21508. * @private
  21509. * @param {number} lower The lower bound.
  21510. * @param {number} upper The upper bound.
  21511. * @returns {number} Returns the random number.
  21512. */
  21513. function baseRandom(lower, upper) {
  21514. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21515. }
  21516. /**
  21517. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21518. * coerce arguments.
  21519. *
  21520. * @private
  21521. * @param {number} start The start of the range.
  21522. * @param {number} end The end of the range.
  21523. * @param {number} step The value to increment or decrement by.
  21524. * @param {boolean} [fromRight] Specify iterating from right to left.
  21525. * @returns {Array} Returns the range of numbers.
  21526. */
  21527. function baseRange(start, end, step, fromRight) {
  21528. var index = -1,
  21529. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21530. result = Array(length);
  21531. while (length--) {
  21532. result[fromRight ? length : ++index] = start;
  21533. start += step;
  21534. }
  21535. return result;
  21536. }
  21537. /**
  21538. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21539. *
  21540. * @private
  21541. * @param {string} string The string to repeat.
  21542. * @param {number} n The number of times to repeat the string.
  21543. * @returns {string} Returns the repeated string.
  21544. */
  21545. function baseRepeat(string, n) {
  21546. var result = '';
  21547. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21548. return result;
  21549. }
  21550. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21551. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21552. do {
  21553. if (n % 2) {
  21554. result += string;
  21555. }
  21556. n = nativeFloor(n / 2);
  21557. if (n) {
  21558. string += string;
  21559. }
  21560. } while (n);
  21561. return result;
  21562. }
  21563. /**
  21564. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21565. *
  21566. * @private
  21567. * @param {Function} func The function to apply a rest parameter to.
  21568. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21569. * @returns {Function} Returns the new function.
  21570. */
  21571. function baseRest(func, start) {
  21572. return setToString(overRest(func, start, identity), func + '');
  21573. }
  21574. /**
  21575. * The base implementation of `_.sample`.
  21576. *
  21577. * @private
  21578. * @param {Array|Object} collection The collection to sample.
  21579. * @returns {*} Returns the random element.
  21580. */
  21581. function baseSample(collection) {
  21582. return arraySample(values(collection));
  21583. }
  21584. /**
  21585. * The base implementation of `_.sampleSize` without param guards.
  21586. *
  21587. * @private
  21588. * @param {Array|Object} collection The collection to sample.
  21589. * @param {number} n The number of elements to sample.
  21590. * @returns {Array} Returns the random elements.
  21591. */
  21592. function baseSampleSize(collection, n) {
  21593. var array = values(collection);
  21594. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21595. }
  21596. /**
  21597. * The base implementation of `_.set`.
  21598. *
  21599. * @private
  21600. * @param {Object} object The object to modify.
  21601. * @param {Array|string} path The path of the property to set.
  21602. * @param {*} value The value to set.
  21603. * @param {Function} [customizer] The function to customize path creation.
  21604. * @returns {Object} Returns `object`.
  21605. */
  21606. function baseSet(object, path, value, customizer) {
  21607. if (!isObject(object)) {
  21608. return object;
  21609. }
  21610. path = castPath(path, object);
  21611. var index = -1,
  21612. length = path.length,
  21613. lastIndex = length - 1,
  21614. nested = object;
  21615. while (nested != null && ++index < length) {
  21616. var key = toKey(path[index]),
  21617. newValue = value;
  21618. if (index != lastIndex) {
  21619. var objValue = nested[key];
  21620. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21621. if (newValue === undefined) {
  21622. newValue = isObject(objValue)
  21623. ? objValue
  21624. : (isIndex(path[index + 1]) ? [] : {});
  21625. }
  21626. }
  21627. assignValue(nested, key, newValue);
  21628. nested = nested[key];
  21629. }
  21630. return object;
  21631. }
  21632. /**
  21633. * The base implementation of `setData` without support for hot loop shorting.
  21634. *
  21635. * @private
  21636. * @param {Function} func The function to associate metadata with.
  21637. * @param {*} data The metadata.
  21638. * @returns {Function} Returns `func`.
  21639. */
  21640. var baseSetData = !metaMap ? identity : function(func, data) {
  21641. metaMap.set(func, data);
  21642. return func;
  21643. };
  21644. /**
  21645. * The base implementation of `setToString` without support for hot loop shorting.
  21646. *
  21647. * @private
  21648. * @param {Function} func The function to modify.
  21649. * @param {Function} string The `toString` result.
  21650. * @returns {Function} Returns `func`.
  21651. */
  21652. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21653. return defineProperty(func, 'toString', {
  21654. 'configurable': true,
  21655. 'enumerable': false,
  21656. 'value': constant(string),
  21657. 'writable': true
  21658. });
  21659. };
  21660. /**
  21661. * The base implementation of `_.shuffle`.
  21662. *
  21663. * @private
  21664. * @param {Array|Object} collection The collection to shuffle.
  21665. * @returns {Array} Returns the new shuffled array.
  21666. */
  21667. function baseShuffle(collection) {
  21668. return shuffleSelf(values(collection));
  21669. }
  21670. /**
  21671. * The base implementation of `_.slice` without an iteratee call guard.
  21672. *
  21673. * @private
  21674. * @param {Array} array The array to slice.
  21675. * @param {number} [start=0] The start position.
  21676. * @param {number} [end=array.length] The end position.
  21677. * @returns {Array} Returns the slice of `array`.
  21678. */
  21679. function baseSlice(array, start, end) {
  21680. var index = -1,
  21681. length = array.length;
  21682. if (start < 0) {
  21683. start = -start > length ? 0 : (length + start);
  21684. }
  21685. end = end > length ? length : end;
  21686. if (end < 0) {
  21687. end += length;
  21688. }
  21689. length = start > end ? 0 : ((end - start) >>> 0);
  21690. start >>>= 0;
  21691. var result = Array(length);
  21692. while (++index < length) {
  21693. result[index] = array[index + start];
  21694. }
  21695. return result;
  21696. }
  21697. /**
  21698. * The base implementation of `_.some` without support for iteratee shorthands.
  21699. *
  21700. * @private
  21701. * @param {Array|Object} collection The collection to iterate over.
  21702. * @param {Function} predicate The function invoked per iteration.
  21703. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21704. * else `false`.
  21705. */
  21706. function baseSome(collection, predicate) {
  21707. var result;
  21708. baseEach(collection, function(value, index, collection) {
  21709. result = predicate(value, index, collection);
  21710. return !result;
  21711. });
  21712. return !!result;
  21713. }
  21714. /**
  21715. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21716. * performs a binary search of `array` to determine the index at which `value`
  21717. * should be inserted into `array` in order to maintain its sort order.
  21718. *
  21719. * @private
  21720. * @param {Array} array The sorted array to inspect.
  21721. * @param {*} value The value to evaluate.
  21722. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21723. * @returns {number} Returns the index at which `value` should be inserted
  21724. * into `array`.
  21725. */
  21726. function baseSortedIndex(array, value, retHighest) {
  21727. var low = 0,
  21728. high = array == null ? low : array.length;
  21729. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21730. while (low < high) {
  21731. var mid = (low + high) >>> 1,
  21732. computed = array[mid];
  21733. if (computed !== null && !isSymbol(computed) &&
  21734. (retHighest ? (computed <= value) : (computed < value))) {
  21735. low = mid + 1;
  21736. } else {
  21737. high = mid;
  21738. }
  21739. }
  21740. return high;
  21741. }
  21742. return baseSortedIndexBy(array, value, identity, retHighest);
  21743. }
  21744. /**
  21745. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  21746. * which invokes `iteratee` for `value` and each element of `array` to compute
  21747. * their sort ranking. The iteratee is invoked with one argument; (value).
  21748. *
  21749. * @private
  21750. * @param {Array} array The sorted array to inspect.
  21751. * @param {*} value The value to evaluate.
  21752. * @param {Function} iteratee The iteratee invoked per element.
  21753. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21754. * @returns {number} Returns the index at which `value` should be inserted
  21755. * into `array`.
  21756. */
  21757. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  21758. value = iteratee(value);
  21759. var low = 0,
  21760. high = array == null ? 0 : array.length,
  21761. valIsNaN = value !== value,
  21762. valIsNull = value === null,
  21763. valIsSymbol = isSymbol(value),
  21764. valIsUndefined = value === undefined;
  21765. while (low < high) {
  21766. var mid = nativeFloor((low + high) / 2),
  21767. computed = iteratee(array[mid]),
  21768. othIsDefined = computed !== undefined,
  21769. othIsNull = computed === null,
  21770. othIsReflexive = computed === computed,
  21771. othIsSymbol = isSymbol(computed);
  21772. if (valIsNaN) {
  21773. var setLow = retHighest || othIsReflexive;
  21774. } else if (valIsUndefined) {
  21775. setLow = othIsReflexive && (retHighest || othIsDefined);
  21776. } else if (valIsNull) {
  21777. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  21778. } else if (valIsSymbol) {
  21779. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  21780. } else if (othIsNull || othIsSymbol) {
  21781. setLow = false;
  21782. } else {
  21783. setLow = retHighest ? (computed <= value) : (computed < value);
  21784. }
  21785. if (setLow) {
  21786. low = mid + 1;
  21787. } else {
  21788. high = mid;
  21789. }
  21790. }
  21791. return nativeMin(high, MAX_ARRAY_INDEX);
  21792. }
  21793. /**
  21794. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  21795. * support for iteratee shorthands.
  21796. *
  21797. * @private
  21798. * @param {Array} array The array to inspect.
  21799. * @param {Function} [iteratee] The iteratee invoked per element.
  21800. * @returns {Array} Returns the new duplicate free array.
  21801. */
  21802. function baseSortedUniq(array, iteratee) {
  21803. var index = -1,
  21804. length = array.length,
  21805. resIndex = 0,
  21806. result = [];
  21807. while (++index < length) {
  21808. var value = array[index],
  21809. computed = iteratee ? iteratee(value) : value;
  21810. if (!index || !eq(computed, seen)) {
  21811. var seen = computed;
  21812. result[resIndex++] = value === 0 ? 0 : value;
  21813. }
  21814. }
  21815. return result;
  21816. }
  21817. /**
  21818. * The base implementation of `_.toNumber` which doesn't ensure correct
  21819. * conversions of binary, hexadecimal, or octal string values.
  21820. *
  21821. * @private
  21822. * @param {*} value The value to process.
  21823. * @returns {number} Returns the number.
  21824. */
  21825. function baseToNumber(value) {
  21826. if (typeof value == 'number') {
  21827. return value;
  21828. }
  21829. if (isSymbol(value)) {
  21830. return NAN;
  21831. }
  21832. return +value;
  21833. }
  21834. /**
  21835. * The base implementation of `_.toString` which doesn't convert nullish
  21836. * values to empty strings.
  21837. *
  21838. * @private
  21839. * @param {*} value The value to process.
  21840. * @returns {string} Returns the string.
  21841. */
  21842. function baseToString(value) {
  21843. // Exit early for strings to avoid a performance hit in some environments.
  21844. if (typeof value == 'string') {
  21845. return value;
  21846. }
  21847. if (isArray(value)) {
  21848. // Recursively convert values (susceptible to call stack limits).
  21849. return arrayMap(value, baseToString) + '';
  21850. }
  21851. if (isSymbol(value)) {
  21852. return symbolToString ? symbolToString.call(value) : '';
  21853. }
  21854. var result = (value + '');
  21855. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  21856. }
  21857. /**
  21858. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  21859. *
  21860. * @private
  21861. * @param {Array} array The array to inspect.
  21862. * @param {Function} [iteratee] The iteratee invoked per element.
  21863. * @param {Function} [comparator] The comparator invoked per element.
  21864. * @returns {Array} Returns the new duplicate free array.
  21865. */
  21866. function baseUniq(array, iteratee, comparator) {
  21867. var index = -1,
  21868. includes = arrayIncludes,
  21869. length = array.length,
  21870. isCommon = true,
  21871. result = [],
  21872. seen = result;
  21873. if (comparator) {
  21874. isCommon = false;
  21875. includes = arrayIncludesWith;
  21876. }
  21877. else if (length >= LARGE_ARRAY_SIZE) {
  21878. var set = iteratee ? null : createSet(array);
  21879. if (set) {
  21880. return setToArray(set);
  21881. }
  21882. isCommon = false;
  21883. includes = cacheHas;
  21884. seen = new SetCache;
  21885. }
  21886. else {
  21887. seen = iteratee ? [] : result;
  21888. }
  21889. outer:
  21890. while (++index < length) {
  21891. var value = array[index],
  21892. computed = iteratee ? iteratee(value) : value;
  21893. value = (comparator || value !== 0) ? value : 0;
  21894. if (isCommon && computed === computed) {
  21895. var seenIndex = seen.length;
  21896. while (seenIndex--) {
  21897. if (seen[seenIndex] === computed) {
  21898. continue outer;
  21899. }
  21900. }
  21901. if (iteratee) {
  21902. seen.push(computed);
  21903. }
  21904. result.push(value);
  21905. }
  21906. else if (!includes(seen, computed, comparator)) {
  21907. if (seen !== result) {
  21908. seen.push(computed);
  21909. }
  21910. result.push(value);
  21911. }
  21912. }
  21913. return result;
  21914. }
  21915. /**
  21916. * The base implementation of `_.unset`.
  21917. *
  21918. * @private
  21919. * @param {Object} object The object to modify.
  21920. * @param {Array|string} path The property path to unset.
  21921. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  21922. */
  21923. function baseUnset(object, path) {
  21924. path = castPath(path, object);
  21925. object = parent(object, path);
  21926. return object == null || delete object[toKey(last(path))];
  21927. }
  21928. /**
  21929. * The base implementation of `_.update`.
  21930. *
  21931. * @private
  21932. * @param {Object} object The object to modify.
  21933. * @param {Array|string} path The path of the property to update.
  21934. * @param {Function} updater The function to produce the updated value.
  21935. * @param {Function} [customizer] The function to customize path creation.
  21936. * @returns {Object} Returns `object`.
  21937. */
  21938. function baseUpdate(object, path, updater, customizer) {
  21939. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  21940. }
  21941. /**
  21942. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  21943. * without support for iteratee shorthands.
  21944. *
  21945. * @private
  21946. * @param {Array} array The array to query.
  21947. * @param {Function} predicate The function invoked per iteration.
  21948. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  21949. * @param {boolean} [fromRight] Specify iterating from right to left.
  21950. * @returns {Array} Returns the slice of `array`.
  21951. */
  21952. function baseWhile(array, predicate, isDrop, fromRight) {
  21953. var length = array.length,
  21954. index = fromRight ? length : -1;
  21955. while ((fromRight ? index-- : ++index < length) &&
  21956. predicate(array[index], index, array)) {}
  21957. return isDrop
  21958. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  21959. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  21960. }
  21961. /**
  21962. * The base implementation of `wrapperValue` which returns the result of
  21963. * performing a sequence of actions on the unwrapped `value`, where each
  21964. * successive action is supplied the return value of the previous.
  21965. *
  21966. * @private
  21967. * @param {*} value The unwrapped value.
  21968. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  21969. * @returns {*} Returns the resolved value.
  21970. */
  21971. function baseWrapperValue(value, actions) {
  21972. var result = value;
  21973. if (result instanceof LazyWrapper) {
  21974. result = result.value();
  21975. }
  21976. return arrayReduce(actions, function(result, action) {
  21977. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  21978. }, result);
  21979. }
  21980. /**
  21981. * The base implementation of methods like `_.xor`, without support for
  21982. * iteratee shorthands, that accepts an array of arrays to inspect.
  21983. *
  21984. * @private
  21985. * @param {Array} arrays The arrays to inspect.
  21986. * @param {Function} [iteratee] The iteratee invoked per element.
  21987. * @param {Function} [comparator] The comparator invoked per element.
  21988. * @returns {Array} Returns the new array of values.
  21989. */
  21990. function baseXor(arrays, iteratee, comparator) {
  21991. var length = arrays.length;
  21992. if (length < 2) {
  21993. return length ? baseUniq(arrays[0]) : [];
  21994. }
  21995. var index = -1,
  21996. result = Array(length);
  21997. while (++index < length) {
  21998. var array = arrays[index],
  21999. othIndex = -1;
  22000. while (++othIndex < length) {
  22001. if (othIndex != index) {
  22002. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22003. }
  22004. }
  22005. }
  22006. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22007. }
  22008. /**
  22009. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22010. *
  22011. * @private
  22012. * @param {Array} props The property identifiers.
  22013. * @param {Array} values The property values.
  22014. * @param {Function} assignFunc The function to assign values.
  22015. * @returns {Object} Returns the new object.
  22016. */
  22017. function baseZipObject(props, values, assignFunc) {
  22018. var index = -1,
  22019. length = props.length,
  22020. valsLength = values.length,
  22021. result = {};
  22022. while (++index < length) {
  22023. var value = index < valsLength ? values[index] : undefined;
  22024. assignFunc(result, props[index], value);
  22025. }
  22026. return result;
  22027. }
  22028. /**
  22029. * Casts `value` to an empty array if it's not an array like object.
  22030. *
  22031. * @private
  22032. * @param {*} value The value to inspect.
  22033. * @returns {Array|Object} Returns the cast array-like object.
  22034. */
  22035. function castArrayLikeObject(value) {
  22036. return isArrayLikeObject(value) ? value : [];
  22037. }
  22038. /**
  22039. * Casts `value` to `identity` if it's not a function.
  22040. *
  22041. * @private
  22042. * @param {*} value The value to inspect.
  22043. * @returns {Function} Returns cast function.
  22044. */
  22045. function castFunction(value) {
  22046. return typeof value == 'function' ? value : identity;
  22047. }
  22048. /**
  22049. * Casts `value` to a path array if it's not one.
  22050. *
  22051. * @private
  22052. * @param {*} value The value to inspect.
  22053. * @param {Object} [object] The object to query keys on.
  22054. * @returns {Array} Returns the cast property path array.
  22055. */
  22056. function castPath(value, object) {
  22057. if (isArray(value)) {
  22058. return value;
  22059. }
  22060. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22061. }
  22062. /**
  22063. * A `baseRest` alias which can be replaced with `identity` by module
  22064. * replacement plugins.
  22065. *
  22066. * @private
  22067. * @type {Function}
  22068. * @param {Function} func The function to apply a rest parameter to.
  22069. * @returns {Function} Returns the new function.
  22070. */
  22071. var castRest = baseRest;
  22072. /**
  22073. * Casts `array` to a slice if it's needed.
  22074. *
  22075. * @private
  22076. * @param {Array} array The array to inspect.
  22077. * @param {number} start The start position.
  22078. * @param {number} [end=array.length] The end position.
  22079. * @returns {Array} Returns the cast slice.
  22080. */
  22081. function castSlice(array, start, end) {
  22082. var length = array.length;
  22083. end = end === undefined ? length : end;
  22084. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22085. }
  22086. /**
  22087. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22088. *
  22089. * @private
  22090. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22091. */
  22092. var clearTimeout = ctxClearTimeout || function(id) {
  22093. return root.clearTimeout(id);
  22094. };
  22095. /**
  22096. * Creates a clone of `buffer`.
  22097. *
  22098. * @private
  22099. * @param {Buffer} buffer The buffer to clone.
  22100. * @param {boolean} [isDeep] Specify a deep clone.
  22101. * @returns {Buffer} Returns the cloned buffer.
  22102. */
  22103. function cloneBuffer(buffer, isDeep) {
  22104. if (isDeep) {
  22105. return buffer.slice();
  22106. }
  22107. var length = buffer.length,
  22108. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22109. buffer.copy(result);
  22110. return result;
  22111. }
  22112. /**
  22113. * Creates a clone of `arrayBuffer`.
  22114. *
  22115. * @private
  22116. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22117. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22118. */
  22119. function cloneArrayBuffer(arrayBuffer) {
  22120. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22121. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22122. return result;
  22123. }
  22124. /**
  22125. * Creates a clone of `dataView`.
  22126. *
  22127. * @private
  22128. * @param {Object} dataView The data view to clone.
  22129. * @param {boolean} [isDeep] Specify a deep clone.
  22130. * @returns {Object} Returns the cloned data view.
  22131. */
  22132. function cloneDataView(dataView, isDeep) {
  22133. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22134. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22135. }
  22136. /**
  22137. * Creates a clone of `regexp`.
  22138. *
  22139. * @private
  22140. * @param {Object} regexp The regexp to clone.
  22141. * @returns {Object} Returns the cloned regexp.
  22142. */
  22143. function cloneRegExp(regexp) {
  22144. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22145. result.lastIndex = regexp.lastIndex;
  22146. return result;
  22147. }
  22148. /**
  22149. * Creates a clone of the `symbol` object.
  22150. *
  22151. * @private
  22152. * @param {Object} symbol The symbol object to clone.
  22153. * @returns {Object} Returns the cloned symbol object.
  22154. */
  22155. function cloneSymbol(symbol) {
  22156. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22157. }
  22158. /**
  22159. * Creates a clone of `typedArray`.
  22160. *
  22161. * @private
  22162. * @param {Object} typedArray The typed array to clone.
  22163. * @param {boolean} [isDeep] Specify a deep clone.
  22164. * @returns {Object} Returns the cloned typed array.
  22165. */
  22166. function cloneTypedArray(typedArray, isDeep) {
  22167. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22168. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22169. }
  22170. /**
  22171. * Compares values to sort them in ascending order.
  22172. *
  22173. * @private
  22174. * @param {*} value The value to compare.
  22175. * @param {*} other The other value to compare.
  22176. * @returns {number} Returns the sort order indicator for `value`.
  22177. */
  22178. function compareAscending(value, other) {
  22179. if (value !== other) {
  22180. var valIsDefined = value !== undefined,
  22181. valIsNull = value === null,
  22182. valIsReflexive = value === value,
  22183. valIsSymbol = isSymbol(value);
  22184. var othIsDefined = other !== undefined,
  22185. othIsNull = other === null,
  22186. othIsReflexive = other === other,
  22187. othIsSymbol = isSymbol(other);
  22188. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22189. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22190. (valIsNull && othIsDefined && othIsReflexive) ||
  22191. (!valIsDefined && othIsReflexive) ||
  22192. !valIsReflexive) {
  22193. return 1;
  22194. }
  22195. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22196. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22197. (othIsNull && valIsDefined && valIsReflexive) ||
  22198. (!othIsDefined && valIsReflexive) ||
  22199. !othIsReflexive) {
  22200. return -1;
  22201. }
  22202. }
  22203. return 0;
  22204. }
  22205. /**
  22206. * Used by `_.orderBy` to compare multiple properties of a value to another
  22207. * and stable sort them.
  22208. *
  22209. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22210. * specify an order of "desc" for descending or "asc" for ascending sort order
  22211. * of corresponding values.
  22212. *
  22213. * @private
  22214. * @param {Object} object The object to compare.
  22215. * @param {Object} other The other object to compare.
  22216. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22217. * @returns {number} Returns the sort order indicator for `object`.
  22218. */
  22219. function compareMultiple(object, other, orders) {
  22220. var index = -1,
  22221. objCriteria = object.criteria,
  22222. othCriteria = other.criteria,
  22223. length = objCriteria.length,
  22224. ordersLength = orders.length;
  22225. while (++index < length) {
  22226. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22227. if (result) {
  22228. if (index >= ordersLength) {
  22229. return result;
  22230. }
  22231. var order = orders[index];
  22232. return result * (order == 'desc' ? -1 : 1);
  22233. }
  22234. }
  22235. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22236. // that causes it, under certain circumstances, to provide the same value for
  22237. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22238. // for more details.
  22239. //
  22240. // This also ensures a stable sort in V8 and other engines.
  22241. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22242. return object.index - other.index;
  22243. }
  22244. /**
  22245. * Creates an array that is the composition of partially applied arguments,
  22246. * placeholders, and provided arguments into a single array of arguments.
  22247. *
  22248. * @private
  22249. * @param {Array} args The provided arguments.
  22250. * @param {Array} partials The arguments to prepend to those provided.
  22251. * @param {Array} holders The `partials` placeholder indexes.
  22252. * @params {boolean} [isCurried] Specify composing for a curried function.
  22253. * @returns {Array} Returns the new array of composed arguments.
  22254. */
  22255. function composeArgs(args, partials, holders, isCurried) {
  22256. var argsIndex = -1,
  22257. argsLength = args.length,
  22258. holdersLength = holders.length,
  22259. leftIndex = -1,
  22260. leftLength = partials.length,
  22261. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22262. result = Array(leftLength + rangeLength),
  22263. isUncurried = !isCurried;
  22264. while (++leftIndex < leftLength) {
  22265. result[leftIndex] = partials[leftIndex];
  22266. }
  22267. while (++argsIndex < holdersLength) {
  22268. if (isUncurried || argsIndex < argsLength) {
  22269. result[holders[argsIndex]] = args[argsIndex];
  22270. }
  22271. }
  22272. while (rangeLength--) {
  22273. result[leftIndex++] = args[argsIndex++];
  22274. }
  22275. return result;
  22276. }
  22277. /**
  22278. * This function is like `composeArgs` except that the arguments composition
  22279. * is tailored for `_.partialRight`.
  22280. *
  22281. * @private
  22282. * @param {Array} args The provided arguments.
  22283. * @param {Array} partials The arguments to append to those provided.
  22284. * @param {Array} holders The `partials` placeholder indexes.
  22285. * @params {boolean} [isCurried] Specify composing for a curried function.
  22286. * @returns {Array} Returns the new array of composed arguments.
  22287. */
  22288. function composeArgsRight(args, partials, holders, isCurried) {
  22289. var argsIndex = -1,
  22290. argsLength = args.length,
  22291. holdersIndex = -1,
  22292. holdersLength = holders.length,
  22293. rightIndex = -1,
  22294. rightLength = partials.length,
  22295. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22296. result = Array(rangeLength + rightLength),
  22297. isUncurried = !isCurried;
  22298. while (++argsIndex < rangeLength) {
  22299. result[argsIndex] = args[argsIndex];
  22300. }
  22301. var offset = argsIndex;
  22302. while (++rightIndex < rightLength) {
  22303. result[offset + rightIndex] = partials[rightIndex];
  22304. }
  22305. while (++holdersIndex < holdersLength) {
  22306. if (isUncurried || argsIndex < argsLength) {
  22307. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22308. }
  22309. }
  22310. return result;
  22311. }
  22312. /**
  22313. * Copies the values of `source` to `array`.
  22314. *
  22315. * @private
  22316. * @param {Array} source The array to copy values from.
  22317. * @param {Array} [array=[]] The array to copy values to.
  22318. * @returns {Array} Returns `array`.
  22319. */
  22320. function copyArray(source, array) {
  22321. var index = -1,
  22322. length = source.length;
  22323. array || (array = Array(length));
  22324. while (++index < length) {
  22325. array[index] = source[index];
  22326. }
  22327. return array;
  22328. }
  22329. /**
  22330. * Copies properties of `source` to `object`.
  22331. *
  22332. * @private
  22333. * @param {Object} source The object to copy properties from.
  22334. * @param {Array} props The property identifiers to copy.
  22335. * @param {Object} [object={}] The object to copy properties to.
  22336. * @param {Function} [customizer] The function to customize copied values.
  22337. * @returns {Object} Returns `object`.
  22338. */
  22339. function copyObject(source, props, object, customizer) {
  22340. var isNew = !object;
  22341. object || (object = {});
  22342. var index = -1,
  22343. length = props.length;
  22344. while (++index < length) {
  22345. var key = props[index];
  22346. var newValue = customizer
  22347. ? customizer(object[key], source[key], key, object, source)
  22348. : undefined;
  22349. if (newValue === undefined) {
  22350. newValue = source[key];
  22351. }
  22352. if (isNew) {
  22353. baseAssignValue(object, key, newValue);
  22354. } else {
  22355. assignValue(object, key, newValue);
  22356. }
  22357. }
  22358. return object;
  22359. }
  22360. /**
  22361. * Copies own symbols of `source` to `object`.
  22362. *
  22363. * @private
  22364. * @param {Object} source The object to copy symbols from.
  22365. * @param {Object} [object={}] The object to copy symbols to.
  22366. * @returns {Object} Returns `object`.
  22367. */
  22368. function copySymbols(source, object) {
  22369. return copyObject(source, getSymbols(source), object);
  22370. }
  22371. /**
  22372. * Copies own and inherited symbols of `source` to `object`.
  22373. *
  22374. * @private
  22375. * @param {Object} source The object to copy symbols from.
  22376. * @param {Object} [object={}] The object to copy symbols to.
  22377. * @returns {Object} Returns `object`.
  22378. */
  22379. function copySymbolsIn(source, object) {
  22380. return copyObject(source, getSymbolsIn(source), object);
  22381. }
  22382. /**
  22383. * Creates a function like `_.groupBy`.
  22384. *
  22385. * @private
  22386. * @param {Function} setter The function to set accumulator values.
  22387. * @param {Function} [initializer] The accumulator object initializer.
  22388. * @returns {Function} Returns the new aggregator function.
  22389. */
  22390. function createAggregator(setter, initializer) {
  22391. return function(collection, iteratee) {
  22392. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22393. accumulator = initializer ? initializer() : {};
  22394. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22395. };
  22396. }
  22397. /**
  22398. * Creates a function like `_.assign`.
  22399. *
  22400. * @private
  22401. * @param {Function} assigner The function to assign values.
  22402. * @returns {Function} Returns the new assigner function.
  22403. */
  22404. function createAssigner(assigner) {
  22405. return baseRest(function(object, sources) {
  22406. var index = -1,
  22407. length = sources.length,
  22408. customizer = length > 1 ? sources[length - 1] : undefined,
  22409. guard = length > 2 ? sources[2] : undefined;
  22410. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22411. ? (length--, customizer)
  22412. : undefined;
  22413. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22414. customizer = length < 3 ? undefined : customizer;
  22415. length = 1;
  22416. }
  22417. object = Object(object);
  22418. while (++index < length) {
  22419. var source = sources[index];
  22420. if (source) {
  22421. assigner(object, source, index, customizer);
  22422. }
  22423. }
  22424. return object;
  22425. });
  22426. }
  22427. /**
  22428. * Creates a `baseEach` or `baseEachRight` function.
  22429. *
  22430. * @private
  22431. * @param {Function} eachFunc The function to iterate over a collection.
  22432. * @param {boolean} [fromRight] Specify iterating from right to left.
  22433. * @returns {Function} Returns the new base function.
  22434. */
  22435. function createBaseEach(eachFunc, fromRight) {
  22436. return function(collection, iteratee) {
  22437. if (collection == null) {
  22438. return collection;
  22439. }
  22440. if (!isArrayLike(collection)) {
  22441. return eachFunc(collection, iteratee);
  22442. }
  22443. var length = collection.length,
  22444. index = fromRight ? length : -1,
  22445. iterable = Object(collection);
  22446. while ((fromRight ? index-- : ++index < length)) {
  22447. if (iteratee(iterable[index], index, iterable) === false) {
  22448. break;
  22449. }
  22450. }
  22451. return collection;
  22452. };
  22453. }
  22454. /**
  22455. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22456. *
  22457. * @private
  22458. * @param {boolean} [fromRight] Specify iterating from right to left.
  22459. * @returns {Function} Returns the new base function.
  22460. */
  22461. function createBaseFor(fromRight) {
  22462. return function(object, iteratee, keysFunc) {
  22463. var index = -1,
  22464. iterable = Object(object),
  22465. props = keysFunc(object),
  22466. length = props.length;
  22467. while (length--) {
  22468. var key = props[fromRight ? length : ++index];
  22469. if (iteratee(iterable[key], key, iterable) === false) {
  22470. break;
  22471. }
  22472. }
  22473. return object;
  22474. };
  22475. }
  22476. /**
  22477. * Creates a function that wraps `func` to invoke it with the optional `this`
  22478. * binding of `thisArg`.
  22479. *
  22480. * @private
  22481. * @param {Function} func The function to wrap.
  22482. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22483. * @param {*} [thisArg] The `this` binding of `func`.
  22484. * @returns {Function} Returns the new wrapped function.
  22485. */
  22486. function createBind(func, bitmask, thisArg) {
  22487. var isBind = bitmask & WRAP_BIND_FLAG,
  22488. Ctor = createCtor(func);
  22489. function wrapper() {
  22490. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22491. return fn.apply(isBind ? thisArg : this, arguments);
  22492. }
  22493. return wrapper;
  22494. }
  22495. /**
  22496. * Creates a function like `_.lowerFirst`.
  22497. *
  22498. * @private
  22499. * @param {string} methodName The name of the `String` case method to use.
  22500. * @returns {Function} Returns the new case function.
  22501. */
  22502. function createCaseFirst(methodName) {
  22503. return function(string) {
  22504. string = toString(string);
  22505. var strSymbols = hasUnicode(string)
  22506. ? stringToArray(string)
  22507. : undefined;
  22508. var chr = strSymbols
  22509. ? strSymbols[0]
  22510. : string.charAt(0);
  22511. var trailing = strSymbols
  22512. ? castSlice(strSymbols, 1).join('')
  22513. : string.slice(1);
  22514. return chr[methodName]() + trailing;
  22515. };
  22516. }
  22517. /**
  22518. * Creates a function like `_.camelCase`.
  22519. *
  22520. * @private
  22521. * @param {Function} callback The function to combine each word.
  22522. * @returns {Function} Returns the new compounder function.
  22523. */
  22524. function createCompounder(callback) {
  22525. return function(string) {
  22526. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22527. };
  22528. }
  22529. /**
  22530. * Creates a function that produces an instance of `Ctor` regardless of
  22531. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22532. *
  22533. * @private
  22534. * @param {Function} Ctor The constructor to wrap.
  22535. * @returns {Function} Returns the new wrapped function.
  22536. */
  22537. function createCtor(Ctor) {
  22538. return function() {
  22539. // Use a `switch` statement to work with class constructors. See
  22540. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22541. // for more details.
  22542. var args = arguments;
  22543. switch (args.length) {
  22544. case 0: return new Ctor;
  22545. case 1: return new Ctor(args[0]);
  22546. case 2: return new Ctor(args[0], args[1]);
  22547. case 3: return new Ctor(args[0], args[1], args[2]);
  22548. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22549. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22550. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22551. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22552. }
  22553. var thisBinding = baseCreate(Ctor.prototype),
  22554. result = Ctor.apply(thisBinding, args);
  22555. // Mimic the constructor's `return` behavior.
  22556. // See https://es5.github.io/#x13.2.2 for more details.
  22557. return isObject(result) ? result : thisBinding;
  22558. };
  22559. }
  22560. /**
  22561. * Creates a function that wraps `func` to enable currying.
  22562. *
  22563. * @private
  22564. * @param {Function} func The function to wrap.
  22565. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22566. * @param {number} arity The arity of `func`.
  22567. * @returns {Function} Returns the new wrapped function.
  22568. */
  22569. function createCurry(func, bitmask, arity) {
  22570. var Ctor = createCtor(func);
  22571. function wrapper() {
  22572. var length = arguments.length,
  22573. args = Array(length),
  22574. index = length,
  22575. placeholder = getHolder(wrapper);
  22576. while (index--) {
  22577. args[index] = arguments[index];
  22578. }
  22579. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22580. ? []
  22581. : replaceHolders(args, placeholder);
  22582. length -= holders.length;
  22583. if (length < arity) {
  22584. return createRecurry(
  22585. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22586. args, holders, undefined, undefined, arity - length);
  22587. }
  22588. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22589. return apply(fn, this, args);
  22590. }
  22591. return wrapper;
  22592. }
  22593. /**
  22594. * Creates a `_.find` or `_.findLast` function.
  22595. *
  22596. * @private
  22597. * @param {Function} findIndexFunc The function to find the collection index.
  22598. * @returns {Function} Returns the new find function.
  22599. */
  22600. function createFind(findIndexFunc) {
  22601. return function(collection, predicate, fromIndex) {
  22602. var iterable = Object(collection);
  22603. if (!isArrayLike(collection)) {
  22604. var iteratee = getIteratee(predicate, 3);
  22605. collection = keys(collection);
  22606. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22607. }
  22608. var index = findIndexFunc(collection, predicate, fromIndex);
  22609. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22610. };
  22611. }
  22612. /**
  22613. * Creates a `_.flow` or `_.flowRight` function.
  22614. *
  22615. * @private
  22616. * @param {boolean} [fromRight] Specify iterating from right to left.
  22617. * @returns {Function} Returns the new flow function.
  22618. */
  22619. function createFlow(fromRight) {
  22620. return flatRest(function(funcs) {
  22621. var length = funcs.length,
  22622. index = length,
  22623. prereq = LodashWrapper.prototype.thru;
  22624. if (fromRight) {
  22625. funcs.reverse();
  22626. }
  22627. while (index--) {
  22628. var func = funcs[index];
  22629. if (typeof func != 'function') {
  22630. throw new TypeError(FUNC_ERROR_TEXT);
  22631. }
  22632. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22633. var wrapper = new LodashWrapper([], true);
  22634. }
  22635. }
  22636. index = wrapper ? index : length;
  22637. while (++index < length) {
  22638. func = funcs[index];
  22639. var funcName = getFuncName(func),
  22640. data = funcName == 'wrapper' ? getData(func) : undefined;
  22641. if (data && isLaziable(data[0]) &&
  22642. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22643. !data[4].length && data[9] == 1
  22644. ) {
  22645. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22646. } else {
  22647. wrapper = (func.length == 1 && isLaziable(func))
  22648. ? wrapper[funcName]()
  22649. : wrapper.thru(func);
  22650. }
  22651. }
  22652. return function() {
  22653. var args = arguments,
  22654. value = args[0];
  22655. if (wrapper && args.length == 1 && isArray(value)) {
  22656. return wrapper.plant(value).value();
  22657. }
  22658. var index = 0,
  22659. result = length ? funcs[index].apply(this, args) : value;
  22660. while (++index < length) {
  22661. result = funcs[index].call(this, result);
  22662. }
  22663. return result;
  22664. };
  22665. });
  22666. }
  22667. /**
  22668. * Creates a function that wraps `func` to invoke it with optional `this`
  22669. * binding of `thisArg`, partial application, and currying.
  22670. *
  22671. * @private
  22672. * @param {Function|string} func The function or method name to wrap.
  22673. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22674. * @param {*} [thisArg] The `this` binding of `func`.
  22675. * @param {Array} [partials] The arguments to prepend to those provided to
  22676. * the new function.
  22677. * @param {Array} [holders] The `partials` placeholder indexes.
  22678. * @param {Array} [partialsRight] The arguments to append to those provided
  22679. * to the new function.
  22680. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22681. * @param {Array} [argPos] The argument positions of the new function.
  22682. * @param {number} [ary] The arity cap of `func`.
  22683. * @param {number} [arity] The arity of `func`.
  22684. * @returns {Function} Returns the new wrapped function.
  22685. */
  22686. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22687. var isAry = bitmask & WRAP_ARY_FLAG,
  22688. isBind = bitmask & WRAP_BIND_FLAG,
  22689. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22690. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22691. isFlip = bitmask & WRAP_FLIP_FLAG,
  22692. Ctor = isBindKey ? undefined : createCtor(func);
  22693. function wrapper() {
  22694. var length = arguments.length,
  22695. args = Array(length),
  22696. index = length;
  22697. while (index--) {
  22698. args[index] = arguments[index];
  22699. }
  22700. if (isCurried) {
  22701. var placeholder = getHolder(wrapper),
  22702. holdersCount = countHolders(args, placeholder);
  22703. }
  22704. if (partials) {
  22705. args = composeArgs(args, partials, holders, isCurried);
  22706. }
  22707. if (partialsRight) {
  22708. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22709. }
  22710. length -= holdersCount;
  22711. if (isCurried && length < arity) {
  22712. var newHolders = replaceHolders(args, placeholder);
  22713. return createRecurry(
  22714. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22715. args, newHolders, argPos, ary, arity - length
  22716. );
  22717. }
  22718. var thisBinding = isBind ? thisArg : this,
  22719. fn = isBindKey ? thisBinding[func] : func;
  22720. length = args.length;
  22721. if (argPos) {
  22722. args = reorder(args, argPos);
  22723. } else if (isFlip && length > 1) {
  22724. args.reverse();
  22725. }
  22726. if (isAry && ary < length) {
  22727. args.length = ary;
  22728. }
  22729. if (this && this !== root && this instanceof wrapper) {
  22730. fn = Ctor || createCtor(fn);
  22731. }
  22732. return fn.apply(thisBinding, args);
  22733. }
  22734. return wrapper;
  22735. }
  22736. /**
  22737. * Creates a function like `_.invertBy`.
  22738. *
  22739. * @private
  22740. * @param {Function} setter The function to set accumulator values.
  22741. * @param {Function} toIteratee The function to resolve iteratees.
  22742. * @returns {Function} Returns the new inverter function.
  22743. */
  22744. function createInverter(setter, toIteratee) {
  22745. return function(object, iteratee) {
  22746. return baseInverter(object, setter, toIteratee(iteratee), {});
  22747. };
  22748. }
  22749. /**
  22750. * Creates a function that performs a mathematical operation on two values.
  22751. *
  22752. * @private
  22753. * @param {Function} operator The function to perform the operation.
  22754. * @param {number} [defaultValue] The value used for `undefined` arguments.
  22755. * @returns {Function} Returns the new mathematical operation function.
  22756. */
  22757. function createMathOperation(operator, defaultValue) {
  22758. return function(value, other) {
  22759. var result;
  22760. if (value === undefined && other === undefined) {
  22761. return defaultValue;
  22762. }
  22763. if (value !== undefined) {
  22764. result = value;
  22765. }
  22766. if (other !== undefined) {
  22767. if (result === undefined) {
  22768. return other;
  22769. }
  22770. if (typeof value == 'string' || typeof other == 'string') {
  22771. value = baseToString(value);
  22772. other = baseToString(other);
  22773. } else {
  22774. value = baseToNumber(value);
  22775. other = baseToNumber(other);
  22776. }
  22777. result = operator(value, other);
  22778. }
  22779. return result;
  22780. };
  22781. }
  22782. /**
  22783. * Creates a function like `_.over`.
  22784. *
  22785. * @private
  22786. * @param {Function} arrayFunc The function to iterate over iteratees.
  22787. * @returns {Function} Returns the new over function.
  22788. */
  22789. function createOver(arrayFunc) {
  22790. return flatRest(function(iteratees) {
  22791. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  22792. return baseRest(function(args) {
  22793. var thisArg = this;
  22794. return arrayFunc(iteratees, function(iteratee) {
  22795. return apply(iteratee, thisArg, args);
  22796. });
  22797. });
  22798. });
  22799. }
  22800. /**
  22801. * Creates the padding for `string` based on `length`. The `chars` string
  22802. * is truncated if the number of characters exceeds `length`.
  22803. *
  22804. * @private
  22805. * @param {number} length The padding length.
  22806. * @param {string} [chars=' '] The string used as padding.
  22807. * @returns {string} Returns the padding for `string`.
  22808. */
  22809. function createPadding(length, chars) {
  22810. chars = chars === undefined ? ' ' : baseToString(chars);
  22811. var charsLength = chars.length;
  22812. if (charsLength < 2) {
  22813. return charsLength ? baseRepeat(chars, length) : chars;
  22814. }
  22815. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  22816. return hasUnicode(chars)
  22817. ? castSlice(stringToArray(result), 0, length).join('')
  22818. : result.slice(0, length);
  22819. }
  22820. /**
  22821. * Creates a function that wraps `func` to invoke it with the `this` binding
  22822. * of `thisArg` and `partials` prepended to the arguments it receives.
  22823. *
  22824. * @private
  22825. * @param {Function} func The function to wrap.
  22826. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22827. * @param {*} thisArg The `this` binding of `func`.
  22828. * @param {Array} partials The arguments to prepend to those provided to
  22829. * the new function.
  22830. * @returns {Function} Returns the new wrapped function.
  22831. */
  22832. function createPartial(func, bitmask, thisArg, partials) {
  22833. var isBind = bitmask & WRAP_BIND_FLAG,
  22834. Ctor = createCtor(func);
  22835. function wrapper() {
  22836. var argsIndex = -1,
  22837. argsLength = arguments.length,
  22838. leftIndex = -1,
  22839. leftLength = partials.length,
  22840. args = Array(leftLength + argsLength),
  22841. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22842. while (++leftIndex < leftLength) {
  22843. args[leftIndex] = partials[leftIndex];
  22844. }
  22845. while (argsLength--) {
  22846. args[leftIndex++] = arguments[++argsIndex];
  22847. }
  22848. return apply(fn, isBind ? thisArg : this, args);
  22849. }
  22850. return wrapper;
  22851. }
  22852. /**
  22853. * Creates a `_.range` or `_.rangeRight` function.
  22854. *
  22855. * @private
  22856. * @param {boolean} [fromRight] Specify iterating from right to left.
  22857. * @returns {Function} Returns the new range function.
  22858. */
  22859. function createRange(fromRight) {
  22860. return function(start, end, step) {
  22861. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  22862. end = step = undefined;
  22863. }
  22864. // Ensure the sign of `-0` is preserved.
  22865. start = toFinite(start);
  22866. if (end === undefined) {
  22867. end = start;
  22868. start = 0;
  22869. } else {
  22870. end = toFinite(end);
  22871. }
  22872. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  22873. return baseRange(start, end, step, fromRight);
  22874. };
  22875. }
  22876. /**
  22877. * Creates a function that performs a relational operation on two values.
  22878. *
  22879. * @private
  22880. * @param {Function} operator The function to perform the operation.
  22881. * @returns {Function} Returns the new relational operation function.
  22882. */
  22883. function createRelationalOperation(operator) {
  22884. return function(value, other) {
  22885. if (!(typeof value == 'string' && typeof other == 'string')) {
  22886. value = toNumber(value);
  22887. other = toNumber(other);
  22888. }
  22889. return operator(value, other);
  22890. };
  22891. }
  22892. /**
  22893. * Creates a function that wraps `func` to continue currying.
  22894. *
  22895. * @private
  22896. * @param {Function} func The function to wrap.
  22897. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22898. * @param {Function} wrapFunc The function to create the `func` wrapper.
  22899. * @param {*} placeholder The placeholder value.
  22900. * @param {*} [thisArg] The `this` binding of `func`.
  22901. * @param {Array} [partials] The arguments to prepend to those provided to
  22902. * the new function.
  22903. * @param {Array} [holders] The `partials` placeholder indexes.
  22904. * @param {Array} [argPos] The argument positions of the new function.
  22905. * @param {number} [ary] The arity cap of `func`.
  22906. * @param {number} [arity] The arity of `func`.
  22907. * @returns {Function} Returns the new wrapped function.
  22908. */
  22909. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  22910. var isCurry = bitmask & WRAP_CURRY_FLAG,
  22911. newHolders = isCurry ? holders : undefined,
  22912. newHoldersRight = isCurry ? undefined : holders,
  22913. newPartials = isCurry ? partials : undefined,
  22914. newPartialsRight = isCurry ? undefined : partials;
  22915. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  22916. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  22917. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  22918. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  22919. }
  22920. var newData = [
  22921. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  22922. newHoldersRight, argPos, ary, arity
  22923. ];
  22924. var result = wrapFunc.apply(undefined, newData);
  22925. if (isLaziable(func)) {
  22926. setData(result, newData);
  22927. }
  22928. result.placeholder = placeholder;
  22929. return setWrapToString(result, func, bitmask);
  22930. }
  22931. /**
  22932. * Creates a function like `_.round`.
  22933. *
  22934. * @private
  22935. * @param {string} methodName The name of the `Math` method to use when rounding.
  22936. * @returns {Function} Returns the new round function.
  22937. */
  22938. function createRound(methodName) {
  22939. var func = Math[methodName];
  22940. return function(number, precision) {
  22941. number = toNumber(number);
  22942. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  22943. if (precision && nativeIsFinite(number)) {
  22944. // Shift with exponential notation to avoid floating-point issues.
  22945. // See [MDN](https://mdn.io/round#Examples) for more details.
  22946. var pair = (toString(number) + 'e').split('e'),
  22947. value = func(pair[0] + 'e' + (+pair[1] + precision));
  22948. pair = (toString(value) + 'e').split('e');
  22949. return +(pair[0] + 'e' + (+pair[1] - precision));
  22950. }
  22951. return func(number);
  22952. };
  22953. }
  22954. /**
  22955. * Creates a set object of `values`.
  22956. *
  22957. * @private
  22958. * @param {Array} values The values to add to the set.
  22959. * @returns {Object} Returns the new set.
  22960. */
  22961. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  22962. return new Set(values);
  22963. };
  22964. /**
  22965. * Creates a `_.toPairs` or `_.toPairsIn` function.
  22966. *
  22967. * @private
  22968. * @param {Function} keysFunc The function to get the keys of a given object.
  22969. * @returns {Function} Returns the new pairs function.
  22970. */
  22971. function createToPairs(keysFunc) {
  22972. return function(object) {
  22973. var tag = getTag(object);
  22974. if (tag == mapTag) {
  22975. return mapToArray(object);
  22976. }
  22977. if (tag == setTag) {
  22978. return setToPairs(object);
  22979. }
  22980. return baseToPairs(object, keysFunc(object));
  22981. };
  22982. }
  22983. /**
  22984. * Creates a function that either curries or invokes `func` with optional
  22985. * `this` binding and partially applied arguments.
  22986. *
  22987. * @private
  22988. * @param {Function|string} func The function or method name to wrap.
  22989. * @param {number} bitmask The bitmask flags.
  22990. * 1 - `_.bind`
  22991. * 2 - `_.bindKey`
  22992. * 4 - `_.curry` or `_.curryRight` of a bound function
  22993. * 8 - `_.curry`
  22994. * 16 - `_.curryRight`
  22995. * 32 - `_.partial`
  22996. * 64 - `_.partialRight`
  22997. * 128 - `_.rearg`
  22998. * 256 - `_.ary`
  22999. * 512 - `_.flip`
  23000. * @param {*} [thisArg] The `this` binding of `func`.
  23001. * @param {Array} [partials] The arguments to be partially applied.
  23002. * @param {Array} [holders] The `partials` placeholder indexes.
  23003. * @param {Array} [argPos] The argument positions of the new function.
  23004. * @param {number} [ary] The arity cap of `func`.
  23005. * @param {number} [arity] The arity of `func`.
  23006. * @returns {Function} Returns the new wrapped function.
  23007. */
  23008. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23009. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23010. if (!isBindKey && typeof func != 'function') {
  23011. throw new TypeError(FUNC_ERROR_TEXT);
  23012. }
  23013. var length = partials ? partials.length : 0;
  23014. if (!length) {
  23015. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23016. partials = holders = undefined;
  23017. }
  23018. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23019. arity = arity === undefined ? arity : toInteger(arity);
  23020. length -= holders ? holders.length : 0;
  23021. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23022. var partialsRight = partials,
  23023. holdersRight = holders;
  23024. partials = holders = undefined;
  23025. }
  23026. var data = isBindKey ? undefined : getData(func);
  23027. var newData = [
  23028. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23029. argPos, ary, arity
  23030. ];
  23031. if (data) {
  23032. mergeData(newData, data);
  23033. }
  23034. func = newData[0];
  23035. bitmask = newData[1];
  23036. thisArg = newData[2];
  23037. partials = newData[3];
  23038. holders = newData[4];
  23039. arity = newData[9] = newData[9] === undefined
  23040. ? (isBindKey ? 0 : func.length)
  23041. : nativeMax(newData[9] - length, 0);
  23042. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23043. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23044. }
  23045. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23046. var result = createBind(func, bitmask, thisArg);
  23047. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23048. result = createCurry(func, bitmask, arity);
  23049. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23050. result = createPartial(func, bitmask, thisArg, partials);
  23051. } else {
  23052. result = createHybrid.apply(undefined, newData);
  23053. }
  23054. var setter = data ? baseSetData : setData;
  23055. return setWrapToString(setter(result, newData), func, bitmask);
  23056. }
  23057. /**
  23058. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23059. * of source objects to the destination object for all destination properties
  23060. * that resolve to `undefined`.
  23061. *
  23062. * @private
  23063. * @param {*} objValue The destination value.
  23064. * @param {*} srcValue The source value.
  23065. * @param {string} key The key of the property to assign.
  23066. * @param {Object} object The parent object of `objValue`.
  23067. * @returns {*} Returns the value to assign.
  23068. */
  23069. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23070. if (objValue === undefined ||
  23071. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23072. return srcValue;
  23073. }
  23074. return objValue;
  23075. }
  23076. /**
  23077. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23078. * objects into destination objects that are passed thru.
  23079. *
  23080. * @private
  23081. * @param {*} objValue The destination value.
  23082. * @param {*} srcValue The source value.
  23083. * @param {string} key The key of the property to merge.
  23084. * @param {Object} object The parent object of `objValue`.
  23085. * @param {Object} source The parent object of `srcValue`.
  23086. * @param {Object} [stack] Tracks traversed source values and their merged
  23087. * counterparts.
  23088. * @returns {*} Returns the value to assign.
  23089. */
  23090. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23091. if (isObject(objValue) && isObject(srcValue)) {
  23092. // Recursively merge objects and arrays (susceptible to call stack limits).
  23093. stack.set(srcValue, objValue);
  23094. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23095. stack['delete'](srcValue);
  23096. }
  23097. return objValue;
  23098. }
  23099. /**
  23100. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23101. * objects.
  23102. *
  23103. * @private
  23104. * @param {*} value The value to inspect.
  23105. * @param {string} key The key of the property to inspect.
  23106. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23107. */
  23108. function customOmitClone(value) {
  23109. return isPlainObject(value) ? undefined : value;
  23110. }
  23111. /**
  23112. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23113. * partial deep comparisons.
  23114. *
  23115. * @private
  23116. * @param {Array} array The array to compare.
  23117. * @param {Array} other The other array to compare.
  23118. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23119. * @param {Function} customizer The function to customize comparisons.
  23120. * @param {Function} equalFunc The function to determine equivalents of values.
  23121. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23122. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23123. */
  23124. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23125. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23126. arrLength = array.length,
  23127. othLength = other.length;
  23128. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23129. return false;
  23130. }
  23131. // Assume cyclic values are equal.
  23132. var stacked = stack.get(array);
  23133. if (stacked && stack.get(other)) {
  23134. return stacked == other;
  23135. }
  23136. var index = -1,
  23137. result = true,
  23138. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23139. stack.set(array, other);
  23140. stack.set(other, array);
  23141. // Ignore non-index properties.
  23142. while (++index < arrLength) {
  23143. var arrValue = array[index],
  23144. othValue = other[index];
  23145. if (customizer) {
  23146. var compared = isPartial
  23147. ? customizer(othValue, arrValue, index, other, array, stack)
  23148. : customizer(arrValue, othValue, index, array, other, stack);
  23149. }
  23150. if (compared !== undefined) {
  23151. if (compared) {
  23152. continue;
  23153. }
  23154. result = false;
  23155. break;
  23156. }
  23157. // Recursively compare arrays (susceptible to call stack limits).
  23158. if (seen) {
  23159. if (!arraySome(other, function(othValue, othIndex) {
  23160. if (!cacheHas(seen, othIndex) &&
  23161. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23162. return seen.push(othIndex);
  23163. }
  23164. })) {
  23165. result = false;
  23166. break;
  23167. }
  23168. } else if (!(
  23169. arrValue === othValue ||
  23170. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23171. )) {
  23172. result = false;
  23173. break;
  23174. }
  23175. }
  23176. stack['delete'](array);
  23177. stack['delete'](other);
  23178. return result;
  23179. }
  23180. /**
  23181. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23182. * the same `toStringTag`.
  23183. *
  23184. * **Note:** This function only supports comparing values with tags of
  23185. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23186. *
  23187. * @private
  23188. * @param {Object} object The object to compare.
  23189. * @param {Object} other The other object to compare.
  23190. * @param {string} tag The `toStringTag` of the objects to compare.
  23191. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23192. * @param {Function} customizer The function to customize comparisons.
  23193. * @param {Function} equalFunc The function to determine equivalents of values.
  23194. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23195. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23196. */
  23197. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23198. switch (tag) {
  23199. case dataViewTag:
  23200. if ((object.byteLength != other.byteLength) ||
  23201. (object.byteOffset != other.byteOffset)) {
  23202. return false;
  23203. }
  23204. object = object.buffer;
  23205. other = other.buffer;
  23206. case arrayBufferTag:
  23207. if ((object.byteLength != other.byteLength) ||
  23208. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23209. return false;
  23210. }
  23211. return true;
  23212. case boolTag:
  23213. case dateTag:
  23214. case numberTag:
  23215. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23216. // Invalid dates are coerced to `NaN`.
  23217. return eq(+object, +other);
  23218. case errorTag:
  23219. return object.name == other.name && object.message == other.message;
  23220. case regexpTag:
  23221. case stringTag:
  23222. // Coerce regexes to strings and treat strings, primitives and objects,
  23223. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23224. // for more details.
  23225. return object == (other + '');
  23226. case mapTag:
  23227. var convert = mapToArray;
  23228. case setTag:
  23229. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23230. convert || (convert = setToArray);
  23231. if (object.size != other.size && !isPartial) {
  23232. return false;
  23233. }
  23234. // Assume cyclic values are equal.
  23235. var stacked = stack.get(object);
  23236. if (stacked) {
  23237. return stacked == other;
  23238. }
  23239. bitmask |= COMPARE_UNORDERED_FLAG;
  23240. // Recursively compare objects (susceptible to call stack limits).
  23241. stack.set(object, other);
  23242. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23243. stack['delete'](object);
  23244. return result;
  23245. case symbolTag:
  23246. if (symbolValueOf) {
  23247. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23248. }
  23249. }
  23250. return false;
  23251. }
  23252. /**
  23253. * A specialized version of `baseIsEqualDeep` for objects with support for
  23254. * partial deep comparisons.
  23255. *
  23256. * @private
  23257. * @param {Object} object The object to compare.
  23258. * @param {Object} other The other object to compare.
  23259. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23260. * @param {Function} customizer The function to customize comparisons.
  23261. * @param {Function} equalFunc The function to determine equivalents of values.
  23262. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23263. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23264. */
  23265. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23266. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23267. objProps = getAllKeys(object),
  23268. objLength = objProps.length,
  23269. othProps = getAllKeys(other),
  23270. othLength = othProps.length;
  23271. if (objLength != othLength && !isPartial) {
  23272. return false;
  23273. }
  23274. var index = objLength;
  23275. while (index--) {
  23276. var key = objProps[index];
  23277. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23278. return false;
  23279. }
  23280. }
  23281. // Assume cyclic values are equal.
  23282. var stacked = stack.get(object);
  23283. if (stacked && stack.get(other)) {
  23284. return stacked == other;
  23285. }
  23286. var result = true;
  23287. stack.set(object, other);
  23288. stack.set(other, object);
  23289. var skipCtor = isPartial;
  23290. while (++index < objLength) {
  23291. key = objProps[index];
  23292. var objValue = object[key],
  23293. othValue = other[key];
  23294. if (customizer) {
  23295. var compared = isPartial
  23296. ? customizer(othValue, objValue, key, other, object, stack)
  23297. : customizer(objValue, othValue, key, object, other, stack);
  23298. }
  23299. // Recursively compare objects (susceptible to call stack limits).
  23300. if (!(compared === undefined
  23301. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23302. : compared
  23303. )) {
  23304. result = false;
  23305. break;
  23306. }
  23307. skipCtor || (skipCtor = key == 'constructor');
  23308. }
  23309. if (result && !skipCtor) {
  23310. var objCtor = object.constructor,
  23311. othCtor = other.constructor;
  23312. // Non `Object` object instances with different constructors are not equal.
  23313. if (objCtor != othCtor &&
  23314. ('constructor' in object && 'constructor' in other) &&
  23315. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23316. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23317. result = false;
  23318. }
  23319. }
  23320. stack['delete'](object);
  23321. stack['delete'](other);
  23322. return result;
  23323. }
  23324. /**
  23325. * A specialized version of `baseRest` which flattens the rest array.
  23326. *
  23327. * @private
  23328. * @param {Function} func The function to apply a rest parameter to.
  23329. * @returns {Function} Returns the new function.
  23330. */
  23331. function flatRest(func) {
  23332. return setToString(overRest(func, undefined, flatten), func + '');
  23333. }
  23334. /**
  23335. * Creates an array of own enumerable property names and symbols of `object`.
  23336. *
  23337. * @private
  23338. * @param {Object} object The object to query.
  23339. * @returns {Array} Returns the array of property names and symbols.
  23340. */
  23341. function getAllKeys(object) {
  23342. return baseGetAllKeys(object, keys, getSymbols);
  23343. }
  23344. /**
  23345. * Creates an array of own and inherited enumerable property names and
  23346. * symbols of `object`.
  23347. *
  23348. * @private
  23349. * @param {Object} object The object to query.
  23350. * @returns {Array} Returns the array of property names and symbols.
  23351. */
  23352. function getAllKeysIn(object) {
  23353. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23354. }
  23355. /**
  23356. * Gets metadata for `func`.
  23357. *
  23358. * @private
  23359. * @param {Function} func The function to query.
  23360. * @returns {*} Returns the metadata for `func`.
  23361. */
  23362. var getData = !metaMap ? noop : function(func) {
  23363. return metaMap.get(func);
  23364. };
  23365. /**
  23366. * Gets the name of `func`.
  23367. *
  23368. * @private
  23369. * @param {Function} func The function to query.
  23370. * @returns {string} Returns the function name.
  23371. */
  23372. function getFuncName(func) {
  23373. var result = (func.name + ''),
  23374. array = realNames[result],
  23375. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23376. while (length--) {
  23377. var data = array[length],
  23378. otherFunc = data.func;
  23379. if (otherFunc == null || otherFunc == func) {
  23380. return data.name;
  23381. }
  23382. }
  23383. return result;
  23384. }
  23385. /**
  23386. * Gets the argument placeholder value for `func`.
  23387. *
  23388. * @private
  23389. * @param {Function} func The function to inspect.
  23390. * @returns {*} Returns the placeholder value.
  23391. */
  23392. function getHolder(func) {
  23393. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23394. return object.placeholder;
  23395. }
  23396. /**
  23397. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23398. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23399. * If arguments are provided, the chosen function is invoked with them and
  23400. * its result is returned.
  23401. *
  23402. * @private
  23403. * @param {*} [value] The value to convert to an iteratee.
  23404. * @param {number} [arity] The arity of the created iteratee.
  23405. * @returns {Function} Returns the chosen function or its result.
  23406. */
  23407. function getIteratee() {
  23408. var result = lodash.iteratee || iteratee;
  23409. result = result === iteratee ? baseIteratee : result;
  23410. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23411. }
  23412. /**
  23413. * Gets the data for `map`.
  23414. *
  23415. * @private
  23416. * @param {Object} map The map to query.
  23417. * @param {string} key The reference key.
  23418. * @returns {*} Returns the map data.
  23419. */
  23420. function getMapData(map, key) {
  23421. var data = map.__data__;
  23422. return isKeyable(key)
  23423. ? data[typeof key == 'string' ? 'string' : 'hash']
  23424. : data.map;
  23425. }
  23426. /**
  23427. * Gets the property names, values, and compare flags of `object`.
  23428. *
  23429. * @private
  23430. * @param {Object} object The object to query.
  23431. * @returns {Array} Returns the match data of `object`.
  23432. */
  23433. function getMatchData(object) {
  23434. var result = keys(object),
  23435. length = result.length;
  23436. while (length--) {
  23437. var key = result[length],
  23438. value = object[key];
  23439. result[length] = [key, value, isStrictComparable(value)];
  23440. }
  23441. return result;
  23442. }
  23443. /**
  23444. * Gets the native function at `key` of `object`.
  23445. *
  23446. * @private
  23447. * @param {Object} object The object to query.
  23448. * @param {string} key The key of the method to get.
  23449. * @returns {*} Returns the function if it's native, else `undefined`.
  23450. */
  23451. function getNative(object, key) {
  23452. var value = getValue(object, key);
  23453. return baseIsNative(value) ? value : undefined;
  23454. }
  23455. /**
  23456. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23457. *
  23458. * @private
  23459. * @param {*} value The value to query.
  23460. * @returns {string} Returns the raw `toStringTag`.
  23461. */
  23462. function getRawTag(value) {
  23463. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23464. tag = value[symToStringTag];
  23465. try {
  23466. value[symToStringTag] = undefined;
  23467. var unmasked = true;
  23468. } catch (e) {}
  23469. var result = nativeObjectToString.call(value);
  23470. if (unmasked) {
  23471. if (isOwn) {
  23472. value[symToStringTag] = tag;
  23473. } else {
  23474. delete value[symToStringTag];
  23475. }
  23476. }
  23477. return result;
  23478. }
  23479. /**
  23480. * Creates an array of the own enumerable symbols of `object`.
  23481. *
  23482. * @private
  23483. * @param {Object} object The object to query.
  23484. * @returns {Array} Returns the array of symbols.
  23485. */
  23486. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23487. if (object == null) {
  23488. return [];
  23489. }
  23490. object = Object(object);
  23491. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23492. return propertyIsEnumerable.call(object, symbol);
  23493. });
  23494. };
  23495. /**
  23496. * Creates an array of the own and inherited enumerable symbols of `object`.
  23497. *
  23498. * @private
  23499. * @param {Object} object The object to query.
  23500. * @returns {Array} Returns the array of symbols.
  23501. */
  23502. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23503. var result = [];
  23504. while (object) {
  23505. arrayPush(result, getSymbols(object));
  23506. object = getPrototype(object);
  23507. }
  23508. return result;
  23509. };
  23510. /**
  23511. * Gets the `toStringTag` of `value`.
  23512. *
  23513. * @private
  23514. * @param {*} value The value to query.
  23515. * @returns {string} Returns the `toStringTag`.
  23516. */
  23517. var getTag = baseGetTag;
  23518. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23519. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23520. (Map && getTag(new Map) != mapTag) ||
  23521. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23522. (Set && getTag(new Set) != setTag) ||
  23523. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23524. getTag = function(value) {
  23525. var result = baseGetTag(value),
  23526. Ctor = result == objectTag ? value.constructor : undefined,
  23527. ctorString = Ctor ? toSource(Ctor) : '';
  23528. if (ctorString) {
  23529. switch (ctorString) {
  23530. case dataViewCtorString: return dataViewTag;
  23531. case mapCtorString: return mapTag;
  23532. case promiseCtorString: return promiseTag;
  23533. case setCtorString: return setTag;
  23534. case weakMapCtorString: return weakMapTag;
  23535. }
  23536. }
  23537. return result;
  23538. };
  23539. }
  23540. /**
  23541. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23542. *
  23543. * @private
  23544. * @param {number} start The start of the view.
  23545. * @param {number} end The end of the view.
  23546. * @param {Array} transforms The transformations to apply to the view.
  23547. * @returns {Object} Returns an object containing the `start` and `end`
  23548. * positions of the view.
  23549. */
  23550. function getView(start, end, transforms) {
  23551. var index = -1,
  23552. length = transforms.length;
  23553. while (++index < length) {
  23554. var data = transforms[index],
  23555. size = data.size;
  23556. switch (data.type) {
  23557. case 'drop': start += size; break;
  23558. case 'dropRight': end -= size; break;
  23559. case 'take': end = nativeMin(end, start + size); break;
  23560. case 'takeRight': start = nativeMax(start, end - size); break;
  23561. }
  23562. }
  23563. return { 'start': start, 'end': end };
  23564. }
  23565. /**
  23566. * Extracts wrapper details from the `source` body comment.
  23567. *
  23568. * @private
  23569. * @param {string} source The source to inspect.
  23570. * @returns {Array} Returns the wrapper details.
  23571. */
  23572. function getWrapDetails(source) {
  23573. var match = source.match(reWrapDetails);
  23574. return match ? match[1].split(reSplitDetails) : [];
  23575. }
  23576. /**
  23577. * Checks if `path` exists on `object`.
  23578. *
  23579. * @private
  23580. * @param {Object} object The object to query.
  23581. * @param {Array|string} path The path to check.
  23582. * @param {Function} hasFunc The function to check properties.
  23583. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23584. */
  23585. function hasPath(object, path, hasFunc) {
  23586. path = castPath(path, object);
  23587. var index = -1,
  23588. length = path.length,
  23589. result = false;
  23590. while (++index < length) {
  23591. var key = toKey(path[index]);
  23592. if (!(result = object != null && hasFunc(object, key))) {
  23593. break;
  23594. }
  23595. object = object[key];
  23596. }
  23597. if (result || ++index != length) {
  23598. return result;
  23599. }
  23600. length = object == null ? 0 : object.length;
  23601. return !!length && isLength(length) && isIndex(key, length) &&
  23602. (isArray(object) || isArguments(object));
  23603. }
  23604. /**
  23605. * Initializes an array clone.
  23606. *
  23607. * @private
  23608. * @param {Array} array The array to clone.
  23609. * @returns {Array} Returns the initialized clone.
  23610. */
  23611. function initCloneArray(array) {
  23612. var length = array.length,
  23613. result = new array.constructor(length);
  23614. // Add properties assigned by `RegExp#exec`.
  23615. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23616. result.index = array.index;
  23617. result.input = array.input;
  23618. }
  23619. return result;
  23620. }
  23621. /**
  23622. * Initializes an object clone.
  23623. *
  23624. * @private
  23625. * @param {Object} object The object to clone.
  23626. * @returns {Object} Returns the initialized clone.
  23627. */
  23628. function initCloneObject(object) {
  23629. return (typeof object.constructor == 'function' && !isPrototype(object))
  23630. ? baseCreate(getPrototype(object))
  23631. : {};
  23632. }
  23633. /**
  23634. * Initializes an object clone based on its `toStringTag`.
  23635. *
  23636. * **Note:** This function only supports cloning values with tags of
  23637. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23638. *
  23639. * @private
  23640. * @param {Object} object The object to clone.
  23641. * @param {string} tag The `toStringTag` of the object to clone.
  23642. * @param {boolean} [isDeep] Specify a deep clone.
  23643. * @returns {Object} Returns the initialized clone.
  23644. */
  23645. function initCloneByTag(object, tag, isDeep) {
  23646. var Ctor = object.constructor;
  23647. switch (tag) {
  23648. case arrayBufferTag:
  23649. return cloneArrayBuffer(object);
  23650. case boolTag:
  23651. case dateTag:
  23652. return new Ctor(+object);
  23653. case dataViewTag:
  23654. return cloneDataView(object, isDeep);
  23655. case float32Tag: case float64Tag:
  23656. case int8Tag: case int16Tag: case int32Tag:
  23657. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23658. return cloneTypedArray(object, isDeep);
  23659. case mapTag:
  23660. return new Ctor;
  23661. case numberTag:
  23662. case stringTag:
  23663. return new Ctor(object);
  23664. case regexpTag:
  23665. return cloneRegExp(object);
  23666. case setTag:
  23667. return new Ctor;
  23668. case symbolTag:
  23669. return cloneSymbol(object);
  23670. }
  23671. }
  23672. /**
  23673. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23674. *
  23675. * @private
  23676. * @param {string} source The source to modify.
  23677. * @returns {Array} details The details to insert.
  23678. * @returns {string} Returns the modified source.
  23679. */
  23680. function insertWrapDetails(source, details) {
  23681. var length = details.length;
  23682. if (!length) {
  23683. return source;
  23684. }
  23685. var lastIndex = length - 1;
  23686. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23687. details = details.join(length > 2 ? ', ' : ' ');
  23688. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23689. }
  23690. /**
  23691. * Checks if `value` is a flattenable `arguments` object or array.
  23692. *
  23693. * @private
  23694. * @param {*} value The value to check.
  23695. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23696. */
  23697. function isFlattenable(value) {
  23698. return isArray(value) || isArguments(value) ||
  23699. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23700. }
  23701. /**
  23702. * Checks if `value` is a valid array-like index.
  23703. *
  23704. * @private
  23705. * @param {*} value The value to check.
  23706. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23707. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23708. */
  23709. function isIndex(value, length) {
  23710. var type = typeof value;
  23711. length = length == null ? MAX_SAFE_INTEGER : length;
  23712. return !!length &&
  23713. (type == 'number' ||
  23714. (type != 'symbol' && reIsUint.test(value))) &&
  23715. (value > -1 && value % 1 == 0 && value < length);
  23716. }
  23717. /**
  23718. * Checks if the given arguments are from an iteratee call.
  23719. *
  23720. * @private
  23721. * @param {*} value The potential iteratee value argument.
  23722. * @param {*} index The potential iteratee index or key argument.
  23723. * @param {*} object The potential iteratee object argument.
  23724. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23725. * else `false`.
  23726. */
  23727. function isIterateeCall(value, index, object) {
  23728. if (!isObject(object)) {
  23729. return false;
  23730. }
  23731. var type = typeof index;
  23732. if (type == 'number'
  23733. ? (isArrayLike(object) && isIndex(index, object.length))
  23734. : (type == 'string' && index in object)
  23735. ) {
  23736. return eq(object[index], value);
  23737. }
  23738. return false;
  23739. }
  23740. /**
  23741. * Checks if `value` is a property name and not a property path.
  23742. *
  23743. * @private
  23744. * @param {*} value The value to check.
  23745. * @param {Object} [object] The object to query keys on.
  23746. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  23747. */
  23748. function isKey(value, object) {
  23749. if (isArray(value)) {
  23750. return false;
  23751. }
  23752. var type = typeof value;
  23753. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  23754. value == null || isSymbol(value)) {
  23755. return true;
  23756. }
  23757. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  23758. (object != null && value in Object(object));
  23759. }
  23760. /**
  23761. * Checks if `value` is suitable for use as unique object key.
  23762. *
  23763. * @private
  23764. * @param {*} value The value to check.
  23765. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  23766. */
  23767. function isKeyable(value) {
  23768. var type = typeof value;
  23769. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  23770. ? (value !== '__proto__')
  23771. : (value === null);
  23772. }
  23773. /**
  23774. * Checks if `func` has a lazy counterpart.
  23775. *
  23776. * @private
  23777. * @param {Function} func The function to check.
  23778. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  23779. * else `false`.
  23780. */
  23781. function isLaziable(func) {
  23782. var funcName = getFuncName(func),
  23783. other = lodash[funcName];
  23784. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  23785. return false;
  23786. }
  23787. if (func === other) {
  23788. return true;
  23789. }
  23790. var data = getData(other);
  23791. return !!data && func === data[0];
  23792. }
  23793. /**
  23794. * Checks if `func` has its source masked.
  23795. *
  23796. * @private
  23797. * @param {Function} func The function to check.
  23798. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  23799. */
  23800. function isMasked(func) {
  23801. return !!maskSrcKey && (maskSrcKey in func);
  23802. }
  23803. /**
  23804. * Checks if `func` is capable of being masked.
  23805. *
  23806. * @private
  23807. * @param {*} value The value to check.
  23808. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  23809. */
  23810. var isMaskable = coreJsData ? isFunction : stubFalse;
  23811. /**
  23812. * Checks if `value` is likely a prototype object.
  23813. *
  23814. * @private
  23815. * @param {*} value The value to check.
  23816. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  23817. */
  23818. function isPrototype(value) {
  23819. var Ctor = value && value.constructor,
  23820. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  23821. return value === proto;
  23822. }
  23823. /**
  23824. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  23825. *
  23826. * @private
  23827. * @param {*} value The value to check.
  23828. * @returns {boolean} Returns `true` if `value` if suitable for strict
  23829. * equality comparisons, else `false`.
  23830. */
  23831. function isStrictComparable(value) {
  23832. return value === value && !isObject(value);
  23833. }
  23834. /**
  23835. * A specialized version of `matchesProperty` for source values suitable
  23836. * for strict equality comparisons, i.e. `===`.
  23837. *
  23838. * @private
  23839. * @param {string} key The key of the property to get.
  23840. * @param {*} srcValue The value to match.
  23841. * @returns {Function} Returns the new spec function.
  23842. */
  23843. function matchesStrictComparable(key, srcValue) {
  23844. return function(object) {
  23845. if (object == null) {
  23846. return false;
  23847. }
  23848. return object[key] === srcValue &&
  23849. (srcValue !== undefined || (key in Object(object)));
  23850. };
  23851. }
  23852. /**
  23853. * A specialized version of `_.memoize` which clears the memoized function's
  23854. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  23855. *
  23856. * @private
  23857. * @param {Function} func The function to have its output memoized.
  23858. * @returns {Function} Returns the new memoized function.
  23859. */
  23860. function memoizeCapped(func) {
  23861. var result = memoize(func, function(key) {
  23862. if (cache.size === MAX_MEMOIZE_SIZE) {
  23863. cache.clear();
  23864. }
  23865. return key;
  23866. });
  23867. var cache = result.cache;
  23868. return result;
  23869. }
  23870. /**
  23871. * Merges the function metadata of `source` into `data`.
  23872. *
  23873. * Merging metadata reduces the number of wrappers used to invoke a function.
  23874. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  23875. * may be applied regardless of execution order. Methods like `_.ary` and
  23876. * `_.rearg` modify function arguments, making the order in which they are
  23877. * executed important, preventing the merging of metadata. However, we make
  23878. * an exception for a safe combined case where curried functions have `_.ary`
  23879. * and or `_.rearg` applied.
  23880. *
  23881. * @private
  23882. * @param {Array} data The destination metadata.
  23883. * @param {Array} source The source metadata.
  23884. * @returns {Array} Returns `data`.
  23885. */
  23886. function mergeData(data, source) {
  23887. var bitmask = data[1],
  23888. srcBitmask = source[1],
  23889. newBitmask = bitmask | srcBitmask,
  23890. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  23891. var isCombo =
  23892. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  23893. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  23894. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  23895. // Exit early if metadata can't be merged.
  23896. if (!(isCommon || isCombo)) {
  23897. return data;
  23898. }
  23899. // Use source `thisArg` if available.
  23900. if (srcBitmask & WRAP_BIND_FLAG) {
  23901. data[2] = source[2];
  23902. // Set when currying a bound function.
  23903. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  23904. }
  23905. // Compose partial arguments.
  23906. var value = source[3];
  23907. if (value) {
  23908. var partials = data[3];
  23909. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  23910. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  23911. }
  23912. // Compose partial right arguments.
  23913. value = source[5];
  23914. if (value) {
  23915. partials = data[5];
  23916. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  23917. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  23918. }
  23919. // Use source `argPos` if available.
  23920. value = source[7];
  23921. if (value) {
  23922. data[7] = value;
  23923. }
  23924. // Use source `ary` if it's smaller.
  23925. if (srcBitmask & WRAP_ARY_FLAG) {
  23926. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  23927. }
  23928. // Use source `arity` if one is not provided.
  23929. if (data[9] == null) {
  23930. data[9] = source[9];
  23931. }
  23932. // Use source `func` and merge bitmasks.
  23933. data[0] = source[0];
  23934. data[1] = newBitmask;
  23935. return data;
  23936. }
  23937. /**
  23938. * This function is like
  23939. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  23940. * except that it includes inherited enumerable properties.
  23941. *
  23942. * @private
  23943. * @param {Object} object The object to query.
  23944. * @returns {Array} Returns the array of property names.
  23945. */
  23946. function nativeKeysIn(object) {
  23947. var result = [];
  23948. if (object != null) {
  23949. for (var key in Object(object)) {
  23950. result.push(key);
  23951. }
  23952. }
  23953. return result;
  23954. }
  23955. /**
  23956. * Converts `value` to a string using `Object.prototype.toString`.
  23957. *
  23958. * @private
  23959. * @param {*} value The value to convert.
  23960. * @returns {string} Returns the converted string.
  23961. */
  23962. function objectToString(value) {
  23963. return nativeObjectToString.call(value);
  23964. }
  23965. /**
  23966. * A specialized version of `baseRest` which transforms the rest array.
  23967. *
  23968. * @private
  23969. * @param {Function} func The function to apply a rest parameter to.
  23970. * @param {number} [start=func.length-1] The start position of the rest parameter.
  23971. * @param {Function} transform The rest array transform.
  23972. * @returns {Function} Returns the new function.
  23973. */
  23974. function overRest(func, start, transform) {
  23975. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  23976. return function() {
  23977. var args = arguments,
  23978. index = -1,
  23979. length = nativeMax(args.length - start, 0),
  23980. array = Array(length);
  23981. while (++index < length) {
  23982. array[index] = args[start + index];
  23983. }
  23984. index = -1;
  23985. var otherArgs = Array(start + 1);
  23986. while (++index < start) {
  23987. otherArgs[index] = args[index];
  23988. }
  23989. otherArgs[start] = transform(array);
  23990. return apply(func, this, otherArgs);
  23991. };
  23992. }
  23993. /**
  23994. * Gets the parent value at `path` of `object`.
  23995. *
  23996. * @private
  23997. * @param {Object} object The object to query.
  23998. * @param {Array} path The path to get the parent value of.
  23999. * @returns {*} Returns the parent value.
  24000. */
  24001. function parent(object, path) {
  24002. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24003. }
  24004. /**
  24005. * Reorder `array` according to the specified indexes where the element at
  24006. * the first index is assigned as the first element, the element at
  24007. * the second index is assigned as the second element, and so on.
  24008. *
  24009. * @private
  24010. * @param {Array} array The array to reorder.
  24011. * @param {Array} indexes The arranged array indexes.
  24012. * @returns {Array} Returns `array`.
  24013. */
  24014. function reorder(array, indexes) {
  24015. var arrLength = array.length,
  24016. length = nativeMin(indexes.length, arrLength),
  24017. oldArray = copyArray(array);
  24018. while (length--) {
  24019. var index = indexes[length];
  24020. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24021. }
  24022. return array;
  24023. }
  24024. /**
  24025. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24026. *
  24027. * @private
  24028. * @param {Object} object The object to query.
  24029. * @param {string} key The key of the property to get.
  24030. * @returns {*} Returns the property value.
  24031. */
  24032. function safeGet(object, key) {
  24033. if (key === 'constructor' && typeof object[key] === 'function') {
  24034. return;
  24035. }
  24036. if (key == '__proto__') {
  24037. return;
  24038. }
  24039. return object[key];
  24040. }
  24041. /**
  24042. * Sets metadata for `func`.
  24043. *
  24044. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24045. * period of time, it will trip its breaker and transition to an identity
  24046. * function to avoid garbage collection pauses in V8. See
  24047. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24048. * for more details.
  24049. *
  24050. * @private
  24051. * @param {Function} func The function to associate metadata with.
  24052. * @param {*} data The metadata.
  24053. * @returns {Function} Returns `func`.
  24054. */
  24055. var setData = shortOut(baseSetData);
  24056. /**
  24057. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24058. *
  24059. * @private
  24060. * @param {Function} func The function to delay.
  24061. * @param {number} wait The number of milliseconds to delay invocation.
  24062. * @returns {number|Object} Returns the timer id or timeout object.
  24063. */
  24064. var setTimeout = ctxSetTimeout || function(func, wait) {
  24065. return root.setTimeout(func, wait);
  24066. };
  24067. /**
  24068. * Sets the `toString` method of `func` to return `string`.
  24069. *
  24070. * @private
  24071. * @param {Function} func The function to modify.
  24072. * @param {Function} string The `toString` result.
  24073. * @returns {Function} Returns `func`.
  24074. */
  24075. var setToString = shortOut(baseSetToString);
  24076. /**
  24077. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24078. * with wrapper details in a comment at the top of the source body.
  24079. *
  24080. * @private
  24081. * @param {Function} wrapper The function to modify.
  24082. * @param {Function} reference The reference function.
  24083. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24084. * @returns {Function} Returns `wrapper`.
  24085. */
  24086. function setWrapToString(wrapper, reference, bitmask) {
  24087. var source = (reference + '');
  24088. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24089. }
  24090. /**
  24091. * Creates a function that'll short out and invoke `identity` instead
  24092. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24093. * milliseconds.
  24094. *
  24095. * @private
  24096. * @param {Function} func The function to restrict.
  24097. * @returns {Function} Returns the new shortable function.
  24098. */
  24099. function shortOut(func) {
  24100. var count = 0,
  24101. lastCalled = 0;
  24102. return function() {
  24103. var stamp = nativeNow(),
  24104. remaining = HOT_SPAN - (stamp - lastCalled);
  24105. lastCalled = stamp;
  24106. if (remaining > 0) {
  24107. if (++count >= HOT_COUNT) {
  24108. return arguments[0];
  24109. }
  24110. } else {
  24111. count = 0;
  24112. }
  24113. return func.apply(undefined, arguments);
  24114. };
  24115. }
  24116. /**
  24117. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24118. *
  24119. * @private
  24120. * @param {Array} array The array to shuffle.
  24121. * @param {number} [size=array.length] The size of `array`.
  24122. * @returns {Array} Returns `array`.
  24123. */
  24124. function shuffleSelf(array, size) {
  24125. var index = -1,
  24126. length = array.length,
  24127. lastIndex = length - 1;
  24128. size = size === undefined ? length : size;
  24129. while (++index < size) {
  24130. var rand = baseRandom(index, lastIndex),
  24131. value = array[rand];
  24132. array[rand] = array[index];
  24133. array[index] = value;
  24134. }
  24135. array.length = size;
  24136. return array;
  24137. }
  24138. /**
  24139. * Converts `string` to a property path array.
  24140. *
  24141. * @private
  24142. * @param {string} string The string to convert.
  24143. * @returns {Array} Returns the property path array.
  24144. */
  24145. var stringToPath = memoizeCapped(function(string) {
  24146. var result = [];
  24147. if (string.charCodeAt(0) === 46 /* . */) {
  24148. result.push('');
  24149. }
  24150. string.replace(rePropName, function(match, number, quote, subString) {
  24151. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24152. });
  24153. return result;
  24154. });
  24155. /**
  24156. * Converts `value` to a string key if it's not a string or symbol.
  24157. *
  24158. * @private
  24159. * @param {*} value The value to inspect.
  24160. * @returns {string|symbol} Returns the key.
  24161. */
  24162. function toKey(value) {
  24163. if (typeof value == 'string' || isSymbol(value)) {
  24164. return value;
  24165. }
  24166. var result = (value + '');
  24167. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24168. }
  24169. /**
  24170. * Converts `func` to its source code.
  24171. *
  24172. * @private
  24173. * @param {Function} func The function to convert.
  24174. * @returns {string} Returns the source code.
  24175. */
  24176. function toSource(func) {
  24177. if (func != null) {
  24178. try {
  24179. return funcToString.call(func);
  24180. } catch (e) {}
  24181. try {
  24182. return (func + '');
  24183. } catch (e) {}
  24184. }
  24185. return '';
  24186. }
  24187. /**
  24188. * Updates wrapper `details` based on `bitmask` flags.
  24189. *
  24190. * @private
  24191. * @returns {Array} details The details to modify.
  24192. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24193. * @returns {Array} Returns `details`.
  24194. */
  24195. function updateWrapDetails(details, bitmask) {
  24196. arrayEach(wrapFlags, function(pair) {
  24197. var value = '_.' + pair[0];
  24198. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24199. details.push(value);
  24200. }
  24201. });
  24202. return details.sort();
  24203. }
  24204. /**
  24205. * Creates a clone of `wrapper`.
  24206. *
  24207. * @private
  24208. * @param {Object} wrapper The wrapper to clone.
  24209. * @returns {Object} Returns the cloned wrapper.
  24210. */
  24211. function wrapperClone(wrapper) {
  24212. if (wrapper instanceof LazyWrapper) {
  24213. return wrapper.clone();
  24214. }
  24215. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24216. result.__actions__ = copyArray(wrapper.__actions__);
  24217. result.__index__ = wrapper.__index__;
  24218. result.__values__ = wrapper.__values__;
  24219. return result;
  24220. }
  24221. /*------------------------------------------------------------------------*/
  24222. /**
  24223. * Creates an array of elements split into groups the length of `size`.
  24224. * If `array` can't be split evenly, the final chunk will be the remaining
  24225. * elements.
  24226. *
  24227. * @static
  24228. * @memberOf _
  24229. * @since 3.0.0
  24230. * @category Array
  24231. * @param {Array} array The array to process.
  24232. * @param {number} [size=1] The length of each chunk
  24233. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24234. * @returns {Array} Returns the new array of chunks.
  24235. * @example
  24236. *
  24237. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24238. * // => [['a', 'b'], ['c', 'd']]
  24239. *
  24240. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24241. * // => [['a', 'b', 'c'], ['d']]
  24242. */
  24243. function chunk(array, size, guard) {
  24244. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24245. size = 1;
  24246. } else {
  24247. size = nativeMax(toInteger(size), 0);
  24248. }
  24249. var length = array == null ? 0 : array.length;
  24250. if (!length || size < 1) {
  24251. return [];
  24252. }
  24253. var index = 0,
  24254. resIndex = 0,
  24255. result = Array(nativeCeil(length / size));
  24256. while (index < length) {
  24257. result[resIndex++] = baseSlice(array, index, (index += size));
  24258. }
  24259. return result;
  24260. }
  24261. /**
  24262. * Creates an array with all falsey values removed. The values `false`, `null`,
  24263. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24264. *
  24265. * @static
  24266. * @memberOf _
  24267. * @since 0.1.0
  24268. * @category Array
  24269. * @param {Array} array The array to compact.
  24270. * @returns {Array} Returns the new array of filtered values.
  24271. * @example
  24272. *
  24273. * _.compact([0, 1, false, 2, '', 3]);
  24274. * // => [1, 2, 3]
  24275. */
  24276. function compact(array) {
  24277. var index = -1,
  24278. length = array == null ? 0 : array.length,
  24279. resIndex = 0,
  24280. result = [];
  24281. while (++index < length) {
  24282. var value = array[index];
  24283. if (value) {
  24284. result[resIndex++] = value;
  24285. }
  24286. }
  24287. return result;
  24288. }
  24289. /**
  24290. * Creates a new array concatenating `array` with any additional arrays
  24291. * and/or values.
  24292. *
  24293. * @static
  24294. * @memberOf _
  24295. * @since 4.0.0
  24296. * @category Array
  24297. * @param {Array} array The array to concatenate.
  24298. * @param {...*} [values] The values to concatenate.
  24299. * @returns {Array} Returns the new concatenated array.
  24300. * @example
  24301. *
  24302. * var array = [1];
  24303. * var other = _.concat(array, 2, [3], [[4]]);
  24304. *
  24305. * console.log(other);
  24306. * // => [1, 2, 3, [4]]
  24307. *
  24308. * console.log(array);
  24309. * // => [1]
  24310. */
  24311. function concat() {
  24312. var length = arguments.length;
  24313. if (!length) {
  24314. return [];
  24315. }
  24316. var args = Array(length - 1),
  24317. array = arguments[0],
  24318. index = length;
  24319. while (index--) {
  24320. args[index - 1] = arguments[index];
  24321. }
  24322. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24323. }
  24324. /**
  24325. * Creates an array of `array` values not included in the other given arrays
  24326. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24327. * for equality comparisons. The order and references of result values are
  24328. * determined by the first array.
  24329. *
  24330. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24331. *
  24332. * @static
  24333. * @memberOf _
  24334. * @since 0.1.0
  24335. * @category Array
  24336. * @param {Array} array The array to inspect.
  24337. * @param {...Array} [values] The values to exclude.
  24338. * @returns {Array} Returns the new array of filtered values.
  24339. * @see _.without, _.xor
  24340. * @example
  24341. *
  24342. * _.difference([2, 1], [2, 3]);
  24343. * // => [1]
  24344. */
  24345. var difference = baseRest(function(array, values) {
  24346. return isArrayLikeObject(array)
  24347. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24348. : [];
  24349. });
  24350. /**
  24351. * This method is like `_.difference` except that it accepts `iteratee` which
  24352. * is invoked for each element of `array` and `values` to generate the criterion
  24353. * by which they're compared. The order and references of result values are
  24354. * determined by the first array. The iteratee is invoked with one argument:
  24355. * (value).
  24356. *
  24357. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24358. *
  24359. * @static
  24360. * @memberOf _
  24361. * @since 4.0.0
  24362. * @category Array
  24363. * @param {Array} array The array to inspect.
  24364. * @param {...Array} [values] The values to exclude.
  24365. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24366. * @returns {Array} Returns the new array of filtered values.
  24367. * @example
  24368. *
  24369. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24370. * // => [1.2]
  24371. *
  24372. * // The `_.property` iteratee shorthand.
  24373. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24374. * // => [{ 'x': 2 }]
  24375. */
  24376. var differenceBy = baseRest(function(array, values) {
  24377. var iteratee = last(values);
  24378. if (isArrayLikeObject(iteratee)) {
  24379. iteratee = undefined;
  24380. }
  24381. return isArrayLikeObject(array)
  24382. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24383. : [];
  24384. });
  24385. /**
  24386. * This method is like `_.difference` except that it accepts `comparator`
  24387. * which is invoked to compare elements of `array` to `values`. The order and
  24388. * references of result values are determined by the first array. The comparator
  24389. * is invoked with two arguments: (arrVal, othVal).
  24390. *
  24391. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24392. *
  24393. * @static
  24394. * @memberOf _
  24395. * @since 4.0.0
  24396. * @category Array
  24397. * @param {Array} array The array to inspect.
  24398. * @param {...Array} [values] The values to exclude.
  24399. * @param {Function} [comparator] The comparator invoked per element.
  24400. * @returns {Array} Returns the new array of filtered values.
  24401. * @example
  24402. *
  24403. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24404. *
  24405. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24406. * // => [{ 'x': 2, 'y': 1 }]
  24407. */
  24408. var differenceWith = baseRest(function(array, values) {
  24409. var comparator = last(values);
  24410. if (isArrayLikeObject(comparator)) {
  24411. comparator = undefined;
  24412. }
  24413. return isArrayLikeObject(array)
  24414. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24415. : [];
  24416. });
  24417. /**
  24418. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24419. *
  24420. * @static
  24421. * @memberOf _
  24422. * @since 0.5.0
  24423. * @category Array
  24424. * @param {Array} array The array to query.
  24425. * @param {number} [n=1] The number of elements to drop.
  24426. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24427. * @returns {Array} Returns the slice of `array`.
  24428. * @example
  24429. *
  24430. * _.drop([1, 2, 3]);
  24431. * // => [2, 3]
  24432. *
  24433. * _.drop([1, 2, 3], 2);
  24434. * // => [3]
  24435. *
  24436. * _.drop([1, 2, 3], 5);
  24437. * // => []
  24438. *
  24439. * _.drop([1, 2, 3], 0);
  24440. * // => [1, 2, 3]
  24441. */
  24442. function drop(array, n, guard) {
  24443. var length = array == null ? 0 : array.length;
  24444. if (!length) {
  24445. return [];
  24446. }
  24447. n = (guard || n === undefined) ? 1 : toInteger(n);
  24448. return baseSlice(array, n < 0 ? 0 : n, length);
  24449. }
  24450. /**
  24451. * Creates a slice of `array` with `n` elements dropped from the end.
  24452. *
  24453. * @static
  24454. * @memberOf _
  24455. * @since 3.0.0
  24456. * @category Array
  24457. * @param {Array} array The array to query.
  24458. * @param {number} [n=1] The number of elements to drop.
  24459. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24460. * @returns {Array} Returns the slice of `array`.
  24461. * @example
  24462. *
  24463. * _.dropRight([1, 2, 3]);
  24464. * // => [1, 2]
  24465. *
  24466. * _.dropRight([1, 2, 3], 2);
  24467. * // => [1]
  24468. *
  24469. * _.dropRight([1, 2, 3], 5);
  24470. * // => []
  24471. *
  24472. * _.dropRight([1, 2, 3], 0);
  24473. * // => [1, 2, 3]
  24474. */
  24475. function dropRight(array, n, guard) {
  24476. var length = array == null ? 0 : array.length;
  24477. if (!length) {
  24478. return [];
  24479. }
  24480. n = (guard || n === undefined) ? 1 : toInteger(n);
  24481. n = length - n;
  24482. return baseSlice(array, 0, n < 0 ? 0 : n);
  24483. }
  24484. /**
  24485. * Creates a slice of `array` excluding elements dropped from the end.
  24486. * Elements are dropped until `predicate` returns falsey. The predicate is
  24487. * invoked with three arguments: (value, index, array).
  24488. *
  24489. * @static
  24490. * @memberOf _
  24491. * @since 3.0.0
  24492. * @category Array
  24493. * @param {Array} array The array to query.
  24494. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24495. * @returns {Array} Returns the slice of `array`.
  24496. * @example
  24497. *
  24498. * var users = [
  24499. * { 'user': 'barney', 'active': true },
  24500. * { 'user': 'fred', 'active': false },
  24501. * { 'user': 'pebbles', 'active': false }
  24502. * ];
  24503. *
  24504. * _.dropRightWhile(users, function(o) { return !o.active; });
  24505. * // => objects for ['barney']
  24506. *
  24507. * // The `_.matches` iteratee shorthand.
  24508. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24509. * // => objects for ['barney', 'fred']
  24510. *
  24511. * // The `_.matchesProperty` iteratee shorthand.
  24512. * _.dropRightWhile(users, ['active', false]);
  24513. * // => objects for ['barney']
  24514. *
  24515. * // The `_.property` iteratee shorthand.
  24516. * _.dropRightWhile(users, 'active');
  24517. * // => objects for ['barney', 'fred', 'pebbles']
  24518. */
  24519. function dropRightWhile(array, predicate) {
  24520. return (array && array.length)
  24521. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24522. : [];
  24523. }
  24524. /**
  24525. * Creates a slice of `array` excluding elements dropped from the beginning.
  24526. * Elements are dropped until `predicate` returns falsey. The predicate is
  24527. * invoked with three arguments: (value, index, array).
  24528. *
  24529. * @static
  24530. * @memberOf _
  24531. * @since 3.0.0
  24532. * @category Array
  24533. * @param {Array} array The array to query.
  24534. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24535. * @returns {Array} Returns the slice of `array`.
  24536. * @example
  24537. *
  24538. * var users = [
  24539. * { 'user': 'barney', 'active': false },
  24540. * { 'user': 'fred', 'active': false },
  24541. * { 'user': 'pebbles', 'active': true }
  24542. * ];
  24543. *
  24544. * _.dropWhile(users, function(o) { return !o.active; });
  24545. * // => objects for ['pebbles']
  24546. *
  24547. * // The `_.matches` iteratee shorthand.
  24548. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24549. * // => objects for ['fred', 'pebbles']
  24550. *
  24551. * // The `_.matchesProperty` iteratee shorthand.
  24552. * _.dropWhile(users, ['active', false]);
  24553. * // => objects for ['pebbles']
  24554. *
  24555. * // The `_.property` iteratee shorthand.
  24556. * _.dropWhile(users, 'active');
  24557. * // => objects for ['barney', 'fred', 'pebbles']
  24558. */
  24559. function dropWhile(array, predicate) {
  24560. return (array && array.length)
  24561. ? baseWhile(array, getIteratee(predicate, 3), true)
  24562. : [];
  24563. }
  24564. /**
  24565. * Fills elements of `array` with `value` from `start` up to, but not
  24566. * including, `end`.
  24567. *
  24568. * **Note:** This method mutates `array`.
  24569. *
  24570. * @static
  24571. * @memberOf _
  24572. * @since 3.2.0
  24573. * @category Array
  24574. * @param {Array} array The array to fill.
  24575. * @param {*} value The value to fill `array` with.
  24576. * @param {number} [start=0] The start position.
  24577. * @param {number} [end=array.length] The end position.
  24578. * @returns {Array} Returns `array`.
  24579. * @example
  24580. *
  24581. * var array = [1, 2, 3];
  24582. *
  24583. * _.fill(array, 'a');
  24584. * console.log(array);
  24585. * // => ['a', 'a', 'a']
  24586. *
  24587. * _.fill(Array(3), 2);
  24588. * // => [2, 2, 2]
  24589. *
  24590. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24591. * // => [4, '*', '*', 10]
  24592. */
  24593. function fill(array, value, start, end) {
  24594. var length = array == null ? 0 : array.length;
  24595. if (!length) {
  24596. return [];
  24597. }
  24598. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24599. start = 0;
  24600. end = length;
  24601. }
  24602. return baseFill(array, value, start, end);
  24603. }
  24604. /**
  24605. * This method is like `_.find` except that it returns the index of the first
  24606. * element `predicate` returns truthy for instead of the element itself.
  24607. *
  24608. * @static
  24609. * @memberOf _
  24610. * @since 1.1.0
  24611. * @category Array
  24612. * @param {Array} array The array to inspect.
  24613. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24614. * @param {number} [fromIndex=0] The index to search from.
  24615. * @returns {number} Returns the index of the found element, else `-1`.
  24616. * @example
  24617. *
  24618. * var users = [
  24619. * { 'user': 'barney', 'active': false },
  24620. * { 'user': 'fred', 'active': false },
  24621. * { 'user': 'pebbles', 'active': true }
  24622. * ];
  24623. *
  24624. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24625. * // => 0
  24626. *
  24627. * // The `_.matches` iteratee shorthand.
  24628. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24629. * // => 1
  24630. *
  24631. * // The `_.matchesProperty` iteratee shorthand.
  24632. * _.findIndex(users, ['active', false]);
  24633. * // => 0
  24634. *
  24635. * // The `_.property` iteratee shorthand.
  24636. * _.findIndex(users, 'active');
  24637. * // => 2
  24638. */
  24639. function findIndex(array, predicate, fromIndex) {
  24640. var length = array == null ? 0 : array.length;
  24641. if (!length) {
  24642. return -1;
  24643. }
  24644. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24645. if (index < 0) {
  24646. index = nativeMax(length + index, 0);
  24647. }
  24648. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24649. }
  24650. /**
  24651. * This method is like `_.findIndex` except that it iterates over elements
  24652. * of `collection` from right to left.
  24653. *
  24654. * @static
  24655. * @memberOf _
  24656. * @since 2.0.0
  24657. * @category Array
  24658. * @param {Array} array The array to inspect.
  24659. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24660. * @param {number} [fromIndex=array.length-1] The index to search from.
  24661. * @returns {number} Returns the index of the found element, else `-1`.
  24662. * @example
  24663. *
  24664. * var users = [
  24665. * { 'user': 'barney', 'active': true },
  24666. * { 'user': 'fred', 'active': false },
  24667. * { 'user': 'pebbles', 'active': false }
  24668. * ];
  24669. *
  24670. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24671. * // => 2
  24672. *
  24673. * // The `_.matches` iteratee shorthand.
  24674. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24675. * // => 0
  24676. *
  24677. * // The `_.matchesProperty` iteratee shorthand.
  24678. * _.findLastIndex(users, ['active', false]);
  24679. * // => 2
  24680. *
  24681. * // The `_.property` iteratee shorthand.
  24682. * _.findLastIndex(users, 'active');
  24683. * // => 0
  24684. */
  24685. function findLastIndex(array, predicate, fromIndex) {
  24686. var length = array == null ? 0 : array.length;
  24687. if (!length) {
  24688. return -1;
  24689. }
  24690. var index = length - 1;
  24691. if (fromIndex !== undefined) {
  24692. index = toInteger(fromIndex);
  24693. index = fromIndex < 0
  24694. ? nativeMax(length + index, 0)
  24695. : nativeMin(index, length - 1);
  24696. }
  24697. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24698. }
  24699. /**
  24700. * Flattens `array` a single level deep.
  24701. *
  24702. * @static
  24703. * @memberOf _
  24704. * @since 0.1.0
  24705. * @category Array
  24706. * @param {Array} array The array to flatten.
  24707. * @returns {Array} Returns the new flattened array.
  24708. * @example
  24709. *
  24710. * _.flatten([1, [2, [3, [4]], 5]]);
  24711. * // => [1, 2, [3, [4]], 5]
  24712. */
  24713. function flatten(array) {
  24714. var length = array == null ? 0 : array.length;
  24715. return length ? baseFlatten(array, 1) : [];
  24716. }
  24717. /**
  24718. * Recursively flattens `array`.
  24719. *
  24720. * @static
  24721. * @memberOf _
  24722. * @since 3.0.0
  24723. * @category Array
  24724. * @param {Array} array The array to flatten.
  24725. * @returns {Array} Returns the new flattened array.
  24726. * @example
  24727. *
  24728. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24729. * // => [1, 2, 3, 4, 5]
  24730. */
  24731. function flattenDeep(array) {
  24732. var length = array == null ? 0 : array.length;
  24733. return length ? baseFlatten(array, INFINITY) : [];
  24734. }
  24735. /**
  24736. * Recursively flatten `array` up to `depth` times.
  24737. *
  24738. * @static
  24739. * @memberOf _
  24740. * @since 4.4.0
  24741. * @category Array
  24742. * @param {Array} array The array to flatten.
  24743. * @param {number} [depth=1] The maximum recursion depth.
  24744. * @returns {Array} Returns the new flattened array.
  24745. * @example
  24746. *
  24747. * var array = [1, [2, [3, [4]], 5]];
  24748. *
  24749. * _.flattenDepth(array, 1);
  24750. * // => [1, 2, [3, [4]], 5]
  24751. *
  24752. * _.flattenDepth(array, 2);
  24753. * // => [1, 2, 3, [4], 5]
  24754. */
  24755. function flattenDepth(array, depth) {
  24756. var length = array == null ? 0 : array.length;
  24757. if (!length) {
  24758. return [];
  24759. }
  24760. depth = depth === undefined ? 1 : toInteger(depth);
  24761. return baseFlatten(array, depth);
  24762. }
  24763. /**
  24764. * The inverse of `_.toPairs`; this method returns an object composed
  24765. * from key-value `pairs`.
  24766. *
  24767. * @static
  24768. * @memberOf _
  24769. * @since 4.0.0
  24770. * @category Array
  24771. * @param {Array} pairs The key-value pairs.
  24772. * @returns {Object} Returns the new object.
  24773. * @example
  24774. *
  24775. * _.fromPairs([['a', 1], ['b', 2]]);
  24776. * // => { 'a': 1, 'b': 2 }
  24777. */
  24778. function fromPairs(pairs) {
  24779. var index = -1,
  24780. length = pairs == null ? 0 : pairs.length,
  24781. result = {};
  24782. while (++index < length) {
  24783. var pair = pairs[index];
  24784. result[pair[0]] = pair[1];
  24785. }
  24786. return result;
  24787. }
  24788. /**
  24789. * Gets the first element of `array`.
  24790. *
  24791. * @static
  24792. * @memberOf _
  24793. * @since 0.1.0
  24794. * @alias first
  24795. * @category Array
  24796. * @param {Array} array The array to query.
  24797. * @returns {*} Returns the first element of `array`.
  24798. * @example
  24799. *
  24800. * _.head([1, 2, 3]);
  24801. * // => 1
  24802. *
  24803. * _.head([]);
  24804. * // => undefined
  24805. */
  24806. function head(array) {
  24807. return (array && array.length) ? array[0] : undefined;
  24808. }
  24809. /**
  24810. * Gets the index at which the first occurrence of `value` is found in `array`
  24811. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24812. * for equality comparisons. If `fromIndex` is negative, it's used as the
  24813. * offset from the end of `array`.
  24814. *
  24815. * @static
  24816. * @memberOf _
  24817. * @since 0.1.0
  24818. * @category Array
  24819. * @param {Array} array The array to inspect.
  24820. * @param {*} value The value to search for.
  24821. * @param {number} [fromIndex=0] The index to search from.
  24822. * @returns {number} Returns the index of the matched value, else `-1`.
  24823. * @example
  24824. *
  24825. * _.indexOf([1, 2, 1, 2], 2);
  24826. * // => 1
  24827. *
  24828. * // Search from the `fromIndex`.
  24829. * _.indexOf([1, 2, 1, 2], 2, 2);
  24830. * // => 3
  24831. */
  24832. function indexOf(array, value, fromIndex) {
  24833. var length = array == null ? 0 : array.length;
  24834. if (!length) {
  24835. return -1;
  24836. }
  24837. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24838. if (index < 0) {
  24839. index = nativeMax(length + index, 0);
  24840. }
  24841. return baseIndexOf(array, value, index);
  24842. }
  24843. /**
  24844. * Gets all but the last element of `array`.
  24845. *
  24846. * @static
  24847. * @memberOf _
  24848. * @since 0.1.0
  24849. * @category Array
  24850. * @param {Array} array The array to query.
  24851. * @returns {Array} Returns the slice of `array`.
  24852. * @example
  24853. *
  24854. * _.initial([1, 2, 3]);
  24855. * // => [1, 2]
  24856. */
  24857. function initial(array) {
  24858. var length = array == null ? 0 : array.length;
  24859. return length ? baseSlice(array, 0, -1) : [];
  24860. }
  24861. /**
  24862. * Creates an array of unique values that are included in all given arrays
  24863. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24864. * for equality comparisons. The order and references of result values are
  24865. * determined by the first array.
  24866. *
  24867. * @static
  24868. * @memberOf _
  24869. * @since 0.1.0
  24870. * @category Array
  24871. * @param {...Array} [arrays] The arrays to inspect.
  24872. * @returns {Array} Returns the new array of intersecting values.
  24873. * @example
  24874. *
  24875. * _.intersection([2, 1], [2, 3]);
  24876. * // => [2]
  24877. */
  24878. var intersection = baseRest(function(arrays) {
  24879. var mapped = arrayMap(arrays, castArrayLikeObject);
  24880. return (mapped.length && mapped[0] === arrays[0])
  24881. ? baseIntersection(mapped)
  24882. : [];
  24883. });
  24884. /**
  24885. * This method is like `_.intersection` except that it accepts `iteratee`
  24886. * which is invoked for each element of each `arrays` to generate the criterion
  24887. * by which they're compared. The order and references of result values are
  24888. * determined by the first array. The iteratee is invoked with one argument:
  24889. * (value).
  24890. *
  24891. * @static
  24892. * @memberOf _
  24893. * @since 4.0.0
  24894. * @category Array
  24895. * @param {...Array} [arrays] The arrays to inspect.
  24896. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24897. * @returns {Array} Returns the new array of intersecting values.
  24898. * @example
  24899. *
  24900. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24901. * // => [2.1]
  24902. *
  24903. * // The `_.property` iteratee shorthand.
  24904. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  24905. * // => [{ 'x': 1 }]
  24906. */
  24907. var intersectionBy = baseRest(function(arrays) {
  24908. var iteratee = last(arrays),
  24909. mapped = arrayMap(arrays, castArrayLikeObject);
  24910. if (iteratee === last(mapped)) {
  24911. iteratee = undefined;
  24912. } else {
  24913. mapped.pop();
  24914. }
  24915. return (mapped.length && mapped[0] === arrays[0])
  24916. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  24917. : [];
  24918. });
  24919. /**
  24920. * This method is like `_.intersection` except that it accepts `comparator`
  24921. * which is invoked to compare elements of `arrays`. The order and references
  24922. * of result values are determined by the first array. The comparator is
  24923. * invoked with two arguments: (arrVal, othVal).
  24924. *
  24925. * @static
  24926. * @memberOf _
  24927. * @since 4.0.0
  24928. * @category Array
  24929. * @param {...Array} [arrays] The arrays to inspect.
  24930. * @param {Function} [comparator] The comparator invoked per element.
  24931. * @returns {Array} Returns the new array of intersecting values.
  24932. * @example
  24933. *
  24934. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24935. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  24936. *
  24937. * _.intersectionWith(objects, others, _.isEqual);
  24938. * // => [{ 'x': 1, 'y': 2 }]
  24939. */
  24940. var intersectionWith = baseRest(function(arrays) {
  24941. var comparator = last(arrays),
  24942. mapped = arrayMap(arrays, castArrayLikeObject);
  24943. comparator = typeof comparator == 'function' ? comparator : undefined;
  24944. if (comparator) {
  24945. mapped.pop();
  24946. }
  24947. return (mapped.length && mapped[0] === arrays[0])
  24948. ? baseIntersection(mapped, undefined, comparator)
  24949. : [];
  24950. });
  24951. /**
  24952. * Converts all elements in `array` into a string separated by `separator`.
  24953. *
  24954. * @static
  24955. * @memberOf _
  24956. * @since 4.0.0
  24957. * @category Array
  24958. * @param {Array} array The array to convert.
  24959. * @param {string} [separator=','] The element separator.
  24960. * @returns {string} Returns the joined string.
  24961. * @example
  24962. *
  24963. * _.join(['a', 'b', 'c'], '~');
  24964. * // => 'a~b~c'
  24965. */
  24966. function join(array, separator) {
  24967. return array == null ? '' : nativeJoin.call(array, separator);
  24968. }
  24969. /**
  24970. * Gets the last element of `array`.
  24971. *
  24972. * @static
  24973. * @memberOf _
  24974. * @since 0.1.0
  24975. * @category Array
  24976. * @param {Array} array The array to query.
  24977. * @returns {*} Returns the last element of `array`.
  24978. * @example
  24979. *
  24980. * _.last([1, 2, 3]);
  24981. * // => 3
  24982. */
  24983. function last(array) {
  24984. var length = array == null ? 0 : array.length;
  24985. return length ? array[length - 1] : undefined;
  24986. }
  24987. /**
  24988. * This method is like `_.indexOf` except that it iterates over elements of
  24989. * `array` from right to left.
  24990. *
  24991. * @static
  24992. * @memberOf _
  24993. * @since 0.1.0
  24994. * @category Array
  24995. * @param {Array} array The array to inspect.
  24996. * @param {*} value The value to search for.
  24997. * @param {number} [fromIndex=array.length-1] The index to search from.
  24998. * @returns {number} Returns the index of the matched value, else `-1`.
  24999. * @example
  25000. *
  25001. * _.lastIndexOf([1, 2, 1, 2], 2);
  25002. * // => 3
  25003. *
  25004. * // Search from the `fromIndex`.
  25005. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25006. * // => 1
  25007. */
  25008. function lastIndexOf(array, value, fromIndex) {
  25009. var length = array == null ? 0 : array.length;
  25010. if (!length) {
  25011. return -1;
  25012. }
  25013. var index = length;
  25014. if (fromIndex !== undefined) {
  25015. index = toInteger(fromIndex);
  25016. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25017. }
  25018. return value === value
  25019. ? strictLastIndexOf(array, value, index)
  25020. : baseFindIndex(array, baseIsNaN, index, true);
  25021. }
  25022. /**
  25023. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25024. * element from the end is returned.
  25025. *
  25026. * @static
  25027. * @memberOf _
  25028. * @since 4.11.0
  25029. * @category Array
  25030. * @param {Array} array The array to query.
  25031. * @param {number} [n=0] The index of the element to return.
  25032. * @returns {*} Returns the nth element of `array`.
  25033. * @example
  25034. *
  25035. * var array = ['a', 'b', 'c', 'd'];
  25036. *
  25037. * _.nth(array, 1);
  25038. * // => 'b'
  25039. *
  25040. * _.nth(array, -2);
  25041. * // => 'c';
  25042. */
  25043. function nth(array, n) {
  25044. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25045. }
  25046. /**
  25047. * Removes all given values from `array` using
  25048. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25049. * for equality comparisons.
  25050. *
  25051. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25052. * to remove elements from an array by predicate.
  25053. *
  25054. * @static
  25055. * @memberOf _
  25056. * @since 2.0.0
  25057. * @category Array
  25058. * @param {Array} array The array to modify.
  25059. * @param {...*} [values] The values to remove.
  25060. * @returns {Array} Returns `array`.
  25061. * @example
  25062. *
  25063. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25064. *
  25065. * _.pull(array, 'a', 'c');
  25066. * console.log(array);
  25067. * // => ['b', 'b']
  25068. */
  25069. var pull = baseRest(pullAll);
  25070. /**
  25071. * This method is like `_.pull` except that it accepts an array of values to remove.
  25072. *
  25073. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25074. *
  25075. * @static
  25076. * @memberOf _
  25077. * @since 4.0.0
  25078. * @category Array
  25079. * @param {Array} array The array to modify.
  25080. * @param {Array} values The values to remove.
  25081. * @returns {Array} Returns `array`.
  25082. * @example
  25083. *
  25084. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25085. *
  25086. * _.pullAll(array, ['a', 'c']);
  25087. * console.log(array);
  25088. * // => ['b', 'b']
  25089. */
  25090. function pullAll(array, values) {
  25091. return (array && array.length && values && values.length)
  25092. ? basePullAll(array, values)
  25093. : array;
  25094. }
  25095. /**
  25096. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25097. * invoked for each element of `array` and `values` to generate the criterion
  25098. * by which they're compared. The iteratee is invoked with one argument: (value).
  25099. *
  25100. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25101. *
  25102. * @static
  25103. * @memberOf _
  25104. * @since 4.0.0
  25105. * @category Array
  25106. * @param {Array} array The array to modify.
  25107. * @param {Array} values The values to remove.
  25108. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25109. * @returns {Array} Returns `array`.
  25110. * @example
  25111. *
  25112. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25113. *
  25114. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25115. * console.log(array);
  25116. * // => [{ 'x': 2 }]
  25117. */
  25118. function pullAllBy(array, values, iteratee) {
  25119. return (array && array.length && values && values.length)
  25120. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25121. : array;
  25122. }
  25123. /**
  25124. * This method is like `_.pullAll` except that it accepts `comparator` which
  25125. * is invoked to compare elements of `array` to `values`. The comparator is
  25126. * invoked with two arguments: (arrVal, othVal).
  25127. *
  25128. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25129. *
  25130. * @static
  25131. * @memberOf _
  25132. * @since 4.6.0
  25133. * @category Array
  25134. * @param {Array} array The array to modify.
  25135. * @param {Array} values The values to remove.
  25136. * @param {Function} [comparator] The comparator invoked per element.
  25137. * @returns {Array} Returns `array`.
  25138. * @example
  25139. *
  25140. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25141. *
  25142. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25143. * console.log(array);
  25144. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25145. */
  25146. function pullAllWith(array, values, comparator) {
  25147. return (array && array.length && values && values.length)
  25148. ? basePullAll(array, values, undefined, comparator)
  25149. : array;
  25150. }
  25151. /**
  25152. * Removes elements from `array` corresponding to `indexes` and returns an
  25153. * array of removed elements.
  25154. *
  25155. * **Note:** Unlike `_.at`, this method mutates `array`.
  25156. *
  25157. * @static
  25158. * @memberOf _
  25159. * @since 3.0.0
  25160. * @category Array
  25161. * @param {Array} array The array to modify.
  25162. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25163. * @returns {Array} Returns the new array of removed elements.
  25164. * @example
  25165. *
  25166. * var array = ['a', 'b', 'c', 'd'];
  25167. * var pulled = _.pullAt(array, [1, 3]);
  25168. *
  25169. * console.log(array);
  25170. * // => ['a', 'c']
  25171. *
  25172. * console.log(pulled);
  25173. * // => ['b', 'd']
  25174. */
  25175. var pullAt = flatRest(function(array, indexes) {
  25176. var length = array == null ? 0 : array.length,
  25177. result = baseAt(array, indexes);
  25178. basePullAt(array, arrayMap(indexes, function(index) {
  25179. return isIndex(index, length) ? +index : index;
  25180. }).sort(compareAscending));
  25181. return result;
  25182. });
  25183. /**
  25184. * Removes all elements from `array` that `predicate` returns truthy for
  25185. * and returns an array of the removed elements. The predicate is invoked
  25186. * with three arguments: (value, index, array).
  25187. *
  25188. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25189. * to pull elements from an array by value.
  25190. *
  25191. * @static
  25192. * @memberOf _
  25193. * @since 2.0.0
  25194. * @category Array
  25195. * @param {Array} array The array to modify.
  25196. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25197. * @returns {Array} Returns the new array of removed elements.
  25198. * @example
  25199. *
  25200. * var array = [1, 2, 3, 4];
  25201. * var evens = _.remove(array, function(n) {
  25202. * return n % 2 == 0;
  25203. * });
  25204. *
  25205. * console.log(array);
  25206. * // => [1, 3]
  25207. *
  25208. * console.log(evens);
  25209. * // => [2, 4]
  25210. */
  25211. function remove(array, predicate) {
  25212. var result = [];
  25213. if (!(array && array.length)) {
  25214. return result;
  25215. }
  25216. var index = -1,
  25217. indexes = [],
  25218. length = array.length;
  25219. predicate = getIteratee(predicate, 3);
  25220. while (++index < length) {
  25221. var value = array[index];
  25222. if (predicate(value, index, array)) {
  25223. result.push(value);
  25224. indexes.push(index);
  25225. }
  25226. }
  25227. basePullAt(array, indexes);
  25228. return result;
  25229. }
  25230. /**
  25231. * Reverses `array` so that the first element becomes the last, the second
  25232. * element becomes the second to last, and so on.
  25233. *
  25234. * **Note:** This method mutates `array` and is based on
  25235. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25236. *
  25237. * @static
  25238. * @memberOf _
  25239. * @since 4.0.0
  25240. * @category Array
  25241. * @param {Array} array The array to modify.
  25242. * @returns {Array} Returns `array`.
  25243. * @example
  25244. *
  25245. * var array = [1, 2, 3];
  25246. *
  25247. * _.reverse(array);
  25248. * // => [3, 2, 1]
  25249. *
  25250. * console.log(array);
  25251. * // => [3, 2, 1]
  25252. */
  25253. function reverse(array) {
  25254. return array == null ? array : nativeReverse.call(array);
  25255. }
  25256. /**
  25257. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25258. *
  25259. * **Note:** This method is used instead of
  25260. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25261. * returned.
  25262. *
  25263. * @static
  25264. * @memberOf _
  25265. * @since 3.0.0
  25266. * @category Array
  25267. * @param {Array} array The array to slice.
  25268. * @param {number} [start=0] The start position.
  25269. * @param {number} [end=array.length] The end position.
  25270. * @returns {Array} Returns the slice of `array`.
  25271. */
  25272. function slice(array, start, end) {
  25273. var length = array == null ? 0 : array.length;
  25274. if (!length) {
  25275. return [];
  25276. }
  25277. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25278. start = 0;
  25279. end = length;
  25280. }
  25281. else {
  25282. start = start == null ? 0 : toInteger(start);
  25283. end = end === undefined ? length : toInteger(end);
  25284. }
  25285. return baseSlice(array, start, end);
  25286. }
  25287. /**
  25288. * Uses a binary search to determine the lowest index at which `value`
  25289. * should be inserted into `array` in order to maintain its sort order.
  25290. *
  25291. * @static
  25292. * @memberOf _
  25293. * @since 0.1.0
  25294. * @category Array
  25295. * @param {Array} array The sorted array to inspect.
  25296. * @param {*} value The value to evaluate.
  25297. * @returns {number} Returns the index at which `value` should be inserted
  25298. * into `array`.
  25299. * @example
  25300. *
  25301. * _.sortedIndex([30, 50], 40);
  25302. * // => 1
  25303. */
  25304. function sortedIndex(array, value) {
  25305. return baseSortedIndex(array, value);
  25306. }
  25307. /**
  25308. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25309. * which is invoked for `value` and each element of `array` to compute their
  25310. * sort ranking. The iteratee is invoked with one argument: (value).
  25311. *
  25312. * @static
  25313. * @memberOf _
  25314. * @since 4.0.0
  25315. * @category Array
  25316. * @param {Array} array The sorted array to inspect.
  25317. * @param {*} value The value to evaluate.
  25318. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25319. * @returns {number} Returns the index at which `value` should be inserted
  25320. * into `array`.
  25321. * @example
  25322. *
  25323. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25324. *
  25325. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25326. * // => 0
  25327. *
  25328. * // The `_.property` iteratee shorthand.
  25329. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25330. * // => 0
  25331. */
  25332. function sortedIndexBy(array, value, iteratee) {
  25333. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25334. }
  25335. /**
  25336. * This method is like `_.indexOf` except that it performs a binary
  25337. * search on a sorted `array`.
  25338. *
  25339. * @static
  25340. * @memberOf _
  25341. * @since 4.0.0
  25342. * @category Array
  25343. * @param {Array} array The array to inspect.
  25344. * @param {*} value The value to search for.
  25345. * @returns {number} Returns the index of the matched value, else `-1`.
  25346. * @example
  25347. *
  25348. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25349. * // => 1
  25350. */
  25351. function sortedIndexOf(array, value) {
  25352. var length = array == null ? 0 : array.length;
  25353. if (length) {
  25354. var index = baseSortedIndex(array, value);
  25355. if (index < length && eq(array[index], value)) {
  25356. return index;
  25357. }
  25358. }
  25359. return -1;
  25360. }
  25361. /**
  25362. * This method is like `_.sortedIndex` except that it returns the highest
  25363. * index at which `value` should be inserted into `array` in order to
  25364. * maintain its sort order.
  25365. *
  25366. * @static
  25367. * @memberOf _
  25368. * @since 3.0.0
  25369. * @category Array
  25370. * @param {Array} array The sorted array to inspect.
  25371. * @param {*} value The value to evaluate.
  25372. * @returns {number} Returns the index at which `value` should be inserted
  25373. * into `array`.
  25374. * @example
  25375. *
  25376. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25377. * // => 4
  25378. */
  25379. function sortedLastIndex(array, value) {
  25380. return baseSortedIndex(array, value, true);
  25381. }
  25382. /**
  25383. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25384. * which is invoked for `value` and each element of `array` to compute their
  25385. * sort ranking. The iteratee is invoked with one argument: (value).
  25386. *
  25387. * @static
  25388. * @memberOf _
  25389. * @since 4.0.0
  25390. * @category Array
  25391. * @param {Array} array The sorted array to inspect.
  25392. * @param {*} value The value to evaluate.
  25393. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25394. * @returns {number} Returns the index at which `value` should be inserted
  25395. * into `array`.
  25396. * @example
  25397. *
  25398. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25399. *
  25400. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25401. * // => 1
  25402. *
  25403. * // The `_.property` iteratee shorthand.
  25404. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25405. * // => 1
  25406. */
  25407. function sortedLastIndexBy(array, value, iteratee) {
  25408. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25409. }
  25410. /**
  25411. * This method is like `_.lastIndexOf` except that it performs a binary
  25412. * search on a sorted `array`.
  25413. *
  25414. * @static
  25415. * @memberOf _
  25416. * @since 4.0.0
  25417. * @category Array
  25418. * @param {Array} array The array to inspect.
  25419. * @param {*} value The value to search for.
  25420. * @returns {number} Returns the index of the matched value, else `-1`.
  25421. * @example
  25422. *
  25423. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25424. * // => 3
  25425. */
  25426. function sortedLastIndexOf(array, value) {
  25427. var length = array == null ? 0 : array.length;
  25428. if (length) {
  25429. var index = baseSortedIndex(array, value, true) - 1;
  25430. if (eq(array[index], value)) {
  25431. return index;
  25432. }
  25433. }
  25434. return -1;
  25435. }
  25436. /**
  25437. * This method is like `_.uniq` except that it's designed and optimized
  25438. * for sorted arrays.
  25439. *
  25440. * @static
  25441. * @memberOf _
  25442. * @since 4.0.0
  25443. * @category Array
  25444. * @param {Array} array The array to inspect.
  25445. * @returns {Array} Returns the new duplicate free array.
  25446. * @example
  25447. *
  25448. * _.sortedUniq([1, 1, 2]);
  25449. * // => [1, 2]
  25450. */
  25451. function sortedUniq(array) {
  25452. return (array && array.length)
  25453. ? baseSortedUniq(array)
  25454. : [];
  25455. }
  25456. /**
  25457. * This method is like `_.uniqBy` except that it's designed and optimized
  25458. * for sorted arrays.
  25459. *
  25460. * @static
  25461. * @memberOf _
  25462. * @since 4.0.0
  25463. * @category Array
  25464. * @param {Array} array The array to inspect.
  25465. * @param {Function} [iteratee] The iteratee invoked per element.
  25466. * @returns {Array} Returns the new duplicate free array.
  25467. * @example
  25468. *
  25469. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25470. * // => [1.1, 2.3]
  25471. */
  25472. function sortedUniqBy(array, iteratee) {
  25473. return (array && array.length)
  25474. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25475. : [];
  25476. }
  25477. /**
  25478. * Gets all but the first element of `array`.
  25479. *
  25480. * @static
  25481. * @memberOf _
  25482. * @since 4.0.0
  25483. * @category Array
  25484. * @param {Array} array The array to query.
  25485. * @returns {Array} Returns the slice of `array`.
  25486. * @example
  25487. *
  25488. * _.tail([1, 2, 3]);
  25489. * // => [2, 3]
  25490. */
  25491. function tail(array) {
  25492. var length = array == null ? 0 : array.length;
  25493. return length ? baseSlice(array, 1, length) : [];
  25494. }
  25495. /**
  25496. * Creates a slice of `array` with `n` elements taken from the beginning.
  25497. *
  25498. * @static
  25499. * @memberOf _
  25500. * @since 0.1.0
  25501. * @category Array
  25502. * @param {Array} array The array to query.
  25503. * @param {number} [n=1] The number of elements to take.
  25504. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25505. * @returns {Array} Returns the slice of `array`.
  25506. * @example
  25507. *
  25508. * _.take([1, 2, 3]);
  25509. * // => [1]
  25510. *
  25511. * _.take([1, 2, 3], 2);
  25512. * // => [1, 2]
  25513. *
  25514. * _.take([1, 2, 3], 5);
  25515. * // => [1, 2, 3]
  25516. *
  25517. * _.take([1, 2, 3], 0);
  25518. * // => []
  25519. */
  25520. function take(array, n, guard) {
  25521. if (!(array && array.length)) {
  25522. return [];
  25523. }
  25524. n = (guard || n === undefined) ? 1 : toInteger(n);
  25525. return baseSlice(array, 0, n < 0 ? 0 : n);
  25526. }
  25527. /**
  25528. * Creates a slice of `array` with `n` elements taken from the end.
  25529. *
  25530. * @static
  25531. * @memberOf _
  25532. * @since 3.0.0
  25533. * @category Array
  25534. * @param {Array} array The array to query.
  25535. * @param {number} [n=1] The number of elements to take.
  25536. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25537. * @returns {Array} Returns the slice of `array`.
  25538. * @example
  25539. *
  25540. * _.takeRight([1, 2, 3]);
  25541. * // => [3]
  25542. *
  25543. * _.takeRight([1, 2, 3], 2);
  25544. * // => [2, 3]
  25545. *
  25546. * _.takeRight([1, 2, 3], 5);
  25547. * // => [1, 2, 3]
  25548. *
  25549. * _.takeRight([1, 2, 3], 0);
  25550. * // => []
  25551. */
  25552. function takeRight(array, n, guard) {
  25553. var length = array == null ? 0 : array.length;
  25554. if (!length) {
  25555. return [];
  25556. }
  25557. n = (guard || n === undefined) ? 1 : toInteger(n);
  25558. n = length - n;
  25559. return baseSlice(array, n < 0 ? 0 : n, length);
  25560. }
  25561. /**
  25562. * Creates a slice of `array` with elements taken from the end. Elements are
  25563. * taken until `predicate` returns falsey. The predicate is invoked with
  25564. * three arguments: (value, index, array).
  25565. *
  25566. * @static
  25567. * @memberOf _
  25568. * @since 3.0.0
  25569. * @category Array
  25570. * @param {Array} array The array to query.
  25571. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25572. * @returns {Array} Returns the slice of `array`.
  25573. * @example
  25574. *
  25575. * var users = [
  25576. * { 'user': 'barney', 'active': true },
  25577. * { 'user': 'fred', 'active': false },
  25578. * { 'user': 'pebbles', 'active': false }
  25579. * ];
  25580. *
  25581. * _.takeRightWhile(users, function(o) { return !o.active; });
  25582. * // => objects for ['fred', 'pebbles']
  25583. *
  25584. * // The `_.matches` iteratee shorthand.
  25585. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25586. * // => objects for ['pebbles']
  25587. *
  25588. * // The `_.matchesProperty` iteratee shorthand.
  25589. * _.takeRightWhile(users, ['active', false]);
  25590. * // => objects for ['fred', 'pebbles']
  25591. *
  25592. * // The `_.property` iteratee shorthand.
  25593. * _.takeRightWhile(users, 'active');
  25594. * // => []
  25595. */
  25596. function takeRightWhile(array, predicate) {
  25597. return (array && array.length)
  25598. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25599. : [];
  25600. }
  25601. /**
  25602. * Creates a slice of `array` with elements taken from the beginning. Elements
  25603. * are taken until `predicate` returns falsey. The predicate is invoked with
  25604. * three arguments: (value, index, array).
  25605. *
  25606. * @static
  25607. * @memberOf _
  25608. * @since 3.0.0
  25609. * @category Array
  25610. * @param {Array} array The array to query.
  25611. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25612. * @returns {Array} Returns the slice of `array`.
  25613. * @example
  25614. *
  25615. * var users = [
  25616. * { 'user': 'barney', 'active': false },
  25617. * { 'user': 'fred', 'active': false },
  25618. * { 'user': 'pebbles', 'active': true }
  25619. * ];
  25620. *
  25621. * _.takeWhile(users, function(o) { return !o.active; });
  25622. * // => objects for ['barney', 'fred']
  25623. *
  25624. * // The `_.matches` iteratee shorthand.
  25625. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25626. * // => objects for ['barney']
  25627. *
  25628. * // The `_.matchesProperty` iteratee shorthand.
  25629. * _.takeWhile(users, ['active', false]);
  25630. * // => objects for ['barney', 'fred']
  25631. *
  25632. * // The `_.property` iteratee shorthand.
  25633. * _.takeWhile(users, 'active');
  25634. * // => []
  25635. */
  25636. function takeWhile(array, predicate) {
  25637. return (array && array.length)
  25638. ? baseWhile(array, getIteratee(predicate, 3))
  25639. : [];
  25640. }
  25641. /**
  25642. * Creates an array of unique values, in order, from all given arrays using
  25643. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25644. * for equality comparisons.
  25645. *
  25646. * @static
  25647. * @memberOf _
  25648. * @since 0.1.0
  25649. * @category Array
  25650. * @param {...Array} [arrays] The arrays to inspect.
  25651. * @returns {Array} Returns the new array of combined values.
  25652. * @example
  25653. *
  25654. * _.union([2], [1, 2]);
  25655. * // => [2, 1]
  25656. */
  25657. var union = baseRest(function(arrays) {
  25658. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25659. });
  25660. /**
  25661. * This method is like `_.union` except that it accepts `iteratee` which is
  25662. * invoked for each element of each `arrays` to generate the criterion by
  25663. * which uniqueness is computed. Result values are chosen from the first
  25664. * array in which the value occurs. The iteratee is invoked with one argument:
  25665. * (value).
  25666. *
  25667. * @static
  25668. * @memberOf _
  25669. * @since 4.0.0
  25670. * @category Array
  25671. * @param {...Array} [arrays] The arrays to inspect.
  25672. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25673. * @returns {Array} Returns the new array of combined values.
  25674. * @example
  25675. *
  25676. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25677. * // => [2.1, 1.2]
  25678. *
  25679. * // The `_.property` iteratee shorthand.
  25680. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25681. * // => [{ 'x': 1 }, { 'x': 2 }]
  25682. */
  25683. var unionBy = baseRest(function(arrays) {
  25684. var iteratee = last(arrays);
  25685. if (isArrayLikeObject(iteratee)) {
  25686. iteratee = undefined;
  25687. }
  25688. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25689. });
  25690. /**
  25691. * This method is like `_.union` except that it accepts `comparator` which
  25692. * is invoked to compare elements of `arrays`. Result values are chosen from
  25693. * the first array in which the value occurs. The comparator is invoked
  25694. * with two arguments: (arrVal, othVal).
  25695. *
  25696. * @static
  25697. * @memberOf _
  25698. * @since 4.0.0
  25699. * @category Array
  25700. * @param {...Array} [arrays] The arrays to inspect.
  25701. * @param {Function} [comparator] The comparator invoked per element.
  25702. * @returns {Array} Returns the new array of combined values.
  25703. * @example
  25704. *
  25705. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25706. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25707. *
  25708. * _.unionWith(objects, others, _.isEqual);
  25709. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25710. */
  25711. var unionWith = baseRest(function(arrays) {
  25712. var comparator = last(arrays);
  25713. comparator = typeof comparator == 'function' ? comparator : undefined;
  25714. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25715. });
  25716. /**
  25717. * Creates a duplicate-free version of an array, using
  25718. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25719. * for equality comparisons, in which only the first occurrence of each element
  25720. * is kept. The order of result values is determined by the order they occur
  25721. * in the array.
  25722. *
  25723. * @static
  25724. * @memberOf _
  25725. * @since 0.1.0
  25726. * @category Array
  25727. * @param {Array} array The array to inspect.
  25728. * @returns {Array} Returns the new duplicate free array.
  25729. * @example
  25730. *
  25731. * _.uniq([2, 1, 2]);
  25732. * // => [2, 1]
  25733. */
  25734. function uniq(array) {
  25735. return (array && array.length) ? baseUniq(array) : [];
  25736. }
  25737. /**
  25738. * This method is like `_.uniq` except that it accepts `iteratee` which is
  25739. * invoked for each element in `array` to generate the criterion by which
  25740. * uniqueness is computed. The order of result values is determined by the
  25741. * order they occur in the array. The iteratee is invoked with one argument:
  25742. * (value).
  25743. *
  25744. * @static
  25745. * @memberOf _
  25746. * @since 4.0.0
  25747. * @category Array
  25748. * @param {Array} array The array to inspect.
  25749. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25750. * @returns {Array} Returns the new duplicate free array.
  25751. * @example
  25752. *
  25753. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  25754. * // => [2.1, 1.2]
  25755. *
  25756. * // The `_.property` iteratee shorthand.
  25757. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  25758. * // => [{ 'x': 1 }, { 'x': 2 }]
  25759. */
  25760. function uniqBy(array, iteratee) {
  25761. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  25762. }
  25763. /**
  25764. * This method is like `_.uniq` except that it accepts `comparator` which
  25765. * is invoked to compare elements of `array`. The order of result values is
  25766. * determined by the order they occur in the array.The comparator is invoked
  25767. * with two arguments: (arrVal, othVal).
  25768. *
  25769. * @static
  25770. * @memberOf _
  25771. * @since 4.0.0
  25772. * @category Array
  25773. * @param {Array} array The array to inspect.
  25774. * @param {Function} [comparator] The comparator invoked per element.
  25775. * @returns {Array} Returns the new duplicate free array.
  25776. * @example
  25777. *
  25778. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25779. *
  25780. * _.uniqWith(objects, _.isEqual);
  25781. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  25782. */
  25783. function uniqWith(array, comparator) {
  25784. comparator = typeof comparator == 'function' ? comparator : undefined;
  25785. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  25786. }
  25787. /**
  25788. * This method is like `_.zip` except that it accepts an array of grouped
  25789. * elements and creates an array regrouping the elements to their pre-zip
  25790. * configuration.
  25791. *
  25792. * @static
  25793. * @memberOf _
  25794. * @since 1.2.0
  25795. * @category Array
  25796. * @param {Array} array The array of grouped elements to process.
  25797. * @returns {Array} Returns the new array of regrouped elements.
  25798. * @example
  25799. *
  25800. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  25801. * // => [['a', 1, true], ['b', 2, false]]
  25802. *
  25803. * _.unzip(zipped);
  25804. * // => [['a', 'b'], [1, 2], [true, false]]
  25805. */
  25806. function unzip(array) {
  25807. if (!(array && array.length)) {
  25808. return [];
  25809. }
  25810. var length = 0;
  25811. array = arrayFilter(array, function(group) {
  25812. if (isArrayLikeObject(group)) {
  25813. length = nativeMax(group.length, length);
  25814. return true;
  25815. }
  25816. });
  25817. return baseTimes(length, function(index) {
  25818. return arrayMap(array, baseProperty(index));
  25819. });
  25820. }
  25821. /**
  25822. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  25823. * how regrouped values should be combined. The iteratee is invoked with the
  25824. * elements of each group: (...group).
  25825. *
  25826. * @static
  25827. * @memberOf _
  25828. * @since 3.8.0
  25829. * @category Array
  25830. * @param {Array} array The array of grouped elements to process.
  25831. * @param {Function} [iteratee=_.identity] The function to combine
  25832. * regrouped values.
  25833. * @returns {Array} Returns the new array of regrouped elements.
  25834. * @example
  25835. *
  25836. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  25837. * // => [[1, 10, 100], [2, 20, 200]]
  25838. *
  25839. * _.unzipWith(zipped, _.add);
  25840. * // => [3, 30, 300]
  25841. */
  25842. function unzipWith(array, iteratee) {
  25843. if (!(array && array.length)) {
  25844. return [];
  25845. }
  25846. var result = unzip(array);
  25847. if (iteratee == null) {
  25848. return result;
  25849. }
  25850. return arrayMap(result, function(group) {
  25851. return apply(iteratee, undefined, group);
  25852. });
  25853. }
  25854. /**
  25855. * Creates an array excluding all given values using
  25856. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25857. * for equality comparisons.
  25858. *
  25859. * **Note:** Unlike `_.pull`, this method returns a new array.
  25860. *
  25861. * @static
  25862. * @memberOf _
  25863. * @since 0.1.0
  25864. * @category Array
  25865. * @param {Array} array The array to inspect.
  25866. * @param {...*} [values] The values to exclude.
  25867. * @returns {Array} Returns the new array of filtered values.
  25868. * @see _.difference, _.xor
  25869. * @example
  25870. *
  25871. * _.without([2, 1, 2, 3], 1, 2);
  25872. * // => [3]
  25873. */
  25874. var without = baseRest(function(array, values) {
  25875. return isArrayLikeObject(array)
  25876. ? baseDifference(array, values)
  25877. : [];
  25878. });
  25879. /**
  25880. * Creates an array of unique values that is the
  25881. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  25882. * of the given arrays. The order of result values is determined by the order
  25883. * they occur in the arrays.
  25884. *
  25885. * @static
  25886. * @memberOf _
  25887. * @since 2.4.0
  25888. * @category Array
  25889. * @param {...Array} [arrays] The arrays to inspect.
  25890. * @returns {Array} Returns the new array of filtered values.
  25891. * @see _.difference, _.without
  25892. * @example
  25893. *
  25894. * _.xor([2, 1], [2, 3]);
  25895. * // => [1, 3]
  25896. */
  25897. var xor = baseRest(function(arrays) {
  25898. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  25899. });
  25900. /**
  25901. * This method is like `_.xor` except that it accepts `iteratee` which is
  25902. * invoked for each element of each `arrays` to generate the criterion by
  25903. * which by which they're compared. The order of result values is determined
  25904. * by the order they occur in the arrays. The iteratee is invoked with one
  25905. * argument: (value).
  25906. *
  25907. * @static
  25908. * @memberOf _
  25909. * @since 4.0.0
  25910. * @category Array
  25911. * @param {...Array} [arrays] The arrays to inspect.
  25912. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25913. * @returns {Array} Returns the new array of filtered values.
  25914. * @example
  25915. *
  25916. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25917. * // => [1.2, 3.4]
  25918. *
  25919. * // The `_.property` iteratee shorthand.
  25920. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25921. * // => [{ 'x': 2 }]
  25922. */
  25923. var xorBy = baseRest(function(arrays) {
  25924. var iteratee = last(arrays);
  25925. if (isArrayLikeObject(iteratee)) {
  25926. iteratee = undefined;
  25927. }
  25928. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  25929. });
  25930. /**
  25931. * This method is like `_.xor` except that it accepts `comparator` which is
  25932. * invoked to compare elements of `arrays`. The order of result values is
  25933. * determined by the order they occur in the arrays. The comparator is invoked
  25934. * with two arguments: (arrVal, othVal).
  25935. *
  25936. * @static
  25937. * @memberOf _
  25938. * @since 4.0.0
  25939. * @category Array
  25940. * @param {...Array} [arrays] The arrays to inspect.
  25941. * @param {Function} [comparator] The comparator invoked per element.
  25942. * @returns {Array} Returns the new array of filtered values.
  25943. * @example
  25944. *
  25945. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25946. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25947. *
  25948. * _.xorWith(objects, others, _.isEqual);
  25949. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25950. */
  25951. var xorWith = baseRest(function(arrays) {
  25952. var comparator = last(arrays);
  25953. comparator = typeof comparator == 'function' ? comparator : undefined;
  25954. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  25955. });
  25956. /**
  25957. * Creates an array of grouped elements, the first of which contains the
  25958. * first elements of the given arrays, the second of which contains the
  25959. * second elements of the given arrays, and so on.
  25960. *
  25961. * @static
  25962. * @memberOf _
  25963. * @since 0.1.0
  25964. * @category Array
  25965. * @param {...Array} [arrays] The arrays to process.
  25966. * @returns {Array} Returns the new array of grouped elements.
  25967. * @example
  25968. *
  25969. * _.zip(['a', 'b'], [1, 2], [true, false]);
  25970. * // => [['a', 1, true], ['b', 2, false]]
  25971. */
  25972. var zip = baseRest(unzip);
  25973. /**
  25974. * This method is like `_.fromPairs` except that it accepts two arrays,
  25975. * one of property identifiers and one of corresponding values.
  25976. *
  25977. * @static
  25978. * @memberOf _
  25979. * @since 0.4.0
  25980. * @category Array
  25981. * @param {Array} [props=[]] The property identifiers.
  25982. * @param {Array} [values=[]] The property values.
  25983. * @returns {Object} Returns the new object.
  25984. * @example
  25985. *
  25986. * _.zipObject(['a', 'b'], [1, 2]);
  25987. * // => { 'a': 1, 'b': 2 }
  25988. */
  25989. function zipObject(props, values) {
  25990. return baseZipObject(props || [], values || [], assignValue);
  25991. }
  25992. /**
  25993. * This method is like `_.zipObject` except that it supports property paths.
  25994. *
  25995. * @static
  25996. * @memberOf _
  25997. * @since 4.1.0
  25998. * @category Array
  25999. * @param {Array} [props=[]] The property identifiers.
  26000. * @param {Array} [values=[]] The property values.
  26001. * @returns {Object} Returns the new object.
  26002. * @example
  26003. *
  26004. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26005. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26006. */
  26007. function zipObjectDeep(props, values) {
  26008. return baseZipObject(props || [], values || [], baseSet);
  26009. }
  26010. /**
  26011. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26012. * how grouped values should be combined. The iteratee is invoked with the
  26013. * elements of each group: (...group).
  26014. *
  26015. * @static
  26016. * @memberOf _
  26017. * @since 3.8.0
  26018. * @category Array
  26019. * @param {...Array} [arrays] The arrays to process.
  26020. * @param {Function} [iteratee=_.identity] The function to combine
  26021. * grouped values.
  26022. * @returns {Array} Returns the new array of grouped elements.
  26023. * @example
  26024. *
  26025. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26026. * return a + b + c;
  26027. * });
  26028. * // => [111, 222]
  26029. */
  26030. var zipWith = baseRest(function(arrays) {
  26031. var length = arrays.length,
  26032. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26033. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26034. return unzipWith(arrays, iteratee);
  26035. });
  26036. /*------------------------------------------------------------------------*/
  26037. /**
  26038. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26039. * chain sequences enabled. The result of such sequences must be unwrapped
  26040. * with `_#value`.
  26041. *
  26042. * @static
  26043. * @memberOf _
  26044. * @since 1.3.0
  26045. * @category Seq
  26046. * @param {*} value The value to wrap.
  26047. * @returns {Object} Returns the new `lodash` wrapper instance.
  26048. * @example
  26049. *
  26050. * var users = [
  26051. * { 'user': 'barney', 'age': 36 },
  26052. * { 'user': 'fred', 'age': 40 },
  26053. * { 'user': 'pebbles', 'age': 1 }
  26054. * ];
  26055. *
  26056. * var youngest = _
  26057. * .chain(users)
  26058. * .sortBy('age')
  26059. * .map(function(o) {
  26060. * return o.user + ' is ' + o.age;
  26061. * })
  26062. * .head()
  26063. * .value();
  26064. * // => 'pebbles is 1'
  26065. */
  26066. function chain(value) {
  26067. var result = lodash(value);
  26068. result.__chain__ = true;
  26069. return result;
  26070. }
  26071. /**
  26072. * This method invokes `interceptor` and returns `value`. The interceptor
  26073. * is invoked with one argument; (value). The purpose of this method is to
  26074. * "tap into" a method chain sequence in order to modify intermediate results.
  26075. *
  26076. * @static
  26077. * @memberOf _
  26078. * @since 0.1.0
  26079. * @category Seq
  26080. * @param {*} value The value to provide to `interceptor`.
  26081. * @param {Function} interceptor The function to invoke.
  26082. * @returns {*} Returns `value`.
  26083. * @example
  26084. *
  26085. * _([1, 2, 3])
  26086. * .tap(function(array) {
  26087. * // Mutate input array.
  26088. * array.pop();
  26089. * })
  26090. * .reverse()
  26091. * .value();
  26092. * // => [2, 1]
  26093. */
  26094. function tap(value, interceptor) {
  26095. interceptor(value);
  26096. return value;
  26097. }
  26098. /**
  26099. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26100. * The purpose of this method is to "pass thru" values replacing intermediate
  26101. * results in a method chain sequence.
  26102. *
  26103. * @static
  26104. * @memberOf _
  26105. * @since 3.0.0
  26106. * @category Seq
  26107. * @param {*} value The value to provide to `interceptor`.
  26108. * @param {Function} interceptor The function to invoke.
  26109. * @returns {*} Returns the result of `interceptor`.
  26110. * @example
  26111. *
  26112. * _(' abc ')
  26113. * .chain()
  26114. * .trim()
  26115. * .thru(function(value) {
  26116. * return [value];
  26117. * })
  26118. * .value();
  26119. * // => ['abc']
  26120. */
  26121. function thru(value, interceptor) {
  26122. return interceptor(value);
  26123. }
  26124. /**
  26125. * This method is the wrapper version of `_.at`.
  26126. *
  26127. * @name at
  26128. * @memberOf _
  26129. * @since 1.0.0
  26130. * @category Seq
  26131. * @param {...(string|string[])} [paths] The property paths to pick.
  26132. * @returns {Object} Returns the new `lodash` wrapper instance.
  26133. * @example
  26134. *
  26135. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26136. *
  26137. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26138. * // => [3, 4]
  26139. */
  26140. var wrapperAt = flatRest(function(paths) {
  26141. var length = paths.length,
  26142. start = length ? paths[0] : 0,
  26143. value = this.__wrapped__,
  26144. interceptor = function(object) { return baseAt(object, paths); };
  26145. if (length > 1 || this.__actions__.length ||
  26146. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26147. return this.thru(interceptor);
  26148. }
  26149. value = value.slice(start, +start + (length ? 1 : 0));
  26150. value.__actions__.push({
  26151. 'func': thru,
  26152. 'args': [interceptor],
  26153. 'thisArg': undefined
  26154. });
  26155. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26156. if (length && !array.length) {
  26157. array.push(undefined);
  26158. }
  26159. return array;
  26160. });
  26161. });
  26162. /**
  26163. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26164. *
  26165. * @name chain
  26166. * @memberOf _
  26167. * @since 0.1.0
  26168. * @category Seq
  26169. * @returns {Object} Returns the new `lodash` wrapper instance.
  26170. * @example
  26171. *
  26172. * var users = [
  26173. * { 'user': 'barney', 'age': 36 },
  26174. * { 'user': 'fred', 'age': 40 }
  26175. * ];
  26176. *
  26177. * // A sequence without explicit chaining.
  26178. * _(users).head();
  26179. * // => { 'user': 'barney', 'age': 36 }
  26180. *
  26181. * // A sequence with explicit chaining.
  26182. * _(users)
  26183. * .chain()
  26184. * .head()
  26185. * .pick('user')
  26186. * .value();
  26187. * // => { 'user': 'barney' }
  26188. */
  26189. function wrapperChain() {
  26190. return chain(this);
  26191. }
  26192. /**
  26193. * Executes the chain sequence and returns the wrapped result.
  26194. *
  26195. * @name commit
  26196. * @memberOf _
  26197. * @since 3.2.0
  26198. * @category Seq
  26199. * @returns {Object} Returns the new `lodash` wrapper instance.
  26200. * @example
  26201. *
  26202. * var array = [1, 2];
  26203. * var wrapped = _(array).push(3);
  26204. *
  26205. * console.log(array);
  26206. * // => [1, 2]
  26207. *
  26208. * wrapped = wrapped.commit();
  26209. * console.log(array);
  26210. * // => [1, 2, 3]
  26211. *
  26212. * wrapped.last();
  26213. * // => 3
  26214. *
  26215. * console.log(array);
  26216. * // => [1, 2, 3]
  26217. */
  26218. function wrapperCommit() {
  26219. return new LodashWrapper(this.value(), this.__chain__);
  26220. }
  26221. /**
  26222. * Gets the next value on a wrapped object following the
  26223. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26224. *
  26225. * @name next
  26226. * @memberOf _
  26227. * @since 4.0.0
  26228. * @category Seq
  26229. * @returns {Object} Returns the next iterator value.
  26230. * @example
  26231. *
  26232. * var wrapped = _([1, 2]);
  26233. *
  26234. * wrapped.next();
  26235. * // => { 'done': false, 'value': 1 }
  26236. *
  26237. * wrapped.next();
  26238. * // => { 'done': false, 'value': 2 }
  26239. *
  26240. * wrapped.next();
  26241. * // => { 'done': true, 'value': undefined }
  26242. */
  26243. function wrapperNext() {
  26244. if (this.__values__ === undefined) {
  26245. this.__values__ = toArray(this.value());
  26246. }
  26247. var done = this.__index__ >= this.__values__.length,
  26248. value = done ? undefined : this.__values__[this.__index__++];
  26249. return { 'done': done, 'value': value };
  26250. }
  26251. /**
  26252. * Enables the wrapper to be iterable.
  26253. *
  26254. * @name Symbol.iterator
  26255. * @memberOf _
  26256. * @since 4.0.0
  26257. * @category Seq
  26258. * @returns {Object} Returns the wrapper object.
  26259. * @example
  26260. *
  26261. * var wrapped = _([1, 2]);
  26262. *
  26263. * wrapped[Symbol.iterator]() === wrapped;
  26264. * // => true
  26265. *
  26266. * Array.from(wrapped);
  26267. * // => [1, 2]
  26268. */
  26269. function wrapperToIterator() {
  26270. return this;
  26271. }
  26272. /**
  26273. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26274. *
  26275. * @name plant
  26276. * @memberOf _
  26277. * @since 3.2.0
  26278. * @category Seq
  26279. * @param {*} value The value to plant.
  26280. * @returns {Object} Returns the new `lodash` wrapper instance.
  26281. * @example
  26282. *
  26283. * function square(n) {
  26284. * return n * n;
  26285. * }
  26286. *
  26287. * var wrapped = _([1, 2]).map(square);
  26288. * var other = wrapped.plant([3, 4]);
  26289. *
  26290. * other.value();
  26291. * // => [9, 16]
  26292. *
  26293. * wrapped.value();
  26294. * // => [1, 4]
  26295. */
  26296. function wrapperPlant(value) {
  26297. var result,
  26298. parent = this;
  26299. while (parent instanceof baseLodash) {
  26300. var clone = wrapperClone(parent);
  26301. clone.__index__ = 0;
  26302. clone.__values__ = undefined;
  26303. if (result) {
  26304. previous.__wrapped__ = clone;
  26305. } else {
  26306. result = clone;
  26307. }
  26308. var previous = clone;
  26309. parent = parent.__wrapped__;
  26310. }
  26311. previous.__wrapped__ = value;
  26312. return result;
  26313. }
  26314. /**
  26315. * This method is the wrapper version of `_.reverse`.
  26316. *
  26317. * **Note:** This method mutates the wrapped array.
  26318. *
  26319. * @name reverse
  26320. * @memberOf _
  26321. * @since 0.1.0
  26322. * @category Seq
  26323. * @returns {Object} Returns the new `lodash` wrapper instance.
  26324. * @example
  26325. *
  26326. * var array = [1, 2, 3];
  26327. *
  26328. * _(array).reverse().value()
  26329. * // => [3, 2, 1]
  26330. *
  26331. * console.log(array);
  26332. * // => [3, 2, 1]
  26333. */
  26334. function wrapperReverse() {
  26335. var value = this.__wrapped__;
  26336. if (value instanceof LazyWrapper) {
  26337. var wrapped = value;
  26338. if (this.__actions__.length) {
  26339. wrapped = new LazyWrapper(this);
  26340. }
  26341. wrapped = wrapped.reverse();
  26342. wrapped.__actions__.push({
  26343. 'func': thru,
  26344. 'args': [reverse],
  26345. 'thisArg': undefined
  26346. });
  26347. return new LodashWrapper(wrapped, this.__chain__);
  26348. }
  26349. return this.thru(reverse);
  26350. }
  26351. /**
  26352. * Executes the chain sequence to resolve the unwrapped value.
  26353. *
  26354. * @name value
  26355. * @memberOf _
  26356. * @since 0.1.0
  26357. * @alias toJSON, valueOf
  26358. * @category Seq
  26359. * @returns {*} Returns the resolved unwrapped value.
  26360. * @example
  26361. *
  26362. * _([1, 2, 3]).value();
  26363. * // => [1, 2, 3]
  26364. */
  26365. function wrapperValue() {
  26366. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26367. }
  26368. /*------------------------------------------------------------------------*/
  26369. /**
  26370. * Creates an object composed of keys generated from the results of running
  26371. * each element of `collection` thru `iteratee`. The corresponding value of
  26372. * each key is the number of times the key was returned by `iteratee`. The
  26373. * iteratee is invoked with one argument: (value).
  26374. *
  26375. * @static
  26376. * @memberOf _
  26377. * @since 0.5.0
  26378. * @category Collection
  26379. * @param {Array|Object} collection The collection to iterate over.
  26380. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26381. * @returns {Object} Returns the composed aggregate object.
  26382. * @example
  26383. *
  26384. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26385. * // => { '4': 1, '6': 2 }
  26386. *
  26387. * // The `_.property` iteratee shorthand.
  26388. * _.countBy(['one', 'two', 'three'], 'length');
  26389. * // => { '3': 2, '5': 1 }
  26390. */
  26391. var countBy = createAggregator(function(result, value, key) {
  26392. if (hasOwnProperty.call(result, key)) {
  26393. ++result[key];
  26394. } else {
  26395. baseAssignValue(result, key, 1);
  26396. }
  26397. });
  26398. /**
  26399. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26400. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26401. * invoked with three arguments: (value, index|key, collection).
  26402. *
  26403. * **Note:** This method returns `true` for
  26404. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26405. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26406. * elements of empty collections.
  26407. *
  26408. * @static
  26409. * @memberOf _
  26410. * @since 0.1.0
  26411. * @category Collection
  26412. * @param {Array|Object} collection The collection to iterate over.
  26413. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26414. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26415. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26416. * else `false`.
  26417. * @example
  26418. *
  26419. * _.every([true, 1, null, 'yes'], Boolean);
  26420. * // => false
  26421. *
  26422. * var users = [
  26423. * { 'user': 'barney', 'age': 36, 'active': false },
  26424. * { 'user': 'fred', 'age': 40, 'active': false }
  26425. * ];
  26426. *
  26427. * // The `_.matches` iteratee shorthand.
  26428. * _.every(users, { 'user': 'barney', 'active': false });
  26429. * // => false
  26430. *
  26431. * // The `_.matchesProperty` iteratee shorthand.
  26432. * _.every(users, ['active', false]);
  26433. * // => true
  26434. *
  26435. * // The `_.property` iteratee shorthand.
  26436. * _.every(users, 'active');
  26437. * // => false
  26438. */
  26439. function every(collection, predicate, guard) {
  26440. var func = isArray(collection) ? arrayEvery : baseEvery;
  26441. if (guard && isIterateeCall(collection, predicate, guard)) {
  26442. predicate = undefined;
  26443. }
  26444. return func(collection, getIteratee(predicate, 3));
  26445. }
  26446. /**
  26447. * Iterates over elements of `collection`, returning an array of all elements
  26448. * `predicate` returns truthy for. The predicate is invoked with three
  26449. * arguments: (value, index|key, collection).
  26450. *
  26451. * **Note:** Unlike `_.remove`, this method returns a new array.
  26452. *
  26453. * @static
  26454. * @memberOf _
  26455. * @since 0.1.0
  26456. * @category Collection
  26457. * @param {Array|Object} collection The collection to iterate over.
  26458. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26459. * @returns {Array} Returns the new filtered array.
  26460. * @see _.reject
  26461. * @example
  26462. *
  26463. * var users = [
  26464. * { 'user': 'barney', 'age': 36, 'active': true },
  26465. * { 'user': 'fred', 'age': 40, 'active': false }
  26466. * ];
  26467. *
  26468. * _.filter(users, function(o) { return !o.active; });
  26469. * // => objects for ['fred']
  26470. *
  26471. * // The `_.matches` iteratee shorthand.
  26472. * _.filter(users, { 'age': 36, 'active': true });
  26473. * // => objects for ['barney']
  26474. *
  26475. * // The `_.matchesProperty` iteratee shorthand.
  26476. * _.filter(users, ['active', false]);
  26477. * // => objects for ['fred']
  26478. *
  26479. * // The `_.property` iteratee shorthand.
  26480. * _.filter(users, 'active');
  26481. * // => objects for ['barney']
  26482. */
  26483. function filter(collection, predicate) {
  26484. var func = isArray(collection) ? arrayFilter : baseFilter;
  26485. return func(collection, getIteratee(predicate, 3));
  26486. }
  26487. /**
  26488. * Iterates over elements of `collection`, returning the first element
  26489. * `predicate` returns truthy for. The predicate is invoked with three
  26490. * arguments: (value, index|key, collection).
  26491. *
  26492. * @static
  26493. * @memberOf _
  26494. * @since 0.1.0
  26495. * @category Collection
  26496. * @param {Array|Object} collection The collection to inspect.
  26497. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26498. * @param {number} [fromIndex=0] The index to search from.
  26499. * @returns {*} Returns the matched element, else `undefined`.
  26500. * @example
  26501. *
  26502. * var users = [
  26503. * { 'user': 'barney', 'age': 36, 'active': true },
  26504. * { 'user': 'fred', 'age': 40, 'active': false },
  26505. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26506. * ];
  26507. *
  26508. * _.find(users, function(o) { return o.age < 40; });
  26509. * // => object for 'barney'
  26510. *
  26511. * // The `_.matches` iteratee shorthand.
  26512. * _.find(users, { 'age': 1, 'active': true });
  26513. * // => object for 'pebbles'
  26514. *
  26515. * // The `_.matchesProperty` iteratee shorthand.
  26516. * _.find(users, ['active', false]);
  26517. * // => object for 'fred'
  26518. *
  26519. * // The `_.property` iteratee shorthand.
  26520. * _.find(users, 'active');
  26521. * // => object for 'barney'
  26522. */
  26523. var find = createFind(findIndex);
  26524. /**
  26525. * This method is like `_.find` except that it iterates over elements of
  26526. * `collection` from right to left.
  26527. *
  26528. * @static
  26529. * @memberOf _
  26530. * @since 2.0.0
  26531. * @category Collection
  26532. * @param {Array|Object} collection The collection to inspect.
  26533. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26534. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26535. * @returns {*} Returns the matched element, else `undefined`.
  26536. * @example
  26537. *
  26538. * _.findLast([1, 2, 3, 4], function(n) {
  26539. * return n % 2 == 1;
  26540. * });
  26541. * // => 3
  26542. */
  26543. var findLast = createFind(findLastIndex);
  26544. /**
  26545. * Creates a flattened array of values by running each element in `collection`
  26546. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26547. * with three arguments: (value, index|key, collection).
  26548. *
  26549. * @static
  26550. * @memberOf _
  26551. * @since 4.0.0
  26552. * @category Collection
  26553. * @param {Array|Object} collection The collection to iterate over.
  26554. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26555. * @returns {Array} Returns the new flattened array.
  26556. * @example
  26557. *
  26558. * function duplicate(n) {
  26559. * return [n, n];
  26560. * }
  26561. *
  26562. * _.flatMap([1, 2], duplicate);
  26563. * // => [1, 1, 2, 2]
  26564. */
  26565. function flatMap(collection, iteratee) {
  26566. return baseFlatten(map(collection, iteratee), 1);
  26567. }
  26568. /**
  26569. * This method is like `_.flatMap` except that it recursively flattens the
  26570. * mapped results.
  26571. *
  26572. * @static
  26573. * @memberOf _
  26574. * @since 4.7.0
  26575. * @category Collection
  26576. * @param {Array|Object} collection The collection to iterate over.
  26577. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26578. * @returns {Array} Returns the new flattened array.
  26579. * @example
  26580. *
  26581. * function duplicate(n) {
  26582. * return [[[n, n]]];
  26583. * }
  26584. *
  26585. * _.flatMapDeep([1, 2], duplicate);
  26586. * // => [1, 1, 2, 2]
  26587. */
  26588. function flatMapDeep(collection, iteratee) {
  26589. return baseFlatten(map(collection, iteratee), INFINITY);
  26590. }
  26591. /**
  26592. * This method is like `_.flatMap` except that it recursively flattens the
  26593. * mapped results up to `depth` times.
  26594. *
  26595. * @static
  26596. * @memberOf _
  26597. * @since 4.7.0
  26598. * @category Collection
  26599. * @param {Array|Object} collection The collection to iterate over.
  26600. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26601. * @param {number} [depth=1] The maximum recursion depth.
  26602. * @returns {Array} Returns the new flattened array.
  26603. * @example
  26604. *
  26605. * function duplicate(n) {
  26606. * return [[[n, n]]];
  26607. * }
  26608. *
  26609. * _.flatMapDepth([1, 2], duplicate, 2);
  26610. * // => [[1, 1], [2, 2]]
  26611. */
  26612. function flatMapDepth(collection, iteratee, depth) {
  26613. depth = depth === undefined ? 1 : toInteger(depth);
  26614. return baseFlatten(map(collection, iteratee), depth);
  26615. }
  26616. /**
  26617. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26618. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26619. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26620. *
  26621. * **Note:** As with other "Collections" methods, objects with a "length"
  26622. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26623. * or `_.forOwn` for object iteration.
  26624. *
  26625. * @static
  26626. * @memberOf _
  26627. * @since 0.1.0
  26628. * @alias each
  26629. * @category Collection
  26630. * @param {Array|Object} collection The collection to iterate over.
  26631. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26632. * @returns {Array|Object} Returns `collection`.
  26633. * @see _.forEachRight
  26634. * @example
  26635. *
  26636. * _.forEach([1, 2], function(value) {
  26637. * console.log(value);
  26638. * });
  26639. * // => Logs `1` then `2`.
  26640. *
  26641. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26642. * console.log(key);
  26643. * });
  26644. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26645. */
  26646. function forEach(collection, iteratee) {
  26647. var func = isArray(collection) ? arrayEach : baseEach;
  26648. return func(collection, getIteratee(iteratee, 3));
  26649. }
  26650. /**
  26651. * This method is like `_.forEach` except that it iterates over elements of
  26652. * `collection` from right to left.
  26653. *
  26654. * @static
  26655. * @memberOf _
  26656. * @since 2.0.0
  26657. * @alias eachRight
  26658. * @category Collection
  26659. * @param {Array|Object} collection The collection to iterate over.
  26660. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26661. * @returns {Array|Object} Returns `collection`.
  26662. * @see _.forEach
  26663. * @example
  26664. *
  26665. * _.forEachRight([1, 2], function(value) {
  26666. * console.log(value);
  26667. * });
  26668. * // => Logs `2` then `1`.
  26669. */
  26670. function forEachRight(collection, iteratee) {
  26671. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26672. return func(collection, getIteratee(iteratee, 3));
  26673. }
  26674. /**
  26675. * Creates an object composed of keys generated from the results of running
  26676. * each element of `collection` thru `iteratee`. The order of grouped values
  26677. * is determined by the order they occur in `collection`. The corresponding
  26678. * value of each key is an array of elements responsible for generating the
  26679. * key. The iteratee is invoked with one argument: (value).
  26680. *
  26681. * @static
  26682. * @memberOf _
  26683. * @since 0.1.0
  26684. * @category Collection
  26685. * @param {Array|Object} collection The collection to iterate over.
  26686. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26687. * @returns {Object} Returns the composed aggregate object.
  26688. * @example
  26689. *
  26690. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26691. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26692. *
  26693. * // The `_.property` iteratee shorthand.
  26694. * _.groupBy(['one', 'two', 'three'], 'length');
  26695. * // => { '3': ['one', 'two'], '5': ['three'] }
  26696. */
  26697. var groupBy = createAggregator(function(result, value, key) {
  26698. if (hasOwnProperty.call(result, key)) {
  26699. result[key].push(value);
  26700. } else {
  26701. baseAssignValue(result, key, [value]);
  26702. }
  26703. });
  26704. /**
  26705. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26706. * checked for a substring of `value`, otherwise
  26707. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26708. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26709. * the offset from the end of `collection`.
  26710. *
  26711. * @static
  26712. * @memberOf _
  26713. * @since 0.1.0
  26714. * @category Collection
  26715. * @param {Array|Object|string} collection The collection to inspect.
  26716. * @param {*} value The value to search for.
  26717. * @param {number} [fromIndex=0] The index to search from.
  26718. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26719. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26720. * @example
  26721. *
  26722. * _.includes([1, 2, 3], 1);
  26723. * // => true
  26724. *
  26725. * _.includes([1, 2, 3], 1, 2);
  26726. * // => false
  26727. *
  26728. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26729. * // => true
  26730. *
  26731. * _.includes('abcd', 'bc');
  26732. * // => true
  26733. */
  26734. function includes(collection, value, fromIndex, guard) {
  26735. collection = isArrayLike(collection) ? collection : values(collection);
  26736. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  26737. var length = collection.length;
  26738. if (fromIndex < 0) {
  26739. fromIndex = nativeMax(length + fromIndex, 0);
  26740. }
  26741. return isString(collection)
  26742. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  26743. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  26744. }
  26745. /**
  26746. * Invokes the method at `path` of each element in `collection`, returning
  26747. * an array of the results of each invoked method. Any additional arguments
  26748. * are provided to each invoked method. If `path` is a function, it's invoked
  26749. * for, and `this` bound to, each element in `collection`.
  26750. *
  26751. * @static
  26752. * @memberOf _
  26753. * @since 4.0.0
  26754. * @category Collection
  26755. * @param {Array|Object} collection The collection to iterate over.
  26756. * @param {Array|Function|string} path The path of the method to invoke or
  26757. * the function invoked per iteration.
  26758. * @param {...*} [args] The arguments to invoke each method with.
  26759. * @returns {Array} Returns the array of results.
  26760. * @example
  26761. *
  26762. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  26763. * // => [[1, 5, 7], [1, 2, 3]]
  26764. *
  26765. * _.invokeMap([123, 456], String.prototype.split, '');
  26766. * // => [['1', '2', '3'], ['4', '5', '6']]
  26767. */
  26768. var invokeMap = baseRest(function(collection, path, args) {
  26769. var index = -1,
  26770. isFunc = typeof path == 'function',
  26771. result = isArrayLike(collection) ? Array(collection.length) : [];
  26772. baseEach(collection, function(value) {
  26773. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  26774. });
  26775. return result;
  26776. });
  26777. /**
  26778. * Creates an object composed of keys generated from the results of running
  26779. * each element of `collection` thru `iteratee`. The corresponding value of
  26780. * each key is the last element responsible for generating the key. The
  26781. * iteratee is invoked with one argument: (value).
  26782. *
  26783. * @static
  26784. * @memberOf _
  26785. * @since 4.0.0
  26786. * @category Collection
  26787. * @param {Array|Object} collection The collection to iterate over.
  26788. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26789. * @returns {Object} Returns the composed aggregate object.
  26790. * @example
  26791. *
  26792. * var array = [
  26793. * { 'dir': 'left', 'code': 97 },
  26794. * { 'dir': 'right', 'code': 100 }
  26795. * ];
  26796. *
  26797. * _.keyBy(array, function(o) {
  26798. * return String.fromCharCode(o.code);
  26799. * });
  26800. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  26801. *
  26802. * _.keyBy(array, 'dir');
  26803. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  26804. */
  26805. var keyBy = createAggregator(function(result, value, key) {
  26806. baseAssignValue(result, key, value);
  26807. });
  26808. /**
  26809. * Creates an array of values by running each element in `collection` thru
  26810. * `iteratee`. The iteratee is invoked with three arguments:
  26811. * (value, index|key, collection).
  26812. *
  26813. * Many lodash methods are guarded to work as iteratees for methods like
  26814. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  26815. *
  26816. * The guarded methods are:
  26817. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  26818. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  26819. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  26820. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  26821. *
  26822. * @static
  26823. * @memberOf _
  26824. * @since 0.1.0
  26825. * @category Collection
  26826. * @param {Array|Object} collection The collection to iterate over.
  26827. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26828. * @returns {Array} Returns the new mapped array.
  26829. * @example
  26830. *
  26831. * function square(n) {
  26832. * return n * n;
  26833. * }
  26834. *
  26835. * _.map([4, 8], square);
  26836. * // => [16, 64]
  26837. *
  26838. * _.map({ 'a': 4, 'b': 8 }, square);
  26839. * // => [16, 64] (iteration order is not guaranteed)
  26840. *
  26841. * var users = [
  26842. * { 'user': 'barney' },
  26843. * { 'user': 'fred' }
  26844. * ];
  26845. *
  26846. * // The `_.property` iteratee shorthand.
  26847. * _.map(users, 'user');
  26848. * // => ['barney', 'fred']
  26849. */
  26850. function map(collection, iteratee) {
  26851. var func = isArray(collection) ? arrayMap : baseMap;
  26852. return func(collection, getIteratee(iteratee, 3));
  26853. }
  26854. /**
  26855. * This method is like `_.sortBy` except that it allows specifying the sort
  26856. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  26857. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  26858. * descending or "asc" for ascending sort order of corresponding values.
  26859. *
  26860. * @static
  26861. * @memberOf _
  26862. * @since 4.0.0
  26863. * @category Collection
  26864. * @param {Array|Object} collection The collection to iterate over.
  26865. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  26866. * The iteratees to sort by.
  26867. * @param {string[]} [orders] The sort orders of `iteratees`.
  26868. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26869. * @returns {Array} Returns the new sorted array.
  26870. * @example
  26871. *
  26872. * var users = [
  26873. * { 'user': 'fred', 'age': 48 },
  26874. * { 'user': 'barney', 'age': 34 },
  26875. * { 'user': 'fred', 'age': 40 },
  26876. * { 'user': 'barney', 'age': 36 }
  26877. * ];
  26878. *
  26879. * // Sort by `user` in ascending order and by `age` in descending order.
  26880. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  26881. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  26882. */
  26883. function orderBy(collection, iteratees, orders, guard) {
  26884. if (collection == null) {
  26885. return [];
  26886. }
  26887. if (!isArray(iteratees)) {
  26888. iteratees = iteratees == null ? [] : [iteratees];
  26889. }
  26890. orders = guard ? undefined : orders;
  26891. if (!isArray(orders)) {
  26892. orders = orders == null ? [] : [orders];
  26893. }
  26894. return baseOrderBy(collection, iteratees, orders);
  26895. }
  26896. /**
  26897. * Creates an array of elements split into two groups, the first of which
  26898. * contains elements `predicate` returns truthy for, the second of which
  26899. * contains elements `predicate` returns falsey for. The predicate is
  26900. * invoked with one argument: (value).
  26901. *
  26902. * @static
  26903. * @memberOf _
  26904. * @since 3.0.0
  26905. * @category Collection
  26906. * @param {Array|Object} collection The collection to iterate over.
  26907. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26908. * @returns {Array} Returns the array of grouped elements.
  26909. * @example
  26910. *
  26911. * var users = [
  26912. * { 'user': 'barney', 'age': 36, 'active': false },
  26913. * { 'user': 'fred', 'age': 40, 'active': true },
  26914. * { 'user': 'pebbles', 'age': 1, 'active': false }
  26915. * ];
  26916. *
  26917. * _.partition(users, function(o) { return o.active; });
  26918. * // => objects for [['fred'], ['barney', 'pebbles']]
  26919. *
  26920. * // The `_.matches` iteratee shorthand.
  26921. * _.partition(users, { 'age': 1, 'active': false });
  26922. * // => objects for [['pebbles'], ['barney', 'fred']]
  26923. *
  26924. * // The `_.matchesProperty` iteratee shorthand.
  26925. * _.partition(users, ['active', false]);
  26926. * // => objects for [['barney', 'pebbles'], ['fred']]
  26927. *
  26928. * // The `_.property` iteratee shorthand.
  26929. * _.partition(users, 'active');
  26930. * // => objects for [['fred'], ['barney', 'pebbles']]
  26931. */
  26932. var partition = createAggregator(function(result, value, key) {
  26933. result[key ? 0 : 1].push(value);
  26934. }, function() { return [[], []]; });
  26935. /**
  26936. * Reduces `collection` to a value which is the accumulated result of running
  26937. * each element in `collection` thru `iteratee`, where each successive
  26938. * invocation is supplied the return value of the previous. If `accumulator`
  26939. * is not given, the first element of `collection` is used as the initial
  26940. * value. The iteratee is invoked with four arguments:
  26941. * (accumulator, value, index|key, collection).
  26942. *
  26943. * Many lodash methods are guarded to work as iteratees for methods like
  26944. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  26945. *
  26946. * The guarded methods are:
  26947. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  26948. * and `sortBy`
  26949. *
  26950. * @static
  26951. * @memberOf _
  26952. * @since 0.1.0
  26953. * @category Collection
  26954. * @param {Array|Object} collection The collection to iterate over.
  26955. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26956. * @param {*} [accumulator] The initial value.
  26957. * @returns {*} Returns the accumulated value.
  26958. * @see _.reduceRight
  26959. * @example
  26960. *
  26961. * _.reduce([1, 2], function(sum, n) {
  26962. * return sum + n;
  26963. * }, 0);
  26964. * // => 3
  26965. *
  26966. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26967. * (result[value] || (result[value] = [])).push(key);
  26968. * return result;
  26969. * }, {});
  26970. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  26971. */
  26972. function reduce(collection, iteratee, accumulator) {
  26973. var func = isArray(collection) ? arrayReduce : baseReduce,
  26974. initAccum = arguments.length < 3;
  26975. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  26976. }
  26977. /**
  26978. * This method is like `_.reduce` except that it iterates over elements of
  26979. * `collection` from right to left.
  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 function invoked per iteration.
  26987. * @param {*} [accumulator] The initial value.
  26988. * @returns {*} Returns the accumulated value.
  26989. * @see _.reduce
  26990. * @example
  26991. *
  26992. * var array = [[0, 1], [2, 3], [4, 5]];
  26993. *
  26994. * _.reduceRight(array, function(flattened, other) {
  26995. * return flattened.concat(other);
  26996. * }, []);
  26997. * // => [4, 5, 2, 3, 0, 1]
  26998. */
  26999. function reduceRight(collection, iteratee, accumulator) {
  27000. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27001. initAccum = arguments.length < 3;
  27002. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27003. }
  27004. /**
  27005. * The opposite of `_.filter`; this method returns the elements of `collection`
  27006. * that `predicate` does **not** return truthy for.
  27007. *
  27008. * @static
  27009. * @memberOf _
  27010. * @since 0.1.0
  27011. * @category Collection
  27012. * @param {Array|Object} collection The collection to iterate over.
  27013. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27014. * @returns {Array} Returns the new filtered array.
  27015. * @see _.filter
  27016. * @example
  27017. *
  27018. * var users = [
  27019. * { 'user': 'barney', 'age': 36, 'active': false },
  27020. * { 'user': 'fred', 'age': 40, 'active': true }
  27021. * ];
  27022. *
  27023. * _.reject(users, function(o) { return !o.active; });
  27024. * // => objects for ['fred']
  27025. *
  27026. * // The `_.matches` iteratee shorthand.
  27027. * _.reject(users, { 'age': 40, 'active': true });
  27028. * // => objects for ['barney']
  27029. *
  27030. * // The `_.matchesProperty` iteratee shorthand.
  27031. * _.reject(users, ['active', false]);
  27032. * // => objects for ['fred']
  27033. *
  27034. * // The `_.property` iteratee shorthand.
  27035. * _.reject(users, 'active');
  27036. * // => objects for ['barney']
  27037. */
  27038. function reject(collection, predicate) {
  27039. var func = isArray(collection) ? arrayFilter : baseFilter;
  27040. return func(collection, negate(getIteratee(predicate, 3)));
  27041. }
  27042. /**
  27043. * Gets a random element from `collection`.
  27044. *
  27045. * @static
  27046. * @memberOf _
  27047. * @since 2.0.0
  27048. * @category Collection
  27049. * @param {Array|Object} collection The collection to sample.
  27050. * @returns {*} Returns the random element.
  27051. * @example
  27052. *
  27053. * _.sample([1, 2, 3, 4]);
  27054. * // => 2
  27055. */
  27056. function sample(collection) {
  27057. var func = isArray(collection) ? arraySample : baseSample;
  27058. return func(collection);
  27059. }
  27060. /**
  27061. * Gets `n` random elements at unique keys from `collection` up to the
  27062. * size of `collection`.
  27063. *
  27064. * @static
  27065. * @memberOf _
  27066. * @since 4.0.0
  27067. * @category Collection
  27068. * @param {Array|Object} collection The collection to sample.
  27069. * @param {number} [n=1] The number of elements to sample.
  27070. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27071. * @returns {Array} Returns the random elements.
  27072. * @example
  27073. *
  27074. * _.sampleSize([1, 2, 3], 2);
  27075. * // => [3, 1]
  27076. *
  27077. * _.sampleSize([1, 2, 3], 4);
  27078. * // => [2, 3, 1]
  27079. */
  27080. function sampleSize(collection, n, guard) {
  27081. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27082. n = 1;
  27083. } else {
  27084. n = toInteger(n);
  27085. }
  27086. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27087. return func(collection, n);
  27088. }
  27089. /**
  27090. * Creates an array of shuffled values, using a version of the
  27091. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27092. *
  27093. * @static
  27094. * @memberOf _
  27095. * @since 0.1.0
  27096. * @category Collection
  27097. * @param {Array|Object} collection The collection to shuffle.
  27098. * @returns {Array} Returns the new shuffled array.
  27099. * @example
  27100. *
  27101. * _.shuffle([1, 2, 3, 4]);
  27102. * // => [4, 1, 3, 2]
  27103. */
  27104. function shuffle(collection) {
  27105. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27106. return func(collection);
  27107. }
  27108. /**
  27109. * Gets the size of `collection` by returning its length for array-like
  27110. * values or the number of own enumerable string keyed properties for objects.
  27111. *
  27112. * @static
  27113. * @memberOf _
  27114. * @since 0.1.0
  27115. * @category Collection
  27116. * @param {Array|Object|string} collection The collection to inspect.
  27117. * @returns {number} Returns the collection size.
  27118. * @example
  27119. *
  27120. * _.size([1, 2, 3]);
  27121. * // => 3
  27122. *
  27123. * _.size({ 'a': 1, 'b': 2 });
  27124. * // => 2
  27125. *
  27126. * _.size('pebbles');
  27127. * // => 7
  27128. */
  27129. function size(collection) {
  27130. if (collection == null) {
  27131. return 0;
  27132. }
  27133. if (isArrayLike(collection)) {
  27134. return isString(collection) ? stringSize(collection) : collection.length;
  27135. }
  27136. var tag = getTag(collection);
  27137. if (tag == mapTag || tag == setTag) {
  27138. return collection.size;
  27139. }
  27140. return baseKeys(collection).length;
  27141. }
  27142. /**
  27143. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27144. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27145. * invoked with three arguments: (value, index|key, collection).
  27146. *
  27147. * @static
  27148. * @memberOf _
  27149. * @since 0.1.0
  27150. * @category Collection
  27151. * @param {Array|Object} collection The collection to iterate over.
  27152. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27153. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27154. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27155. * else `false`.
  27156. * @example
  27157. *
  27158. * _.some([null, 0, 'yes', false], Boolean);
  27159. * // => true
  27160. *
  27161. * var users = [
  27162. * { 'user': 'barney', 'active': true },
  27163. * { 'user': 'fred', 'active': false }
  27164. * ];
  27165. *
  27166. * // The `_.matches` iteratee shorthand.
  27167. * _.some(users, { 'user': 'barney', 'active': false });
  27168. * // => false
  27169. *
  27170. * // The `_.matchesProperty` iteratee shorthand.
  27171. * _.some(users, ['active', false]);
  27172. * // => true
  27173. *
  27174. * // The `_.property` iteratee shorthand.
  27175. * _.some(users, 'active');
  27176. * // => true
  27177. */
  27178. function some(collection, predicate, guard) {
  27179. var func = isArray(collection) ? arraySome : baseSome;
  27180. if (guard && isIterateeCall(collection, predicate, guard)) {
  27181. predicate = undefined;
  27182. }
  27183. return func(collection, getIteratee(predicate, 3));
  27184. }
  27185. /**
  27186. * Creates an array of elements, sorted in ascending order by the results of
  27187. * running each element in a collection thru each iteratee. This method
  27188. * performs a stable sort, that is, it preserves the original sort order of
  27189. * equal elements. The iteratees are invoked with one argument: (value).
  27190. *
  27191. * @static
  27192. * @memberOf _
  27193. * @since 0.1.0
  27194. * @category Collection
  27195. * @param {Array|Object} collection The collection to iterate over.
  27196. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27197. * The iteratees to sort by.
  27198. * @returns {Array} Returns the new sorted array.
  27199. * @example
  27200. *
  27201. * var users = [
  27202. * { 'user': 'fred', 'age': 48 },
  27203. * { 'user': 'barney', 'age': 36 },
  27204. * { 'user': 'fred', 'age': 40 },
  27205. * { 'user': 'barney', 'age': 34 }
  27206. * ];
  27207. *
  27208. * _.sortBy(users, [function(o) { return o.user; }]);
  27209. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27210. *
  27211. * _.sortBy(users, ['user', 'age']);
  27212. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27213. */
  27214. var sortBy = baseRest(function(collection, iteratees) {
  27215. if (collection == null) {
  27216. return [];
  27217. }
  27218. var length = iteratees.length;
  27219. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27220. iteratees = [];
  27221. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27222. iteratees = [iteratees[0]];
  27223. }
  27224. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27225. });
  27226. /*------------------------------------------------------------------------*/
  27227. /**
  27228. * Gets the timestamp of the number of milliseconds that have elapsed since
  27229. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27230. *
  27231. * @static
  27232. * @memberOf _
  27233. * @since 2.4.0
  27234. * @category Date
  27235. * @returns {number} Returns the timestamp.
  27236. * @example
  27237. *
  27238. * _.defer(function(stamp) {
  27239. * console.log(_.now() - stamp);
  27240. * }, _.now());
  27241. * // => Logs the number of milliseconds it took for the deferred invocation.
  27242. */
  27243. var now = ctxNow || function() {
  27244. return root.Date.now();
  27245. };
  27246. /*------------------------------------------------------------------------*/
  27247. /**
  27248. * The opposite of `_.before`; this method creates a function that invokes
  27249. * `func` once it's called `n` or more times.
  27250. *
  27251. * @static
  27252. * @memberOf _
  27253. * @since 0.1.0
  27254. * @category Function
  27255. * @param {number} n The number of calls before `func` is invoked.
  27256. * @param {Function} func The function to restrict.
  27257. * @returns {Function} Returns the new restricted function.
  27258. * @example
  27259. *
  27260. * var saves = ['profile', 'settings'];
  27261. *
  27262. * var done = _.after(saves.length, function() {
  27263. * console.log('done saving!');
  27264. * });
  27265. *
  27266. * _.forEach(saves, function(type) {
  27267. * asyncSave({ 'type': type, 'complete': done });
  27268. * });
  27269. * // => Logs 'done saving!' after the two async saves have completed.
  27270. */
  27271. function after(n, func) {
  27272. if (typeof func != 'function') {
  27273. throw new TypeError(FUNC_ERROR_TEXT);
  27274. }
  27275. n = toInteger(n);
  27276. return function() {
  27277. if (--n < 1) {
  27278. return func.apply(this, arguments);
  27279. }
  27280. };
  27281. }
  27282. /**
  27283. * Creates a function that invokes `func`, with up to `n` arguments,
  27284. * ignoring any additional arguments.
  27285. *
  27286. * @static
  27287. * @memberOf _
  27288. * @since 3.0.0
  27289. * @category Function
  27290. * @param {Function} func The function to cap arguments for.
  27291. * @param {number} [n=func.length] The arity cap.
  27292. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27293. * @returns {Function} Returns the new capped function.
  27294. * @example
  27295. *
  27296. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27297. * // => [6, 8, 10]
  27298. */
  27299. function ary(func, n, guard) {
  27300. n = guard ? undefined : n;
  27301. n = (func && n == null) ? func.length : n;
  27302. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27303. }
  27304. /**
  27305. * Creates a function that invokes `func`, with the `this` binding and arguments
  27306. * of the created function, while it's called less than `n` times. Subsequent
  27307. * calls to the created function return the result of the last `func` invocation.
  27308. *
  27309. * @static
  27310. * @memberOf _
  27311. * @since 3.0.0
  27312. * @category Function
  27313. * @param {number} n The number of calls at which `func` is no longer invoked.
  27314. * @param {Function} func The function to restrict.
  27315. * @returns {Function} Returns the new restricted function.
  27316. * @example
  27317. *
  27318. * jQuery(element).on('click', _.before(5, addContactToList));
  27319. * // => Allows adding up to 4 contacts to the list.
  27320. */
  27321. function before(n, func) {
  27322. var result;
  27323. if (typeof func != 'function') {
  27324. throw new TypeError(FUNC_ERROR_TEXT);
  27325. }
  27326. n = toInteger(n);
  27327. return function() {
  27328. if (--n > 0) {
  27329. result = func.apply(this, arguments);
  27330. }
  27331. if (n <= 1) {
  27332. func = undefined;
  27333. }
  27334. return result;
  27335. };
  27336. }
  27337. /**
  27338. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27339. * and `partials` prepended to the arguments it receives.
  27340. *
  27341. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27342. * may be used as a placeholder for partially applied arguments.
  27343. *
  27344. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27345. * property of bound functions.
  27346. *
  27347. * @static
  27348. * @memberOf _
  27349. * @since 0.1.0
  27350. * @category Function
  27351. * @param {Function} func The function to bind.
  27352. * @param {*} thisArg The `this` binding of `func`.
  27353. * @param {...*} [partials] The arguments to be partially applied.
  27354. * @returns {Function} Returns the new bound function.
  27355. * @example
  27356. *
  27357. * function greet(greeting, punctuation) {
  27358. * return greeting + ' ' + this.user + punctuation;
  27359. * }
  27360. *
  27361. * var object = { 'user': 'fred' };
  27362. *
  27363. * var bound = _.bind(greet, object, 'hi');
  27364. * bound('!');
  27365. * // => 'hi fred!'
  27366. *
  27367. * // Bound with placeholders.
  27368. * var bound = _.bind(greet, object, _, '!');
  27369. * bound('hi');
  27370. * // => 'hi fred!'
  27371. */
  27372. var bind = baseRest(function(func, thisArg, partials) {
  27373. var bitmask = WRAP_BIND_FLAG;
  27374. if (partials.length) {
  27375. var holders = replaceHolders(partials, getHolder(bind));
  27376. bitmask |= WRAP_PARTIAL_FLAG;
  27377. }
  27378. return createWrap(func, bitmask, thisArg, partials, holders);
  27379. });
  27380. /**
  27381. * Creates a function that invokes the method at `object[key]` with `partials`
  27382. * prepended to the arguments it receives.
  27383. *
  27384. * This method differs from `_.bind` by allowing bound functions to reference
  27385. * methods that may be redefined or don't yet exist. See
  27386. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27387. * for more details.
  27388. *
  27389. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27390. * builds, may be used as a placeholder for partially applied arguments.
  27391. *
  27392. * @static
  27393. * @memberOf _
  27394. * @since 0.10.0
  27395. * @category Function
  27396. * @param {Object} object The object to invoke the method on.
  27397. * @param {string} key The key of the method.
  27398. * @param {...*} [partials] The arguments to be partially applied.
  27399. * @returns {Function} Returns the new bound function.
  27400. * @example
  27401. *
  27402. * var object = {
  27403. * 'user': 'fred',
  27404. * 'greet': function(greeting, punctuation) {
  27405. * return greeting + ' ' + this.user + punctuation;
  27406. * }
  27407. * };
  27408. *
  27409. * var bound = _.bindKey(object, 'greet', 'hi');
  27410. * bound('!');
  27411. * // => 'hi fred!'
  27412. *
  27413. * object.greet = function(greeting, punctuation) {
  27414. * return greeting + 'ya ' + this.user + punctuation;
  27415. * };
  27416. *
  27417. * bound('!');
  27418. * // => 'hiya fred!'
  27419. *
  27420. * // Bound with placeholders.
  27421. * var bound = _.bindKey(object, 'greet', _, '!');
  27422. * bound('hi');
  27423. * // => 'hiya fred!'
  27424. */
  27425. var bindKey = baseRest(function(object, key, partials) {
  27426. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27427. if (partials.length) {
  27428. var holders = replaceHolders(partials, getHolder(bindKey));
  27429. bitmask |= WRAP_PARTIAL_FLAG;
  27430. }
  27431. return createWrap(key, bitmask, object, partials, holders);
  27432. });
  27433. /**
  27434. * Creates a function that accepts arguments of `func` and either invokes
  27435. * `func` returning its result, if at least `arity` number of arguments have
  27436. * been provided, or returns a function that accepts the remaining `func`
  27437. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27438. * is not sufficient.
  27439. *
  27440. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27441. * may be used as a placeholder for provided arguments.
  27442. *
  27443. * **Note:** This method doesn't set the "length" property of curried functions.
  27444. *
  27445. * @static
  27446. * @memberOf _
  27447. * @since 2.0.0
  27448. * @category Function
  27449. * @param {Function} func The function to curry.
  27450. * @param {number} [arity=func.length] The arity of `func`.
  27451. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27452. * @returns {Function} Returns the new curried function.
  27453. * @example
  27454. *
  27455. * var abc = function(a, b, c) {
  27456. * return [a, b, c];
  27457. * };
  27458. *
  27459. * var curried = _.curry(abc);
  27460. *
  27461. * curried(1)(2)(3);
  27462. * // => [1, 2, 3]
  27463. *
  27464. * curried(1, 2)(3);
  27465. * // => [1, 2, 3]
  27466. *
  27467. * curried(1, 2, 3);
  27468. * // => [1, 2, 3]
  27469. *
  27470. * // Curried with placeholders.
  27471. * curried(1)(_, 3)(2);
  27472. * // => [1, 2, 3]
  27473. */
  27474. function curry(func, arity, guard) {
  27475. arity = guard ? undefined : arity;
  27476. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27477. result.placeholder = curry.placeholder;
  27478. return result;
  27479. }
  27480. /**
  27481. * This method is like `_.curry` except that arguments are applied to `func`
  27482. * in the manner of `_.partialRight` instead of `_.partial`.
  27483. *
  27484. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27485. * builds, may be used as a placeholder for provided arguments.
  27486. *
  27487. * **Note:** This method doesn't set the "length" property of curried functions.
  27488. *
  27489. * @static
  27490. * @memberOf _
  27491. * @since 3.0.0
  27492. * @category Function
  27493. * @param {Function} func The function to curry.
  27494. * @param {number} [arity=func.length] The arity of `func`.
  27495. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27496. * @returns {Function} Returns the new curried function.
  27497. * @example
  27498. *
  27499. * var abc = function(a, b, c) {
  27500. * return [a, b, c];
  27501. * };
  27502. *
  27503. * var curried = _.curryRight(abc);
  27504. *
  27505. * curried(3)(2)(1);
  27506. * // => [1, 2, 3]
  27507. *
  27508. * curried(2, 3)(1);
  27509. * // => [1, 2, 3]
  27510. *
  27511. * curried(1, 2, 3);
  27512. * // => [1, 2, 3]
  27513. *
  27514. * // Curried with placeholders.
  27515. * curried(3)(1, _)(2);
  27516. * // => [1, 2, 3]
  27517. */
  27518. function curryRight(func, arity, guard) {
  27519. arity = guard ? undefined : arity;
  27520. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27521. result.placeholder = curryRight.placeholder;
  27522. return result;
  27523. }
  27524. /**
  27525. * Creates a debounced function that delays invoking `func` until after `wait`
  27526. * milliseconds have elapsed since the last time the debounced function was
  27527. * invoked. The debounced function comes with a `cancel` method to cancel
  27528. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27529. * Provide `options` to indicate whether `func` should be invoked on the
  27530. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27531. * with the last arguments provided to the debounced function. Subsequent
  27532. * calls to the debounced function return the result of the last `func`
  27533. * invocation.
  27534. *
  27535. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27536. * invoked on the trailing edge of the timeout only if the debounced function
  27537. * is invoked more than once during the `wait` timeout.
  27538. *
  27539. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27540. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27541. *
  27542. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27543. * for details over the differences between `_.debounce` and `_.throttle`.
  27544. *
  27545. * @static
  27546. * @memberOf _
  27547. * @since 0.1.0
  27548. * @category Function
  27549. * @param {Function} func The function to debounce.
  27550. * @param {number} [wait=0] The number of milliseconds to delay.
  27551. * @param {Object} [options={}] The options object.
  27552. * @param {boolean} [options.leading=false]
  27553. * Specify invoking on the leading edge of the timeout.
  27554. * @param {number} [options.maxWait]
  27555. * The maximum time `func` is allowed to be delayed before it's invoked.
  27556. * @param {boolean} [options.trailing=true]
  27557. * Specify invoking on the trailing edge of the timeout.
  27558. * @returns {Function} Returns the new debounced function.
  27559. * @example
  27560. *
  27561. * // Avoid costly calculations while the window size is in flux.
  27562. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27563. *
  27564. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27565. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27566. * 'leading': true,
  27567. * 'trailing': false
  27568. * }));
  27569. *
  27570. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27571. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27572. * var source = new EventSource('/stream');
  27573. * jQuery(source).on('message', debounced);
  27574. *
  27575. * // Cancel the trailing debounced invocation.
  27576. * jQuery(window).on('popstate', debounced.cancel);
  27577. */
  27578. function debounce(func, wait, options) {
  27579. var lastArgs,
  27580. lastThis,
  27581. maxWait,
  27582. result,
  27583. timerId,
  27584. lastCallTime,
  27585. lastInvokeTime = 0,
  27586. leading = false,
  27587. maxing = false,
  27588. trailing = true;
  27589. if (typeof func != 'function') {
  27590. throw new TypeError(FUNC_ERROR_TEXT);
  27591. }
  27592. wait = toNumber(wait) || 0;
  27593. if (isObject(options)) {
  27594. leading = !!options.leading;
  27595. maxing = 'maxWait' in options;
  27596. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27597. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27598. }
  27599. function invokeFunc(time) {
  27600. var args = lastArgs,
  27601. thisArg = lastThis;
  27602. lastArgs = lastThis = undefined;
  27603. lastInvokeTime = time;
  27604. result = func.apply(thisArg, args);
  27605. return result;
  27606. }
  27607. function leadingEdge(time) {
  27608. // Reset any `maxWait` timer.
  27609. lastInvokeTime = time;
  27610. // Start the timer for the trailing edge.
  27611. timerId = setTimeout(timerExpired, wait);
  27612. // Invoke the leading edge.
  27613. return leading ? invokeFunc(time) : result;
  27614. }
  27615. function remainingWait(time) {
  27616. var timeSinceLastCall = time - lastCallTime,
  27617. timeSinceLastInvoke = time - lastInvokeTime,
  27618. timeWaiting = wait - timeSinceLastCall;
  27619. return maxing
  27620. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27621. : timeWaiting;
  27622. }
  27623. function shouldInvoke(time) {
  27624. var timeSinceLastCall = time - lastCallTime,
  27625. timeSinceLastInvoke = time - lastInvokeTime;
  27626. // Either this is the first call, activity has stopped and we're at the
  27627. // trailing edge, the system time has gone backwards and we're treating
  27628. // it as the trailing edge, or we've hit the `maxWait` limit.
  27629. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27630. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27631. }
  27632. function timerExpired() {
  27633. var time = now();
  27634. if (shouldInvoke(time)) {
  27635. return trailingEdge(time);
  27636. }
  27637. // Restart the timer.
  27638. timerId = setTimeout(timerExpired, remainingWait(time));
  27639. }
  27640. function trailingEdge(time) {
  27641. timerId = undefined;
  27642. // Only invoke if we have `lastArgs` which means `func` has been
  27643. // debounced at least once.
  27644. if (trailing && lastArgs) {
  27645. return invokeFunc(time);
  27646. }
  27647. lastArgs = lastThis = undefined;
  27648. return result;
  27649. }
  27650. function cancel() {
  27651. if (timerId !== undefined) {
  27652. clearTimeout(timerId);
  27653. }
  27654. lastInvokeTime = 0;
  27655. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27656. }
  27657. function flush() {
  27658. return timerId === undefined ? result : trailingEdge(now());
  27659. }
  27660. function debounced() {
  27661. var time = now(),
  27662. isInvoking = shouldInvoke(time);
  27663. lastArgs = arguments;
  27664. lastThis = this;
  27665. lastCallTime = time;
  27666. if (isInvoking) {
  27667. if (timerId === undefined) {
  27668. return leadingEdge(lastCallTime);
  27669. }
  27670. if (maxing) {
  27671. // Handle invocations in a tight loop.
  27672. clearTimeout(timerId);
  27673. timerId = setTimeout(timerExpired, wait);
  27674. return invokeFunc(lastCallTime);
  27675. }
  27676. }
  27677. if (timerId === undefined) {
  27678. timerId = setTimeout(timerExpired, wait);
  27679. }
  27680. return result;
  27681. }
  27682. debounced.cancel = cancel;
  27683. debounced.flush = flush;
  27684. return debounced;
  27685. }
  27686. /**
  27687. * Defers invoking the `func` until the current call stack has cleared. Any
  27688. * additional arguments are provided to `func` when it's invoked.
  27689. *
  27690. * @static
  27691. * @memberOf _
  27692. * @since 0.1.0
  27693. * @category Function
  27694. * @param {Function} func The function to defer.
  27695. * @param {...*} [args] The arguments to invoke `func` with.
  27696. * @returns {number} Returns the timer id.
  27697. * @example
  27698. *
  27699. * _.defer(function(text) {
  27700. * console.log(text);
  27701. * }, 'deferred');
  27702. * // => Logs 'deferred' after one millisecond.
  27703. */
  27704. var defer = baseRest(function(func, args) {
  27705. return baseDelay(func, 1, args);
  27706. });
  27707. /**
  27708. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27709. * provided to `func` when it's invoked.
  27710. *
  27711. * @static
  27712. * @memberOf _
  27713. * @since 0.1.0
  27714. * @category Function
  27715. * @param {Function} func The function to delay.
  27716. * @param {number} wait The number of milliseconds to delay invocation.
  27717. * @param {...*} [args] The arguments to invoke `func` with.
  27718. * @returns {number} Returns the timer id.
  27719. * @example
  27720. *
  27721. * _.delay(function(text) {
  27722. * console.log(text);
  27723. * }, 1000, 'later');
  27724. * // => Logs 'later' after one second.
  27725. */
  27726. var delay = baseRest(function(func, wait, args) {
  27727. return baseDelay(func, toNumber(wait) || 0, args);
  27728. });
  27729. /**
  27730. * Creates a function that invokes `func` with arguments reversed.
  27731. *
  27732. * @static
  27733. * @memberOf _
  27734. * @since 4.0.0
  27735. * @category Function
  27736. * @param {Function} func The function to flip arguments for.
  27737. * @returns {Function} Returns the new flipped function.
  27738. * @example
  27739. *
  27740. * var flipped = _.flip(function() {
  27741. * return _.toArray(arguments);
  27742. * });
  27743. *
  27744. * flipped('a', 'b', 'c', 'd');
  27745. * // => ['d', 'c', 'b', 'a']
  27746. */
  27747. function flip(func) {
  27748. return createWrap(func, WRAP_FLIP_FLAG);
  27749. }
  27750. /**
  27751. * Creates a function that memoizes the result of `func`. If `resolver` is
  27752. * provided, it determines the cache key for storing the result based on the
  27753. * arguments provided to the memoized function. By default, the first argument
  27754. * provided to the memoized function is used as the map cache key. The `func`
  27755. * is invoked with the `this` binding of the memoized function.
  27756. *
  27757. * **Note:** The cache is exposed as the `cache` property on the memoized
  27758. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  27759. * constructor with one whose instances implement the
  27760. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  27761. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  27762. *
  27763. * @static
  27764. * @memberOf _
  27765. * @since 0.1.0
  27766. * @category Function
  27767. * @param {Function} func The function to have its output memoized.
  27768. * @param {Function} [resolver] The function to resolve the cache key.
  27769. * @returns {Function} Returns the new memoized function.
  27770. * @example
  27771. *
  27772. * var object = { 'a': 1, 'b': 2 };
  27773. * var other = { 'c': 3, 'd': 4 };
  27774. *
  27775. * var values = _.memoize(_.values);
  27776. * values(object);
  27777. * // => [1, 2]
  27778. *
  27779. * values(other);
  27780. * // => [3, 4]
  27781. *
  27782. * object.a = 2;
  27783. * values(object);
  27784. * // => [1, 2]
  27785. *
  27786. * // Modify the result cache.
  27787. * values.cache.set(object, ['a', 'b']);
  27788. * values(object);
  27789. * // => ['a', 'b']
  27790. *
  27791. * // Replace `_.memoize.Cache`.
  27792. * _.memoize.Cache = WeakMap;
  27793. */
  27794. function memoize(func, resolver) {
  27795. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  27796. throw new TypeError(FUNC_ERROR_TEXT);
  27797. }
  27798. var memoized = function() {
  27799. var args = arguments,
  27800. key = resolver ? resolver.apply(this, args) : args[0],
  27801. cache = memoized.cache;
  27802. if (cache.has(key)) {
  27803. return cache.get(key);
  27804. }
  27805. var result = func.apply(this, args);
  27806. memoized.cache = cache.set(key, result) || cache;
  27807. return result;
  27808. };
  27809. memoized.cache = new (memoize.Cache || MapCache);
  27810. return memoized;
  27811. }
  27812. // Expose `MapCache`.
  27813. memoize.Cache = MapCache;
  27814. /**
  27815. * Creates a function that negates the result of the predicate `func`. The
  27816. * `func` predicate is invoked with the `this` binding and arguments of the
  27817. * created function.
  27818. *
  27819. * @static
  27820. * @memberOf _
  27821. * @since 3.0.0
  27822. * @category Function
  27823. * @param {Function} predicate The predicate to negate.
  27824. * @returns {Function} Returns the new negated function.
  27825. * @example
  27826. *
  27827. * function isEven(n) {
  27828. * return n % 2 == 0;
  27829. * }
  27830. *
  27831. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  27832. * // => [1, 3, 5]
  27833. */
  27834. function negate(predicate) {
  27835. if (typeof predicate != 'function') {
  27836. throw new TypeError(FUNC_ERROR_TEXT);
  27837. }
  27838. return function() {
  27839. var args = arguments;
  27840. switch (args.length) {
  27841. case 0: return !predicate.call(this);
  27842. case 1: return !predicate.call(this, args[0]);
  27843. case 2: return !predicate.call(this, args[0], args[1]);
  27844. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  27845. }
  27846. return !predicate.apply(this, args);
  27847. };
  27848. }
  27849. /**
  27850. * Creates a function that is restricted to invoking `func` once. Repeat calls
  27851. * to the function return the value of the first invocation. The `func` is
  27852. * invoked with the `this` binding and arguments of the created function.
  27853. *
  27854. * @static
  27855. * @memberOf _
  27856. * @since 0.1.0
  27857. * @category Function
  27858. * @param {Function} func The function to restrict.
  27859. * @returns {Function} Returns the new restricted function.
  27860. * @example
  27861. *
  27862. * var initialize = _.once(createApplication);
  27863. * initialize();
  27864. * initialize();
  27865. * // => `createApplication` is invoked once
  27866. */
  27867. function once(func) {
  27868. return before(2, func);
  27869. }
  27870. /**
  27871. * Creates a function that invokes `func` with its arguments transformed.
  27872. *
  27873. * @static
  27874. * @since 4.0.0
  27875. * @memberOf _
  27876. * @category Function
  27877. * @param {Function} func The function to wrap.
  27878. * @param {...(Function|Function[])} [transforms=[_.identity]]
  27879. * The argument transforms.
  27880. * @returns {Function} Returns the new function.
  27881. * @example
  27882. *
  27883. * function doubled(n) {
  27884. * return n * 2;
  27885. * }
  27886. *
  27887. * function square(n) {
  27888. * return n * n;
  27889. * }
  27890. *
  27891. * var func = _.overArgs(function(x, y) {
  27892. * return [x, y];
  27893. * }, [square, doubled]);
  27894. *
  27895. * func(9, 3);
  27896. * // => [81, 6]
  27897. *
  27898. * func(10, 5);
  27899. * // => [100, 10]
  27900. */
  27901. var overArgs = castRest(function(func, transforms) {
  27902. transforms = (transforms.length == 1 && isArray(transforms[0]))
  27903. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  27904. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  27905. var funcsLength = transforms.length;
  27906. return baseRest(function(args) {
  27907. var index = -1,
  27908. length = nativeMin(args.length, funcsLength);
  27909. while (++index < length) {
  27910. args[index] = transforms[index].call(this, args[index]);
  27911. }
  27912. return apply(func, this, args);
  27913. });
  27914. });
  27915. /**
  27916. * Creates a function that invokes `func` with `partials` prepended to the
  27917. * arguments it receives. This method is like `_.bind` except it does **not**
  27918. * alter the `this` binding.
  27919. *
  27920. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  27921. * builds, may be used as a placeholder for partially applied arguments.
  27922. *
  27923. * **Note:** This method doesn't set the "length" property of partially
  27924. * applied functions.
  27925. *
  27926. * @static
  27927. * @memberOf _
  27928. * @since 0.2.0
  27929. * @category Function
  27930. * @param {Function} func The function to partially apply arguments to.
  27931. * @param {...*} [partials] The arguments to be partially applied.
  27932. * @returns {Function} Returns the new partially applied function.
  27933. * @example
  27934. *
  27935. * function greet(greeting, name) {
  27936. * return greeting + ' ' + name;
  27937. * }
  27938. *
  27939. * var sayHelloTo = _.partial(greet, 'hello');
  27940. * sayHelloTo('fred');
  27941. * // => 'hello fred'
  27942. *
  27943. * // Partially applied with placeholders.
  27944. * var greetFred = _.partial(greet, _, 'fred');
  27945. * greetFred('hi');
  27946. * // => 'hi fred'
  27947. */
  27948. var partial = baseRest(function(func, partials) {
  27949. var holders = replaceHolders(partials, getHolder(partial));
  27950. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  27951. });
  27952. /**
  27953. * This method is like `_.partial` except that partially applied arguments
  27954. * are appended to the arguments it receives.
  27955. *
  27956. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  27957. * builds, may be used as a placeholder for partially applied arguments.
  27958. *
  27959. * **Note:** This method doesn't set the "length" property of partially
  27960. * applied functions.
  27961. *
  27962. * @static
  27963. * @memberOf _
  27964. * @since 1.0.0
  27965. * @category Function
  27966. * @param {Function} func The function to partially apply arguments to.
  27967. * @param {...*} [partials] The arguments to be partially applied.
  27968. * @returns {Function} Returns the new partially applied function.
  27969. * @example
  27970. *
  27971. * function greet(greeting, name) {
  27972. * return greeting + ' ' + name;
  27973. * }
  27974. *
  27975. * var greetFred = _.partialRight(greet, 'fred');
  27976. * greetFred('hi');
  27977. * // => 'hi fred'
  27978. *
  27979. * // Partially applied with placeholders.
  27980. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  27981. * sayHelloTo('fred');
  27982. * // => 'hello fred'
  27983. */
  27984. var partialRight = baseRest(function(func, partials) {
  27985. var holders = replaceHolders(partials, getHolder(partialRight));
  27986. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  27987. });
  27988. /**
  27989. * Creates a function that invokes `func` with arguments arranged according
  27990. * to the specified `indexes` where the argument value at the first index is
  27991. * provided as the first argument, the argument value at the second index is
  27992. * provided as the second argument, and so on.
  27993. *
  27994. * @static
  27995. * @memberOf _
  27996. * @since 3.0.0
  27997. * @category Function
  27998. * @param {Function} func The function to rearrange arguments for.
  27999. * @param {...(number|number[])} indexes The arranged argument indexes.
  28000. * @returns {Function} Returns the new function.
  28001. * @example
  28002. *
  28003. * var rearged = _.rearg(function(a, b, c) {
  28004. * return [a, b, c];
  28005. * }, [2, 0, 1]);
  28006. *
  28007. * rearged('b', 'c', 'a')
  28008. * // => ['a', 'b', 'c']
  28009. */
  28010. var rearg = flatRest(function(func, indexes) {
  28011. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28012. });
  28013. /**
  28014. * Creates a function that invokes `func` with the `this` binding of the
  28015. * created function and arguments from `start` and beyond provided as
  28016. * an array.
  28017. *
  28018. * **Note:** This method is based on the
  28019. * [rest parameter](https://mdn.io/rest_parameters).
  28020. *
  28021. * @static
  28022. * @memberOf _
  28023. * @since 4.0.0
  28024. * @category Function
  28025. * @param {Function} func The function to apply a rest parameter to.
  28026. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28027. * @returns {Function} Returns the new function.
  28028. * @example
  28029. *
  28030. * var say = _.rest(function(what, names) {
  28031. * return what + ' ' + _.initial(names).join(', ') +
  28032. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28033. * });
  28034. *
  28035. * say('hello', 'fred', 'barney', 'pebbles');
  28036. * // => 'hello fred, barney, & pebbles'
  28037. */
  28038. function rest(func, start) {
  28039. if (typeof func != 'function') {
  28040. throw new TypeError(FUNC_ERROR_TEXT);
  28041. }
  28042. start = start === undefined ? start : toInteger(start);
  28043. return baseRest(func, start);
  28044. }
  28045. /**
  28046. * Creates a function that invokes `func` with the `this` binding of the
  28047. * create function and an array of arguments much like
  28048. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28049. *
  28050. * **Note:** This method is based on the
  28051. * [spread operator](https://mdn.io/spread_operator).
  28052. *
  28053. * @static
  28054. * @memberOf _
  28055. * @since 3.2.0
  28056. * @category Function
  28057. * @param {Function} func The function to spread arguments over.
  28058. * @param {number} [start=0] The start position of the spread.
  28059. * @returns {Function} Returns the new function.
  28060. * @example
  28061. *
  28062. * var say = _.spread(function(who, what) {
  28063. * return who + ' says ' + what;
  28064. * });
  28065. *
  28066. * say(['fred', 'hello']);
  28067. * // => 'fred says hello'
  28068. *
  28069. * var numbers = Promise.all([
  28070. * Promise.resolve(40),
  28071. * Promise.resolve(36)
  28072. * ]);
  28073. *
  28074. * numbers.then(_.spread(function(x, y) {
  28075. * return x + y;
  28076. * }));
  28077. * // => a Promise of 76
  28078. */
  28079. function spread(func, start) {
  28080. if (typeof func != 'function') {
  28081. throw new TypeError(FUNC_ERROR_TEXT);
  28082. }
  28083. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28084. return baseRest(function(args) {
  28085. var array = args[start],
  28086. otherArgs = castSlice(args, 0, start);
  28087. if (array) {
  28088. arrayPush(otherArgs, array);
  28089. }
  28090. return apply(func, this, otherArgs);
  28091. });
  28092. }
  28093. /**
  28094. * Creates a throttled function that only invokes `func` at most once per
  28095. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28096. * method to cancel delayed `func` invocations and a `flush` method to
  28097. * immediately invoke them. Provide `options` to indicate whether `func`
  28098. * should be invoked on the leading and/or trailing edge of the `wait`
  28099. * timeout. The `func` is invoked with the last arguments provided to the
  28100. * throttled function. Subsequent calls to the throttled function return the
  28101. * result of the last `func` invocation.
  28102. *
  28103. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28104. * invoked on the trailing edge of the timeout only if the throttled function
  28105. * is invoked more than once during the `wait` timeout.
  28106. *
  28107. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28108. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28109. *
  28110. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28111. * for details over the differences between `_.throttle` and `_.debounce`.
  28112. *
  28113. * @static
  28114. * @memberOf _
  28115. * @since 0.1.0
  28116. * @category Function
  28117. * @param {Function} func The function to throttle.
  28118. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28119. * @param {Object} [options={}] The options object.
  28120. * @param {boolean} [options.leading=true]
  28121. * Specify invoking on the leading edge of the timeout.
  28122. * @param {boolean} [options.trailing=true]
  28123. * Specify invoking on the trailing edge of the timeout.
  28124. * @returns {Function} Returns the new throttled function.
  28125. * @example
  28126. *
  28127. * // Avoid excessively updating the position while scrolling.
  28128. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28129. *
  28130. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28131. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28132. * jQuery(element).on('click', throttled);
  28133. *
  28134. * // Cancel the trailing throttled invocation.
  28135. * jQuery(window).on('popstate', throttled.cancel);
  28136. */
  28137. function throttle(func, wait, options) {
  28138. var leading = true,
  28139. trailing = true;
  28140. if (typeof func != 'function') {
  28141. throw new TypeError(FUNC_ERROR_TEXT);
  28142. }
  28143. if (isObject(options)) {
  28144. leading = 'leading' in options ? !!options.leading : leading;
  28145. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28146. }
  28147. return debounce(func, wait, {
  28148. 'leading': leading,
  28149. 'maxWait': wait,
  28150. 'trailing': trailing
  28151. });
  28152. }
  28153. /**
  28154. * Creates a function that accepts up to one argument, ignoring any
  28155. * additional arguments.
  28156. *
  28157. * @static
  28158. * @memberOf _
  28159. * @since 4.0.0
  28160. * @category Function
  28161. * @param {Function} func The function to cap arguments for.
  28162. * @returns {Function} Returns the new capped function.
  28163. * @example
  28164. *
  28165. * _.map(['6', '8', '10'], _.unary(parseInt));
  28166. * // => [6, 8, 10]
  28167. */
  28168. function unary(func) {
  28169. return ary(func, 1);
  28170. }
  28171. /**
  28172. * Creates a function that provides `value` to `wrapper` as its first
  28173. * argument. Any additional arguments provided to the function are appended
  28174. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28175. * binding of the created function.
  28176. *
  28177. * @static
  28178. * @memberOf _
  28179. * @since 0.1.0
  28180. * @category Function
  28181. * @param {*} value The value to wrap.
  28182. * @param {Function} [wrapper=identity] The wrapper function.
  28183. * @returns {Function} Returns the new function.
  28184. * @example
  28185. *
  28186. * var p = _.wrap(_.escape, function(func, text) {
  28187. * return '<p>' + func(text) + '</p>';
  28188. * });
  28189. *
  28190. * p('fred, barney, & pebbles');
  28191. * // => '<p>fred, barney, &amp; pebbles</p>'
  28192. */
  28193. function wrap(value, wrapper) {
  28194. return partial(castFunction(wrapper), value);
  28195. }
  28196. /*------------------------------------------------------------------------*/
  28197. /**
  28198. * Casts `value` as an array if it's not one.
  28199. *
  28200. * @static
  28201. * @memberOf _
  28202. * @since 4.4.0
  28203. * @category Lang
  28204. * @param {*} value The value to inspect.
  28205. * @returns {Array} Returns the cast array.
  28206. * @example
  28207. *
  28208. * _.castArray(1);
  28209. * // => [1]
  28210. *
  28211. * _.castArray({ 'a': 1 });
  28212. * // => [{ 'a': 1 }]
  28213. *
  28214. * _.castArray('abc');
  28215. * // => ['abc']
  28216. *
  28217. * _.castArray(null);
  28218. * // => [null]
  28219. *
  28220. * _.castArray(undefined);
  28221. * // => [undefined]
  28222. *
  28223. * _.castArray();
  28224. * // => []
  28225. *
  28226. * var array = [1, 2, 3];
  28227. * console.log(_.castArray(array) === array);
  28228. * // => true
  28229. */
  28230. function castArray() {
  28231. if (!arguments.length) {
  28232. return [];
  28233. }
  28234. var value = arguments[0];
  28235. return isArray(value) ? value : [value];
  28236. }
  28237. /**
  28238. * Creates a shallow clone of `value`.
  28239. *
  28240. * **Note:** This method is loosely based on the
  28241. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28242. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28243. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28244. * arrays. The own enumerable properties of `arguments` objects are cloned
  28245. * as plain objects. An empty object is returned for uncloneable values such
  28246. * as error objects, functions, DOM nodes, and WeakMaps.
  28247. *
  28248. * @static
  28249. * @memberOf _
  28250. * @since 0.1.0
  28251. * @category Lang
  28252. * @param {*} value The value to clone.
  28253. * @returns {*} Returns the cloned value.
  28254. * @see _.cloneDeep
  28255. * @example
  28256. *
  28257. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28258. *
  28259. * var shallow = _.clone(objects);
  28260. * console.log(shallow[0] === objects[0]);
  28261. * // => true
  28262. */
  28263. function clone(value) {
  28264. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28265. }
  28266. /**
  28267. * This method is like `_.clone` except that it accepts `customizer` which
  28268. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28269. * cloning is handled by the method instead. The `customizer` is invoked with
  28270. * up to four arguments; (value [, index|key, object, stack]).
  28271. *
  28272. * @static
  28273. * @memberOf _
  28274. * @since 4.0.0
  28275. * @category Lang
  28276. * @param {*} value The value to clone.
  28277. * @param {Function} [customizer] The function to customize cloning.
  28278. * @returns {*} Returns the cloned value.
  28279. * @see _.cloneDeepWith
  28280. * @example
  28281. *
  28282. * function customizer(value) {
  28283. * if (_.isElement(value)) {
  28284. * return value.cloneNode(false);
  28285. * }
  28286. * }
  28287. *
  28288. * var el = _.cloneWith(document.body, customizer);
  28289. *
  28290. * console.log(el === document.body);
  28291. * // => false
  28292. * console.log(el.nodeName);
  28293. * // => 'BODY'
  28294. * console.log(el.childNodes.length);
  28295. * // => 0
  28296. */
  28297. function cloneWith(value, customizer) {
  28298. customizer = typeof customizer == 'function' ? customizer : undefined;
  28299. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28300. }
  28301. /**
  28302. * This method is like `_.clone` except that it recursively clones `value`.
  28303. *
  28304. * @static
  28305. * @memberOf _
  28306. * @since 1.0.0
  28307. * @category Lang
  28308. * @param {*} value The value to recursively clone.
  28309. * @returns {*} Returns the deep cloned value.
  28310. * @see _.clone
  28311. * @example
  28312. *
  28313. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28314. *
  28315. * var deep = _.cloneDeep(objects);
  28316. * console.log(deep[0] === objects[0]);
  28317. * // => false
  28318. */
  28319. function cloneDeep(value) {
  28320. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28321. }
  28322. /**
  28323. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28324. *
  28325. * @static
  28326. * @memberOf _
  28327. * @since 4.0.0
  28328. * @category Lang
  28329. * @param {*} value The value to recursively clone.
  28330. * @param {Function} [customizer] The function to customize cloning.
  28331. * @returns {*} Returns the deep cloned value.
  28332. * @see _.cloneWith
  28333. * @example
  28334. *
  28335. * function customizer(value) {
  28336. * if (_.isElement(value)) {
  28337. * return value.cloneNode(true);
  28338. * }
  28339. * }
  28340. *
  28341. * var el = _.cloneDeepWith(document.body, customizer);
  28342. *
  28343. * console.log(el === document.body);
  28344. * // => false
  28345. * console.log(el.nodeName);
  28346. * // => 'BODY'
  28347. * console.log(el.childNodes.length);
  28348. * // => 20
  28349. */
  28350. function cloneDeepWith(value, customizer) {
  28351. customizer = typeof customizer == 'function' ? customizer : undefined;
  28352. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28353. }
  28354. /**
  28355. * Checks if `object` conforms to `source` by invoking the predicate
  28356. * properties of `source` with the corresponding property values of `object`.
  28357. *
  28358. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28359. * partially applied.
  28360. *
  28361. * @static
  28362. * @memberOf _
  28363. * @since 4.14.0
  28364. * @category Lang
  28365. * @param {Object} object The object to inspect.
  28366. * @param {Object} source The object of property predicates to conform to.
  28367. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28368. * @example
  28369. *
  28370. * var object = { 'a': 1, 'b': 2 };
  28371. *
  28372. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28373. * // => true
  28374. *
  28375. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28376. * // => false
  28377. */
  28378. function conformsTo(object, source) {
  28379. return source == null || baseConformsTo(object, source, keys(source));
  28380. }
  28381. /**
  28382. * Performs a
  28383. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28384. * comparison between two values to determine if they are equivalent.
  28385. *
  28386. * @static
  28387. * @memberOf _
  28388. * @since 4.0.0
  28389. * @category Lang
  28390. * @param {*} value The value to compare.
  28391. * @param {*} other The other value to compare.
  28392. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28393. * @example
  28394. *
  28395. * var object = { 'a': 1 };
  28396. * var other = { 'a': 1 };
  28397. *
  28398. * _.eq(object, object);
  28399. * // => true
  28400. *
  28401. * _.eq(object, other);
  28402. * // => false
  28403. *
  28404. * _.eq('a', 'a');
  28405. * // => true
  28406. *
  28407. * _.eq('a', Object('a'));
  28408. * // => false
  28409. *
  28410. * _.eq(NaN, NaN);
  28411. * // => true
  28412. */
  28413. function eq(value, other) {
  28414. return value === other || (value !== value && other !== other);
  28415. }
  28416. /**
  28417. * Checks if `value` is greater than `other`.
  28418. *
  28419. * @static
  28420. * @memberOf _
  28421. * @since 3.9.0
  28422. * @category Lang
  28423. * @param {*} value The value to compare.
  28424. * @param {*} other The other value to compare.
  28425. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28426. * else `false`.
  28427. * @see _.lt
  28428. * @example
  28429. *
  28430. * _.gt(3, 1);
  28431. * // => true
  28432. *
  28433. * _.gt(3, 3);
  28434. * // => false
  28435. *
  28436. * _.gt(1, 3);
  28437. * // => false
  28438. */
  28439. var gt = createRelationalOperation(baseGt);
  28440. /**
  28441. * Checks if `value` is greater than or equal to `other`.
  28442. *
  28443. * @static
  28444. * @memberOf _
  28445. * @since 3.9.0
  28446. * @category Lang
  28447. * @param {*} value The value to compare.
  28448. * @param {*} other The other value to compare.
  28449. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28450. * `other`, else `false`.
  28451. * @see _.lte
  28452. * @example
  28453. *
  28454. * _.gte(3, 1);
  28455. * // => true
  28456. *
  28457. * _.gte(3, 3);
  28458. * // => true
  28459. *
  28460. * _.gte(1, 3);
  28461. * // => false
  28462. */
  28463. var gte = createRelationalOperation(function(value, other) {
  28464. return value >= other;
  28465. });
  28466. /**
  28467. * Checks if `value` is likely an `arguments` object.
  28468. *
  28469. * @static
  28470. * @memberOf _
  28471. * @since 0.1.0
  28472. * @category Lang
  28473. * @param {*} value The value to check.
  28474. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28475. * else `false`.
  28476. * @example
  28477. *
  28478. * _.isArguments(function() { return arguments; }());
  28479. * // => true
  28480. *
  28481. * _.isArguments([1, 2, 3]);
  28482. * // => false
  28483. */
  28484. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28485. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28486. !propertyIsEnumerable.call(value, 'callee');
  28487. };
  28488. /**
  28489. * Checks if `value` is classified as an `Array` object.
  28490. *
  28491. * @static
  28492. * @memberOf _
  28493. * @since 0.1.0
  28494. * @category Lang
  28495. * @param {*} value The value to check.
  28496. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28497. * @example
  28498. *
  28499. * _.isArray([1, 2, 3]);
  28500. * // => true
  28501. *
  28502. * _.isArray(document.body.children);
  28503. * // => false
  28504. *
  28505. * _.isArray('abc');
  28506. * // => false
  28507. *
  28508. * _.isArray(_.noop);
  28509. * // => false
  28510. */
  28511. var isArray = Array.isArray;
  28512. /**
  28513. * Checks if `value` is classified as an `ArrayBuffer` object.
  28514. *
  28515. * @static
  28516. * @memberOf _
  28517. * @since 4.3.0
  28518. * @category Lang
  28519. * @param {*} value The value to check.
  28520. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28521. * @example
  28522. *
  28523. * _.isArrayBuffer(new ArrayBuffer(2));
  28524. * // => true
  28525. *
  28526. * _.isArrayBuffer(new Array(2));
  28527. * // => false
  28528. */
  28529. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28530. /**
  28531. * Checks if `value` is array-like. A value is considered array-like if it's
  28532. * not a function and has a `value.length` that's an integer greater than or
  28533. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28534. *
  28535. * @static
  28536. * @memberOf _
  28537. * @since 4.0.0
  28538. * @category Lang
  28539. * @param {*} value The value to check.
  28540. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28541. * @example
  28542. *
  28543. * _.isArrayLike([1, 2, 3]);
  28544. * // => true
  28545. *
  28546. * _.isArrayLike(document.body.children);
  28547. * // => true
  28548. *
  28549. * _.isArrayLike('abc');
  28550. * // => true
  28551. *
  28552. * _.isArrayLike(_.noop);
  28553. * // => false
  28554. */
  28555. function isArrayLike(value) {
  28556. return value != null && isLength(value.length) && !isFunction(value);
  28557. }
  28558. /**
  28559. * This method is like `_.isArrayLike` except that it also checks if `value`
  28560. * is an object.
  28561. *
  28562. * @static
  28563. * @memberOf _
  28564. * @since 4.0.0
  28565. * @category Lang
  28566. * @param {*} value The value to check.
  28567. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28568. * else `false`.
  28569. * @example
  28570. *
  28571. * _.isArrayLikeObject([1, 2, 3]);
  28572. * // => true
  28573. *
  28574. * _.isArrayLikeObject(document.body.children);
  28575. * // => true
  28576. *
  28577. * _.isArrayLikeObject('abc');
  28578. * // => false
  28579. *
  28580. * _.isArrayLikeObject(_.noop);
  28581. * // => false
  28582. */
  28583. function isArrayLikeObject(value) {
  28584. return isObjectLike(value) && isArrayLike(value);
  28585. }
  28586. /**
  28587. * Checks if `value` is classified as a boolean primitive or object.
  28588. *
  28589. * @static
  28590. * @memberOf _
  28591. * @since 0.1.0
  28592. * @category Lang
  28593. * @param {*} value The value to check.
  28594. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28595. * @example
  28596. *
  28597. * _.isBoolean(false);
  28598. * // => true
  28599. *
  28600. * _.isBoolean(null);
  28601. * // => false
  28602. */
  28603. function isBoolean(value) {
  28604. return value === true || value === false ||
  28605. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28606. }
  28607. /**
  28608. * Checks if `value` is a buffer.
  28609. *
  28610. * @static
  28611. * @memberOf _
  28612. * @since 4.3.0
  28613. * @category Lang
  28614. * @param {*} value The value to check.
  28615. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28616. * @example
  28617. *
  28618. * _.isBuffer(new Buffer(2));
  28619. * // => true
  28620. *
  28621. * _.isBuffer(new Uint8Array(2));
  28622. * // => false
  28623. */
  28624. var isBuffer = nativeIsBuffer || stubFalse;
  28625. /**
  28626. * Checks if `value` is classified as a `Date` object.
  28627. *
  28628. * @static
  28629. * @memberOf _
  28630. * @since 0.1.0
  28631. * @category Lang
  28632. * @param {*} value The value to check.
  28633. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28634. * @example
  28635. *
  28636. * _.isDate(new Date);
  28637. * // => true
  28638. *
  28639. * _.isDate('Mon April 23 2012');
  28640. * // => false
  28641. */
  28642. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28643. /**
  28644. * Checks if `value` is likely a DOM element.
  28645. *
  28646. * @static
  28647. * @memberOf _
  28648. * @since 0.1.0
  28649. * @category Lang
  28650. * @param {*} value The value to check.
  28651. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28652. * @example
  28653. *
  28654. * _.isElement(document.body);
  28655. * // => true
  28656. *
  28657. * _.isElement('<body>');
  28658. * // => false
  28659. */
  28660. function isElement(value) {
  28661. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28662. }
  28663. /**
  28664. * Checks if `value` is an empty object, collection, map, or set.
  28665. *
  28666. * Objects are considered empty if they have no own enumerable string keyed
  28667. * properties.
  28668. *
  28669. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28670. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28671. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28672. *
  28673. * @static
  28674. * @memberOf _
  28675. * @since 0.1.0
  28676. * @category Lang
  28677. * @param {*} value The value to check.
  28678. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28679. * @example
  28680. *
  28681. * _.isEmpty(null);
  28682. * // => true
  28683. *
  28684. * _.isEmpty(true);
  28685. * // => true
  28686. *
  28687. * _.isEmpty(1);
  28688. * // => true
  28689. *
  28690. * _.isEmpty([1, 2, 3]);
  28691. * // => false
  28692. *
  28693. * _.isEmpty({ 'a': 1 });
  28694. * // => false
  28695. */
  28696. function isEmpty(value) {
  28697. if (value == null) {
  28698. return true;
  28699. }
  28700. if (isArrayLike(value) &&
  28701. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28702. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28703. return !value.length;
  28704. }
  28705. var tag = getTag(value);
  28706. if (tag == mapTag || tag == setTag) {
  28707. return !value.size;
  28708. }
  28709. if (isPrototype(value)) {
  28710. return !baseKeys(value).length;
  28711. }
  28712. for (var key in value) {
  28713. if (hasOwnProperty.call(value, key)) {
  28714. return false;
  28715. }
  28716. }
  28717. return true;
  28718. }
  28719. /**
  28720. * Performs a deep comparison between two values to determine if they are
  28721. * equivalent.
  28722. *
  28723. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28724. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28725. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28726. * by their own, not inherited, enumerable properties. Functions and DOM
  28727. * nodes are compared by strict equality, i.e. `===`.
  28728. *
  28729. * @static
  28730. * @memberOf _
  28731. * @since 0.1.0
  28732. * @category Lang
  28733. * @param {*} value The value to compare.
  28734. * @param {*} other The other value to compare.
  28735. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28736. * @example
  28737. *
  28738. * var object = { 'a': 1 };
  28739. * var other = { 'a': 1 };
  28740. *
  28741. * _.isEqual(object, other);
  28742. * // => true
  28743. *
  28744. * object === other;
  28745. * // => false
  28746. */
  28747. function isEqual(value, other) {
  28748. return baseIsEqual(value, other);
  28749. }
  28750. /**
  28751. * This method is like `_.isEqual` except that it accepts `customizer` which
  28752. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28753. * are handled by the method instead. The `customizer` is invoked with up to
  28754. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  28755. *
  28756. * @static
  28757. * @memberOf _
  28758. * @since 4.0.0
  28759. * @category Lang
  28760. * @param {*} value The value to compare.
  28761. * @param {*} other The other value to compare.
  28762. * @param {Function} [customizer] The function to customize comparisons.
  28763. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28764. * @example
  28765. *
  28766. * function isGreeting(value) {
  28767. * return /^h(?:i|ello)$/.test(value);
  28768. * }
  28769. *
  28770. * function customizer(objValue, othValue) {
  28771. * if (isGreeting(objValue) && isGreeting(othValue)) {
  28772. * return true;
  28773. * }
  28774. * }
  28775. *
  28776. * var array = ['hello', 'goodbye'];
  28777. * var other = ['hi', 'goodbye'];
  28778. *
  28779. * _.isEqualWith(array, other, customizer);
  28780. * // => true
  28781. */
  28782. function isEqualWith(value, other, customizer) {
  28783. customizer = typeof customizer == 'function' ? customizer : undefined;
  28784. var result = customizer ? customizer(value, other) : undefined;
  28785. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  28786. }
  28787. /**
  28788. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  28789. * `SyntaxError`, `TypeError`, or `URIError` object.
  28790. *
  28791. * @static
  28792. * @memberOf _
  28793. * @since 3.0.0
  28794. * @category Lang
  28795. * @param {*} value The value to check.
  28796. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  28797. * @example
  28798. *
  28799. * _.isError(new Error);
  28800. * // => true
  28801. *
  28802. * _.isError(Error);
  28803. * // => false
  28804. */
  28805. function isError(value) {
  28806. if (!isObjectLike(value)) {
  28807. return false;
  28808. }
  28809. var tag = baseGetTag(value);
  28810. return tag == errorTag || tag == domExcTag ||
  28811. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  28812. }
  28813. /**
  28814. * Checks if `value` is a finite primitive number.
  28815. *
  28816. * **Note:** This method is based on
  28817. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  28818. *
  28819. * @static
  28820. * @memberOf _
  28821. * @since 0.1.0
  28822. * @category Lang
  28823. * @param {*} value The value to check.
  28824. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  28825. * @example
  28826. *
  28827. * _.isFinite(3);
  28828. * // => true
  28829. *
  28830. * _.isFinite(Number.MIN_VALUE);
  28831. * // => true
  28832. *
  28833. * _.isFinite(Infinity);
  28834. * // => false
  28835. *
  28836. * _.isFinite('3');
  28837. * // => false
  28838. */
  28839. function isFinite(value) {
  28840. return typeof value == 'number' && nativeIsFinite(value);
  28841. }
  28842. /**
  28843. * Checks if `value` is classified as a `Function` object.
  28844. *
  28845. * @static
  28846. * @memberOf _
  28847. * @since 0.1.0
  28848. * @category Lang
  28849. * @param {*} value The value to check.
  28850. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  28851. * @example
  28852. *
  28853. * _.isFunction(_);
  28854. * // => true
  28855. *
  28856. * _.isFunction(/abc/);
  28857. * // => false
  28858. */
  28859. function isFunction(value) {
  28860. if (!isObject(value)) {
  28861. return false;
  28862. }
  28863. // The use of `Object#toString` avoids issues with the `typeof` operator
  28864. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  28865. var tag = baseGetTag(value);
  28866. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  28867. }
  28868. /**
  28869. * Checks if `value` is an integer.
  28870. *
  28871. * **Note:** This method is based on
  28872. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  28873. *
  28874. * @static
  28875. * @memberOf _
  28876. * @since 4.0.0
  28877. * @category Lang
  28878. * @param {*} value The value to check.
  28879. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  28880. * @example
  28881. *
  28882. * _.isInteger(3);
  28883. * // => true
  28884. *
  28885. * _.isInteger(Number.MIN_VALUE);
  28886. * // => false
  28887. *
  28888. * _.isInteger(Infinity);
  28889. * // => false
  28890. *
  28891. * _.isInteger('3');
  28892. * // => false
  28893. */
  28894. function isInteger(value) {
  28895. return typeof value == 'number' && value == toInteger(value);
  28896. }
  28897. /**
  28898. * Checks if `value` is a valid array-like length.
  28899. *
  28900. * **Note:** This method is loosely based on
  28901. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  28902. *
  28903. * @static
  28904. * @memberOf _
  28905. * @since 4.0.0
  28906. * @category Lang
  28907. * @param {*} value The value to check.
  28908. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  28909. * @example
  28910. *
  28911. * _.isLength(3);
  28912. * // => true
  28913. *
  28914. * _.isLength(Number.MIN_VALUE);
  28915. * // => false
  28916. *
  28917. * _.isLength(Infinity);
  28918. * // => false
  28919. *
  28920. * _.isLength('3');
  28921. * // => false
  28922. */
  28923. function isLength(value) {
  28924. return typeof value == 'number' &&
  28925. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  28926. }
  28927. /**
  28928. * Checks if `value` is the
  28929. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  28930. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  28931. *
  28932. * @static
  28933. * @memberOf _
  28934. * @since 0.1.0
  28935. * @category Lang
  28936. * @param {*} value The value to check.
  28937. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  28938. * @example
  28939. *
  28940. * _.isObject({});
  28941. * // => true
  28942. *
  28943. * _.isObject([1, 2, 3]);
  28944. * // => true
  28945. *
  28946. * _.isObject(_.noop);
  28947. * // => true
  28948. *
  28949. * _.isObject(null);
  28950. * // => false
  28951. */
  28952. function isObject(value) {
  28953. var type = typeof value;
  28954. return value != null && (type == 'object' || type == 'function');
  28955. }
  28956. /**
  28957. * Checks if `value` is object-like. A value is object-like if it's not `null`
  28958. * and has a `typeof` result of "object".
  28959. *
  28960. * @static
  28961. * @memberOf _
  28962. * @since 4.0.0
  28963. * @category Lang
  28964. * @param {*} value The value to check.
  28965. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  28966. * @example
  28967. *
  28968. * _.isObjectLike({});
  28969. * // => true
  28970. *
  28971. * _.isObjectLike([1, 2, 3]);
  28972. * // => true
  28973. *
  28974. * _.isObjectLike(_.noop);
  28975. * // => false
  28976. *
  28977. * _.isObjectLike(null);
  28978. * // => false
  28979. */
  28980. function isObjectLike(value) {
  28981. return value != null && typeof value == 'object';
  28982. }
  28983. /**
  28984. * Checks if `value` is classified as a `Map` object.
  28985. *
  28986. * @static
  28987. * @memberOf _
  28988. * @since 4.3.0
  28989. * @category Lang
  28990. * @param {*} value The value to check.
  28991. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  28992. * @example
  28993. *
  28994. * _.isMap(new Map);
  28995. * // => true
  28996. *
  28997. * _.isMap(new WeakMap);
  28998. * // => false
  28999. */
  29000. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29001. /**
  29002. * Performs a partial deep comparison between `object` and `source` to
  29003. * determine if `object` contains equivalent property values.
  29004. *
  29005. * **Note:** This method is equivalent to `_.matches` when `source` is
  29006. * partially applied.
  29007. *
  29008. * Partial comparisons will match empty array and empty object `source`
  29009. * values against any array or object value, respectively. See `_.isEqual`
  29010. * for a list of supported value comparisons.
  29011. *
  29012. * @static
  29013. * @memberOf _
  29014. * @since 3.0.0
  29015. * @category Lang
  29016. * @param {Object} object The object to inspect.
  29017. * @param {Object} source The object of property values to match.
  29018. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29019. * @example
  29020. *
  29021. * var object = { 'a': 1, 'b': 2 };
  29022. *
  29023. * _.isMatch(object, { 'b': 2 });
  29024. * // => true
  29025. *
  29026. * _.isMatch(object, { 'b': 1 });
  29027. * // => false
  29028. */
  29029. function isMatch(object, source) {
  29030. return object === source || baseIsMatch(object, source, getMatchData(source));
  29031. }
  29032. /**
  29033. * This method is like `_.isMatch` except that it accepts `customizer` which
  29034. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29035. * are handled by the method instead. The `customizer` is invoked with five
  29036. * arguments: (objValue, srcValue, index|key, object, source).
  29037. *
  29038. * @static
  29039. * @memberOf _
  29040. * @since 4.0.0
  29041. * @category Lang
  29042. * @param {Object} object The object to inspect.
  29043. * @param {Object} source The object of property values to match.
  29044. * @param {Function} [customizer] The function to customize comparisons.
  29045. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29046. * @example
  29047. *
  29048. * function isGreeting(value) {
  29049. * return /^h(?:i|ello)$/.test(value);
  29050. * }
  29051. *
  29052. * function customizer(objValue, srcValue) {
  29053. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29054. * return true;
  29055. * }
  29056. * }
  29057. *
  29058. * var object = { 'greeting': 'hello' };
  29059. * var source = { 'greeting': 'hi' };
  29060. *
  29061. * _.isMatchWith(object, source, customizer);
  29062. * // => true
  29063. */
  29064. function isMatchWith(object, source, customizer) {
  29065. customizer = typeof customizer == 'function' ? customizer : undefined;
  29066. return baseIsMatch(object, source, getMatchData(source), customizer);
  29067. }
  29068. /**
  29069. * Checks if `value` is `NaN`.
  29070. *
  29071. * **Note:** This method is based on
  29072. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29073. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29074. * `undefined` and other non-number values.
  29075. *
  29076. * @static
  29077. * @memberOf _
  29078. * @since 0.1.0
  29079. * @category Lang
  29080. * @param {*} value The value to check.
  29081. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29082. * @example
  29083. *
  29084. * _.isNaN(NaN);
  29085. * // => true
  29086. *
  29087. * _.isNaN(new Number(NaN));
  29088. * // => true
  29089. *
  29090. * isNaN(undefined);
  29091. * // => true
  29092. *
  29093. * _.isNaN(undefined);
  29094. * // => false
  29095. */
  29096. function isNaN(value) {
  29097. // An `NaN` primitive is the only value that is not equal to itself.
  29098. // Perform the `toStringTag` check first to avoid errors with some
  29099. // ActiveX objects in IE.
  29100. return isNumber(value) && value != +value;
  29101. }
  29102. /**
  29103. * Checks if `value` is a pristine native function.
  29104. *
  29105. * **Note:** This method can't reliably detect native functions in the presence
  29106. * of the core-js package because core-js circumvents this kind of detection.
  29107. * Despite multiple requests, the core-js maintainer has made it clear: any
  29108. * attempt to fix the detection will be obstructed. As a result, we're left
  29109. * with little choice but to throw an error. Unfortunately, this also affects
  29110. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29111. * which rely on core-js.
  29112. *
  29113. * @static
  29114. * @memberOf _
  29115. * @since 3.0.0
  29116. * @category Lang
  29117. * @param {*} value The value to check.
  29118. * @returns {boolean} Returns `true` if `value` is a native function,
  29119. * else `false`.
  29120. * @example
  29121. *
  29122. * _.isNative(Array.prototype.push);
  29123. * // => true
  29124. *
  29125. * _.isNative(_);
  29126. * // => false
  29127. */
  29128. function isNative(value) {
  29129. if (isMaskable(value)) {
  29130. throw new Error(CORE_ERROR_TEXT);
  29131. }
  29132. return baseIsNative(value);
  29133. }
  29134. /**
  29135. * Checks if `value` is `null`.
  29136. *
  29137. * @static
  29138. * @memberOf _
  29139. * @since 0.1.0
  29140. * @category Lang
  29141. * @param {*} value The value to check.
  29142. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29143. * @example
  29144. *
  29145. * _.isNull(null);
  29146. * // => true
  29147. *
  29148. * _.isNull(void 0);
  29149. * // => false
  29150. */
  29151. function isNull(value) {
  29152. return value === null;
  29153. }
  29154. /**
  29155. * Checks if `value` is `null` or `undefined`.
  29156. *
  29157. * @static
  29158. * @memberOf _
  29159. * @since 4.0.0
  29160. * @category Lang
  29161. * @param {*} value The value to check.
  29162. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29163. * @example
  29164. *
  29165. * _.isNil(null);
  29166. * // => true
  29167. *
  29168. * _.isNil(void 0);
  29169. * // => true
  29170. *
  29171. * _.isNil(NaN);
  29172. * // => false
  29173. */
  29174. function isNil(value) {
  29175. return value == null;
  29176. }
  29177. /**
  29178. * Checks if `value` is classified as a `Number` primitive or object.
  29179. *
  29180. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29181. * classified as numbers, use the `_.isFinite` method.
  29182. *
  29183. * @static
  29184. * @memberOf _
  29185. * @since 0.1.0
  29186. * @category Lang
  29187. * @param {*} value The value to check.
  29188. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29189. * @example
  29190. *
  29191. * _.isNumber(3);
  29192. * // => true
  29193. *
  29194. * _.isNumber(Number.MIN_VALUE);
  29195. * // => true
  29196. *
  29197. * _.isNumber(Infinity);
  29198. * // => true
  29199. *
  29200. * _.isNumber('3');
  29201. * // => false
  29202. */
  29203. function isNumber(value) {
  29204. return typeof value == 'number' ||
  29205. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29206. }
  29207. /**
  29208. * Checks if `value` is a plain object, that is, an object created by the
  29209. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29210. *
  29211. * @static
  29212. * @memberOf _
  29213. * @since 0.8.0
  29214. * @category Lang
  29215. * @param {*} value The value to check.
  29216. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29217. * @example
  29218. *
  29219. * function Foo() {
  29220. * this.a = 1;
  29221. * }
  29222. *
  29223. * _.isPlainObject(new Foo);
  29224. * // => false
  29225. *
  29226. * _.isPlainObject([1, 2, 3]);
  29227. * // => false
  29228. *
  29229. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29230. * // => true
  29231. *
  29232. * _.isPlainObject(Object.create(null));
  29233. * // => true
  29234. */
  29235. function isPlainObject(value) {
  29236. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29237. return false;
  29238. }
  29239. var proto = getPrototype(value);
  29240. if (proto === null) {
  29241. return true;
  29242. }
  29243. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29244. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29245. funcToString.call(Ctor) == objectCtorString;
  29246. }
  29247. /**
  29248. * Checks if `value` is classified as a `RegExp` object.
  29249. *
  29250. * @static
  29251. * @memberOf _
  29252. * @since 0.1.0
  29253. * @category Lang
  29254. * @param {*} value The value to check.
  29255. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29256. * @example
  29257. *
  29258. * _.isRegExp(/abc/);
  29259. * // => true
  29260. *
  29261. * _.isRegExp('/abc/');
  29262. * // => false
  29263. */
  29264. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29265. /**
  29266. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29267. * double precision number which isn't the result of a rounded unsafe integer.
  29268. *
  29269. * **Note:** This method is based on
  29270. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29271. *
  29272. * @static
  29273. * @memberOf _
  29274. * @since 4.0.0
  29275. * @category Lang
  29276. * @param {*} value The value to check.
  29277. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29278. * @example
  29279. *
  29280. * _.isSafeInteger(3);
  29281. * // => true
  29282. *
  29283. * _.isSafeInteger(Number.MIN_VALUE);
  29284. * // => false
  29285. *
  29286. * _.isSafeInteger(Infinity);
  29287. * // => false
  29288. *
  29289. * _.isSafeInteger('3');
  29290. * // => false
  29291. */
  29292. function isSafeInteger(value) {
  29293. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29294. }
  29295. /**
  29296. * Checks if `value` is classified as a `Set` object.
  29297. *
  29298. * @static
  29299. * @memberOf _
  29300. * @since 4.3.0
  29301. * @category Lang
  29302. * @param {*} value The value to check.
  29303. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29304. * @example
  29305. *
  29306. * _.isSet(new Set);
  29307. * // => true
  29308. *
  29309. * _.isSet(new WeakSet);
  29310. * // => false
  29311. */
  29312. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29313. /**
  29314. * Checks if `value` is classified as a `String` primitive or object.
  29315. *
  29316. * @static
  29317. * @since 0.1.0
  29318. * @memberOf _
  29319. * @category Lang
  29320. * @param {*} value The value to check.
  29321. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29322. * @example
  29323. *
  29324. * _.isString('abc');
  29325. * // => true
  29326. *
  29327. * _.isString(1);
  29328. * // => false
  29329. */
  29330. function isString(value) {
  29331. return typeof value == 'string' ||
  29332. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29333. }
  29334. /**
  29335. * Checks if `value` is classified as a `Symbol` primitive or object.
  29336. *
  29337. * @static
  29338. * @memberOf _
  29339. * @since 4.0.0
  29340. * @category Lang
  29341. * @param {*} value The value to check.
  29342. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29343. * @example
  29344. *
  29345. * _.isSymbol(Symbol.iterator);
  29346. * // => true
  29347. *
  29348. * _.isSymbol('abc');
  29349. * // => false
  29350. */
  29351. function isSymbol(value) {
  29352. return typeof value == 'symbol' ||
  29353. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29354. }
  29355. /**
  29356. * Checks if `value` is classified as a typed array.
  29357. *
  29358. * @static
  29359. * @memberOf _
  29360. * @since 3.0.0
  29361. * @category Lang
  29362. * @param {*} value The value to check.
  29363. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29364. * @example
  29365. *
  29366. * _.isTypedArray(new Uint8Array);
  29367. * // => true
  29368. *
  29369. * _.isTypedArray([]);
  29370. * // => false
  29371. */
  29372. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29373. /**
  29374. * Checks if `value` is `undefined`.
  29375. *
  29376. * @static
  29377. * @since 0.1.0
  29378. * @memberOf _
  29379. * @category Lang
  29380. * @param {*} value The value to check.
  29381. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29382. * @example
  29383. *
  29384. * _.isUndefined(void 0);
  29385. * // => true
  29386. *
  29387. * _.isUndefined(null);
  29388. * // => false
  29389. */
  29390. function isUndefined(value) {
  29391. return value === undefined;
  29392. }
  29393. /**
  29394. * Checks if `value` is classified as a `WeakMap` object.
  29395. *
  29396. * @static
  29397. * @memberOf _
  29398. * @since 4.3.0
  29399. * @category Lang
  29400. * @param {*} value The value to check.
  29401. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29402. * @example
  29403. *
  29404. * _.isWeakMap(new WeakMap);
  29405. * // => true
  29406. *
  29407. * _.isWeakMap(new Map);
  29408. * // => false
  29409. */
  29410. function isWeakMap(value) {
  29411. return isObjectLike(value) && getTag(value) == weakMapTag;
  29412. }
  29413. /**
  29414. * Checks if `value` is classified as a `WeakSet` object.
  29415. *
  29416. * @static
  29417. * @memberOf _
  29418. * @since 4.3.0
  29419. * @category Lang
  29420. * @param {*} value The value to check.
  29421. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29422. * @example
  29423. *
  29424. * _.isWeakSet(new WeakSet);
  29425. * // => true
  29426. *
  29427. * _.isWeakSet(new Set);
  29428. * // => false
  29429. */
  29430. function isWeakSet(value) {
  29431. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29432. }
  29433. /**
  29434. * Checks if `value` is less than `other`.
  29435. *
  29436. * @static
  29437. * @memberOf _
  29438. * @since 3.9.0
  29439. * @category Lang
  29440. * @param {*} value The value to compare.
  29441. * @param {*} other The other value to compare.
  29442. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29443. * else `false`.
  29444. * @see _.gt
  29445. * @example
  29446. *
  29447. * _.lt(1, 3);
  29448. * // => true
  29449. *
  29450. * _.lt(3, 3);
  29451. * // => false
  29452. *
  29453. * _.lt(3, 1);
  29454. * // => false
  29455. */
  29456. var lt = createRelationalOperation(baseLt);
  29457. /**
  29458. * Checks if `value` is less than or equal to `other`.
  29459. *
  29460. * @static
  29461. * @memberOf _
  29462. * @since 3.9.0
  29463. * @category Lang
  29464. * @param {*} value The value to compare.
  29465. * @param {*} other The other value to compare.
  29466. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29467. * `other`, else `false`.
  29468. * @see _.gte
  29469. * @example
  29470. *
  29471. * _.lte(1, 3);
  29472. * // => true
  29473. *
  29474. * _.lte(3, 3);
  29475. * // => true
  29476. *
  29477. * _.lte(3, 1);
  29478. * // => false
  29479. */
  29480. var lte = createRelationalOperation(function(value, other) {
  29481. return value <= other;
  29482. });
  29483. /**
  29484. * Converts `value` to an array.
  29485. *
  29486. * @static
  29487. * @since 0.1.0
  29488. * @memberOf _
  29489. * @category Lang
  29490. * @param {*} value The value to convert.
  29491. * @returns {Array} Returns the converted array.
  29492. * @example
  29493. *
  29494. * _.toArray({ 'a': 1, 'b': 2 });
  29495. * // => [1, 2]
  29496. *
  29497. * _.toArray('abc');
  29498. * // => ['a', 'b', 'c']
  29499. *
  29500. * _.toArray(1);
  29501. * // => []
  29502. *
  29503. * _.toArray(null);
  29504. * // => []
  29505. */
  29506. function toArray(value) {
  29507. if (!value) {
  29508. return [];
  29509. }
  29510. if (isArrayLike(value)) {
  29511. return isString(value) ? stringToArray(value) : copyArray(value);
  29512. }
  29513. if (symIterator && value[symIterator]) {
  29514. return iteratorToArray(value[symIterator]());
  29515. }
  29516. var tag = getTag(value),
  29517. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29518. return func(value);
  29519. }
  29520. /**
  29521. * Converts `value` to a finite number.
  29522. *
  29523. * @static
  29524. * @memberOf _
  29525. * @since 4.12.0
  29526. * @category Lang
  29527. * @param {*} value The value to convert.
  29528. * @returns {number} Returns the converted number.
  29529. * @example
  29530. *
  29531. * _.toFinite(3.2);
  29532. * // => 3.2
  29533. *
  29534. * _.toFinite(Number.MIN_VALUE);
  29535. * // => 5e-324
  29536. *
  29537. * _.toFinite(Infinity);
  29538. * // => 1.7976931348623157e+308
  29539. *
  29540. * _.toFinite('3.2');
  29541. * // => 3.2
  29542. */
  29543. function toFinite(value) {
  29544. if (!value) {
  29545. return value === 0 ? value : 0;
  29546. }
  29547. value = toNumber(value);
  29548. if (value === INFINITY || value === -INFINITY) {
  29549. var sign = (value < 0 ? -1 : 1);
  29550. return sign * MAX_INTEGER;
  29551. }
  29552. return value === value ? value : 0;
  29553. }
  29554. /**
  29555. * Converts `value` to an integer.
  29556. *
  29557. * **Note:** This method is loosely based on
  29558. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29559. *
  29560. * @static
  29561. * @memberOf _
  29562. * @since 4.0.0
  29563. * @category Lang
  29564. * @param {*} value The value to convert.
  29565. * @returns {number} Returns the converted integer.
  29566. * @example
  29567. *
  29568. * _.toInteger(3.2);
  29569. * // => 3
  29570. *
  29571. * _.toInteger(Number.MIN_VALUE);
  29572. * // => 0
  29573. *
  29574. * _.toInteger(Infinity);
  29575. * // => 1.7976931348623157e+308
  29576. *
  29577. * _.toInteger('3.2');
  29578. * // => 3
  29579. */
  29580. function toInteger(value) {
  29581. var result = toFinite(value),
  29582. remainder = result % 1;
  29583. return result === result ? (remainder ? result - remainder : result) : 0;
  29584. }
  29585. /**
  29586. * Converts `value` to an integer suitable for use as the length of an
  29587. * array-like object.
  29588. *
  29589. * **Note:** This method is based on
  29590. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29591. *
  29592. * @static
  29593. * @memberOf _
  29594. * @since 4.0.0
  29595. * @category Lang
  29596. * @param {*} value The value to convert.
  29597. * @returns {number} Returns the converted integer.
  29598. * @example
  29599. *
  29600. * _.toLength(3.2);
  29601. * // => 3
  29602. *
  29603. * _.toLength(Number.MIN_VALUE);
  29604. * // => 0
  29605. *
  29606. * _.toLength(Infinity);
  29607. * // => 4294967295
  29608. *
  29609. * _.toLength('3.2');
  29610. * // => 3
  29611. */
  29612. function toLength(value) {
  29613. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29614. }
  29615. /**
  29616. * Converts `value` to a number.
  29617. *
  29618. * @static
  29619. * @memberOf _
  29620. * @since 4.0.0
  29621. * @category Lang
  29622. * @param {*} value The value to process.
  29623. * @returns {number} Returns the number.
  29624. * @example
  29625. *
  29626. * _.toNumber(3.2);
  29627. * // => 3.2
  29628. *
  29629. * _.toNumber(Number.MIN_VALUE);
  29630. * // => 5e-324
  29631. *
  29632. * _.toNumber(Infinity);
  29633. * // => Infinity
  29634. *
  29635. * _.toNumber('3.2');
  29636. * // => 3.2
  29637. */
  29638. function toNumber(value) {
  29639. if (typeof value == 'number') {
  29640. return value;
  29641. }
  29642. if (isSymbol(value)) {
  29643. return NAN;
  29644. }
  29645. if (isObject(value)) {
  29646. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29647. value = isObject(other) ? (other + '') : other;
  29648. }
  29649. if (typeof value != 'string') {
  29650. return value === 0 ? value : +value;
  29651. }
  29652. value = value.replace(reTrim, '');
  29653. var isBinary = reIsBinary.test(value);
  29654. return (isBinary || reIsOctal.test(value))
  29655. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29656. : (reIsBadHex.test(value) ? NAN : +value);
  29657. }
  29658. /**
  29659. * Converts `value` to a plain object flattening inherited enumerable string
  29660. * keyed properties of `value` to own properties of the plain object.
  29661. *
  29662. * @static
  29663. * @memberOf _
  29664. * @since 3.0.0
  29665. * @category Lang
  29666. * @param {*} value The value to convert.
  29667. * @returns {Object} Returns the converted plain object.
  29668. * @example
  29669. *
  29670. * function Foo() {
  29671. * this.b = 2;
  29672. * }
  29673. *
  29674. * Foo.prototype.c = 3;
  29675. *
  29676. * _.assign({ 'a': 1 }, new Foo);
  29677. * // => { 'a': 1, 'b': 2 }
  29678. *
  29679. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29680. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29681. */
  29682. function toPlainObject(value) {
  29683. return copyObject(value, keysIn(value));
  29684. }
  29685. /**
  29686. * Converts `value` to a safe integer. A safe integer can be compared and
  29687. * represented correctly.
  29688. *
  29689. * @static
  29690. * @memberOf _
  29691. * @since 4.0.0
  29692. * @category Lang
  29693. * @param {*} value The value to convert.
  29694. * @returns {number} Returns the converted integer.
  29695. * @example
  29696. *
  29697. * _.toSafeInteger(3.2);
  29698. * // => 3
  29699. *
  29700. * _.toSafeInteger(Number.MIN_VALUE);
  29701. * // => 0
  29702. *
  29703. * _.toSafeInteger(Infinity);
  29704. * // => 9007199254740991
  29705. *
  29706. * _.toSafeInteger('3.2');
  29707. * // => 3
  29708. */
  29709. function toSafeInteger(value) {
  29710. return value
  29711. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29712. : (value === 0 ? value : 0);
  29713. }
  29714. /**
  29715. * Converts `value` to a string. An empty string is returned for `null`
  29716. * and `undefined` values. The sign of `-0` is preserved.
  29717. *
  29718. * @static
  29719. * @memberOf _
  29720. * @since 4.0.0
  29721. * @category Lang
  29722. * @param {*} value The value to convert.
  29723. * @returns {string} Returns the converted string.
  29724. * @example
  29725. *
  29726. * _.toString(null);
  29727. * // => ''
  29728. *
  29729. * _.toString(-0);
  29730. * // => '-0'
  29731. *
  29732. * _.toString([1, 2, 3]);
  29733. * // => '1,2,3'
  29734. */
  29735. function toString(value) {
  29736. return value == null ? '' : baseToString(value);
  29737. }
  29738. /*------------------------------------------------------------------------*/
  29739. /**
  29740. * Assigns own enumerable string keyed properties of source objects to the
  29741. * destination object. Source objects are applied from left to right.
  29742. * Subsequent sources overwrite property assignments of previous sources.
  29743. *
  29744. * **Note:** This method mutates `object` and is loosely based on
  29745. * [`Object.assign`](https://mdn.io/Object/assign).
  29746. *
  29747. * @static
  29748. * @memberOf _
  29749. * @since 0.10.0
  29750. * @category Object
  29751. * @param {Object} object The destination object.
  29752. * @param {...Object} [sources] The source objects.
  29753. * @returns {Object} Returns `object`.
  29754. * @see _.assignIn
  29755. * @example
  29756. *
  29757. * function Foo() {
  29758. * this.a = 1;
  29759. * }
  29760. *
  29761. * function Bar() {
  29762. * this.c = 3;
  29763. * }
  29764. *
  29765. * Foo.prototype.b = 2;
  29766. * Bar.prototype.d = 4;
  29767. *
  29768. * _.assign({ 'a': 0 }, new Foo, new Bar);
  29769. * // => { 'a': 1, 'c': 3 }
  29770. */
  29771. var assign = createAssigner(function(object, source) {
  29772. if (isPrototype(source) || isArrayLike(source)) {
  29773. copyObject(source, keys(source), object);
  29774. return;
  29775. }
  29776. for (var key in source) {
  29777. if (hasOwnProperty.call(source, key)) {
  29778. assignValue(object, key, source[key]);
  29779. }
  29780. }
  29781. });
  29782. /**
  29783. * This method is like `_.assign` except that it iterates over own and
  29784. * inherited source properties.
  29785. *
  29786. * **Note:** This method mutates `object`.
  29787. *
  29788. * @static
  29789. * @memberOf _
  29790. * @since 4.0.0
  29791. * @alias extend
  29792. * @category Object
  29793. * @param {Object} object The destination object.
  29794. * @param {...Object} [sources] The source objects.
  29795. * @returns {Object} Returns `object`.
  29796. * @see _.assign
  29797. * @example
  29798. *
  29799. * function Foo() {
  29800. * this.a = 1;
  29801. * }
  29802. *
  29803. * function Bar() {
  29804. * this.c = 3;
  29805. * }
  29806. *
  29807. * Foo.prototype.b = 2;
  29808. * Bar.prototype.d = 4;
  29809. *
  29810. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  29811. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  29812. */
  29813. var assignIn = createAssigner(function(object, source) {
  29814. copyObject(source, keysIn(source), object);
  29815. });
  29816. /**
  29817. * This method is like `_.assignIn` except that it accepts `customizer`
  29818. * which is invoked to produce the assigned values. If `customizer` returns
  29819. * `undefined`, assignment is handled by the method instead. The `customizer`
  29820. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29821. *
  29822. * **Note:** This method mutates `object`.
  29823. *
  29824. * @static
  29825. * @memberOf _
  29826. * @since 4.0.0
  29827. * @alias extendWith
  29828. * @category Object
  29829. * @param {Object} object The destination object.
  29830. * @param {...Object} sources The source objects.
  29831. * @param {Function} [customizer] The function to customize assigned values.
  29832. * @returns {Object} Returns `object`.
  29833. * @see _.assignWith
  29834. * @example
  29835. *
  29836. * function customizer(objValue, srcValue) {
  29837. * return _.isUndefined(objValue) ? srcValue : objValue;
  29838. * }
  29839. *
  29840. * var defaults = _.partialRight(_.assignInWith, customizer);
  29841. *
  29842. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29843. * // => { 'a': 1, 'b': 2 }
  29844. */
  29845. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  29846. copyObject(source, keysIn(source), object, customizer);
  29847. });
  29848. /**
  29849. * This method is like `_.assign` except that it accepts `customizer`
  29850. * which is invoked to produce the assigned values. If `customizer` returns
  29851. * `undefined`, assignment is handled by the method instead. The `customizer`
  29852. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29853. *
  29854. * **Note:** This method mutates `object`.
  29855. *
  29856. * @static
  29857. * @memberOf _
  29858. * @since 4.0.0
  29859. * @category Object
  29860. * @param {Object} object The destination object.
  29861. * @param {...Object} sources The source objects.
  29862. * @param {Function} [customizer] The function to customize assigned values.
  29863. * @returns {Object} Returns `object`.
  29864. * @see _.assignInWith
  29865. * @example
  29866. *
  29867. * function customizer(objValue, srcValue) {
  29868. * return _.isUndefined(objValue) ? srcValue : objValue;
  29869. * }
  29870. *
  29871. * var defaults = _.partialRight(_.assignWith, customizer);
  29872. *
  29873. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29874. * // => { 'a': 1, 'b': 2 }
  29875. */
  29876. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  29877. copyObject(source, keys(source), object, customizer);
  29878. });
  29879. /**
  29880. * Creates an array of values corresponding to `paths` of `object`.
  29881. *
  29882. * @static
  29883. * @memberOf _
  29884. * @since 1.0.0
  29885. * @category Object
  29886. * @param {Object} object The object to iterate over.
  29887. * @param {...(string|string[])} [paths] The property paths to pick.
  29888. * @returns {Array} Returns the picked values.
  29889. * @example
  29890. *
  29891. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  29892. *
  29893. * _.at(object, ['a[0].b.c', 'a[1]']);
  29894. * // => [3, 4]
  29895. */
  29896. var at = flatRest(baseAt);
  29897. /**
  29898. * Creates an object that inherits from the `prototype` object. If a
  29899. * `properties` object is given, its own enumerable string keyed properties
  29900. * are assigned to the created object.
  29901. *
  29902. * @static
  29903. * @memberOf _
  29904. * @since 2.3.0
  29905. * @category Object
  29906. * @param {Object} prototype The object to inherit from.
  29907. * @param {Object} [properties] The properties to assign to the object.
  29908. * @returns {Object} Returns the new object.
  29909. * @example
  29910. *
  29911. * function Shape() {
  29912. * this.x = 0;
  29913. * this.y = 0;
  29914. * }
  29915. *
  29916. * function Circle() {
  29917. * Shape.call(this);
  29918. * }
  29919. *
  29920. * Circle.prototype = _.create(Shape.prototype, {
  29921. * 'constructor': Circle
  29922. * });
  29923. *
  29924. * var circle = new Circle;
  29925. * circle instanceof Circle;
  29926. * // => true
  29927. *
  29928. * circle instanceof Shape;
  29929. * // => true
  29930. */
  29931. function create(prototype, properties) {
  29932. var result = baseCreate(prototype);
  29933. return properties == null ? result : baseAssign(result, properties);
  29934. }
  29935. /**
  29936. * Assigns own and inherited enumerable string keyed properties of source
  29937. * objects to the destination object for all destination properties that
  29938. * resolve to `undefined`. Source objects are applied from left to right.
  29939. * Once a property is set, additional values of the same property are ignored.
  29940. *
  29941. * **Note:** This method mutates `object`.
  29942. *
  29943. * @static
  29944. * @since 0.1.0
  29945. * @memberOf _
  29946. * @category Object
  29947. * @param {Object} object The destination object.
  29948. * @param {...Object} [sources] The source objects.
  29949. * @returns {Object} Returns `object`.
  29950. * @see _.defaultsDeep
  29951. * @example
  29952. *
  29953. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29954. * // => { 'a': 1, 'b': 2 }
  29955. */
  29956. var defaults = baseRest(function(object, sources) {
  29957. object = Object(object);
  29958. var index = -1;
  29959. var length = sources.length;
  29960. var guard = length > 2 ? sources[2] : undefined;
  29961. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  29962. length = 1;
  29963. }
  29964. while (++index < length) {
  29965. var source = sources[index];
  29966. var props = keysIn(source);
  29967. var propsIndex = -1;
  29968. var propsLength = props.length;
  29969. while (++propsIndex < propsLength) {
  29970. var key = props[propsIndex];
  29971. var value = object[key];
  29972. if (value === undefined ||
  29973. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  29974. object[key] = source[key];
  29975. }
  29976. }
  29977. }
  29978. return object;
  29979. });
  29980. /**
  29981. * This method is like `_.defaults` except that it recursively assigns
  29982. * default properties.
  29983. *
  29984. * **Note:** This method mutates `object`.
  29985. *
  29986. * @static
  29987. * @memberOf _
  29988. * @since 3.10.0
  29989. * @category Object
  29990. * @param {Object} object The destination object.
  29991. * @param {...Object} [sources] The source objects.
  29992. * @returns {Object} Returns `object`.
  29993. * @see _.defaults
  29994. * @example
  29995. *
  29996. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  29997. * // => { 'a': { 'b': 2, 'c': 3 } }
  29998. */
  29999. var defaultsDeep = baseRest(function(args) {
  30000. args.push(undefined, customDefaultsMerge);
  30001. return apply(mergeWith, undefined, args);
  30002. });
  30003. /**
  30004. * This method is like `_.find` except that it returns the key of the first
  30005. * element `predicate` returns truthy for instead of the element itself.
  30006. *
  30007. * @static
  30008. * @memberOf _
  30009. * @since 1.1.0
  30010. * @category Object
  30011. * @param {Object} object The object to inspect.
  30012. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30013. * @returns {string|undefined} Returns the key of the matched element,
  30014. * else `undefined`.
  30015. * @example
  30016. *
  30017. * var users = {
  30018. * 'barney': { 'age': 36, 'active': true },
  30019. * 'fred': { 'age': 40, 'active': false },
  30020. * 'pebbles': { 'age': 1, 'active': true }
  30021. * };
  30022. *
  30023. * _.findKey(users, function(o) { return o.age < 40; });
  30024. * // => 'barney' (iteration order is not guaranteed)
  30025. *
  30026. * // The `_.matches` iteratee shorthand.
  30027. * _.findKey(users, { 'age': 1, 'active': true });
  30028. * // => 'pebbles'
  30029. *
  30030. * // The `_.matchesProperty` iteratee shorthand.
  30031. * _.findKey(users, ['active', false]);
  30032. * // => 'fred'
  30033. *
  30034. * // The `_.property` iteratee shorthand.
  30035. * _.findKey(users, 'active');
  30036. * // => 'barney'
  30037. */
  30038. function findKey(object, predicate) {
  30039. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30040. }
  30041. /**
  30042. * This method is like `_.findKey` except that it iterates over elements of
  30043. * a collection in the opposite order.
  30044. *
  30045. * @static
  30046. * @memberOf _
  30047. * @since 2.0.0
  30048. * @category Object
  30049. * @param {Object} object The object to inspect.
  30050. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30051. * @returns {string|undefined} Returns the key of the matched element,
  30052. * else `undefined`.
  30053. * @example
  30054. *
  30055. * var users = {
  30056. * 'barney': { 'age': 36, 'active': true },
  30057. * 'fred': { 'age': 40, 'active': false },
  30058. * 'pebbles': { 'age': 1, 'active': true }
  30059. * };
  30060. *
  30061. * _.findLastKey(users, function(o) { return o.age < 40; });
  30062. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30063. *
  30064. * // The `_.matches` iteratee shorthand.
  30065. * _.findLastKey(users, { 'age': 36, 'active': true });
  30066. * // => 'barney'
  30067. *
  30068. * // The `_.matchesProperty` iteratee shorthand.
  30069. * _.findLastKey(users, ['active', false]);
  30070. * // => 'fred'
  30071. *
  30072. * // The `_.property` iteratee shorthand.
  30073. * _.findLastKey(users, 'active');
  30074. * // => 'pebbles'
  30075. */
  30076. function findLastKey(object, predicate) {
  30077. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30078. }
  30079. /**
  30080. * Iterates over own and inherited enumerable string keyed properties of an
  30081. * object and invokes `iteratee` for each property. The iteratee is invoked
  30082. * with three arguments: (value, key, object). Iteratee functions may exit
  30083. * iteration early by explicitly returning `false`.
  30084. *
  30085. * @static
  30086. * @memberOf _
  30087. * @since 0.3.0
  30088. * @category Object
  30089. * @param {Object} object The object to iterate over.
  30090. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30091. * @returns {Object} Returns `object`.
  30092. * @see _.forInRight
  30093. * @example
  30094. *
  30095. * function Foo() {
  30096. * this.a = 1;
  30097. * this.b = 2;
  30098. * }
  30099. *
  30100. * Foo.prototype.c = 3;
  30101. *
  30102. * _.forIn(new Foo, function(value, key) {
  30103. * console.log(key);
  30104. * });
  30105. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30106. */
  30107. function forIn(object, iteratee) {
  30108. return object == null
  30109. ? object
  30110. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30111. }
  30112. /**
  30113. * This method is like `_.forIn` except that it iterates over properties of
  30114. * `object` in the opposite order.
  30115. *
  30116. * @static
  30117. * @memberOf _
  30118. * @since 2.0.0
  30119. * @category Object
  30120. * @param {Object} object The object to iterate over.
  30121. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30122. * @returns {Object} Returns `object`.
  30123. * @see _.forIn
  30124. * @example
  30125. *
  30126. * function Foo() {
  30127. * this.a = 1;
  30128. * this.b = 2;
  30129. * }
  30130. *
  30131. * Foo.prototype.c = 3;
  30132. *
  30133. * _.forInRight(new Foo, function(value, key) {
  30134. * console.log(key);
  30135. * });
  30136. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30137. */
  30138. function forInRight(object, iteratee) {
  30139. return object == null
  30140. ? object
  30141. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30142. }
  30143. /**
  30144. * Iterates over own enumerable string keyed properties of an object and
  30145. * invokes `iteratee` for each property. The iteratee is invoked with three
  30146. * arguments: (value, key, object). Iteratee functions may exit iteration
  30147. * early by explicitly returning `false`.
  30148. *
  30149. * @static
  30150. * @memberOf _
  30151. * @since 0.3.0
  30152. * @category Object
  30153. * @param {Object} object The object to iterate over.
  30154. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30155. * @returns {Object} Returns `object`.
  30156. * @see _.forOwnRight
  30157. * @example
  30158. *
  30159. * function Foo() {
  30160. * this.a = 1;
  30161. * this.b = 2;
  30162. * }
  30163. *
  30164. * Foo.prototype.c = 3;
  30165. *
  30166. * _.forOwn(new Foo, function(value, key) {
  30167. * console.log(key);
  30168. * });
  30169. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30170. */
  30171. function forOwn(object, iteratee) {
  30172. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30173. }
  30174. /**
  30175. * This method is like `_.forOwn` except that it iterates over properties of
  30176. * `object` in the opposite order.
  30177. *
  30178. * @static
  30179. * @memberOf _
  30180. * @since 2.0.0
  30181. * @category Object
  30182. * @param {Object} object The object to iterate over.
  30183. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30184. * @returns {Object} Returns `object`.
  30185. * @see _.forOwn
  30186. * @example
  30187. *
  30188. * function Foo() {
  30189. * this.a = 1;
  30190. * this.b = 2;
  30191. * }
  30192. *
  30193. * Foo.prototype.c = 3;
  30194. *
  30195. * _.forOwnRight(new Foo, function(value, key) {
  30196. * console.log(key);
  30197. * });
  30198. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30199. */
  30200. function forOwnRight(object, iteratee) {
  30201. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30202. }
  30203. /**
  30204. * Creates an array of function property names from own enumerable properties
  30205. * of `object`.
  30206. *
  30207. * @static
  30208. * @since 0.1.0
  30209. * @memberOf _
  30210. * @category Object
  30211. * @param {Object} object The object to inspect.
  30212. * @returns {Array} Returns the function names.
  30213. * @see _.functionsIn
  30214. * @example
  30215. *
  30216. * function Foo() {
  30217. * this.a = _.constant('a');
  30218. * this.b = _.constant('b');
  30219. * }
  30220. *
  30221. * Foo.prototype.c = _.constant('c');
  30222. *
  30223. * _.functions(new Foo);
  30224. * // => ['a', 'b']
  30225. */
  30226. function functions(object) {
  30227. return object == null ? [] : baseFunctions(object, keys(object));
  30228. }
  30229. /**
  30230. * Creates an array of function property names from own and inherited
  30231. * enumerable properties of `object`.
  30232. *
  30233. * @static
  30234. * @memberOf _
  30235. * @since 4.0.0
  30236. * @category Object
  30237. * @param {Object} object The object to inspect.
  30238. * @returns {Array} Returns the function names.
  30239. * @see _.functions
  30240. * @example
  30241. *
  30242. * function Foo() {
  30243. * this.a = _.constant('a');
  30244. * this.b = _.constant('b');
  30245. * }
  30246. *
  30247. * Foo.prototype.c = _.constant('c');
  30248. *
  30249. * _.functionsIn(new Foo);
  30250. * // => ['a', 'b', 'c']
  30251. */
  30252. function functionsIn(object) {
  30253. return object == null ? [] : baseFunctions(object, keysIn(object));
  30254. }
  30255. /**
  30256. * Gets the value at `path` of `object`. If the resolved value is
  30257. * `undefined`, the `defaultValue` is returned in its place.
  30258. *
  30259. * @static
  30260. * @memberOf _
  30261. * @since 3.7.0
  30262. * @category Object
  30263. * @param {Object} object The object to query.
  30264. * @param {Array|string} path The path of the property to get.
  30265. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30266. * @returns {*} Returns the resolved value.
  30267. * @example
  30268. *
  30269. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30270. *
  30271. * _.get(object, 'a[0].b.c');
  30272. * // => 3
  30273. *
  30274. * _.get(object, ['a', '0', 'b', 'c']);
  30275. * // => 3
  30276. *
  30277. * _.get(object, 'a.b.c', 'default');
  30278. * // => 'default'
  30279. */
  30280. function get(object, path, defaultValue) {
  30281. var result = object == null ? undefined : baseGet(object, path);
  30282. return result === undefined ? defaultValue : result;
  30283. }
  30284. /**
  30285. * Checks if `path` is a direct property of `object`.
  30286. *
  30287. * @static
  30288. * @since 0.1.0
  30289. * @memberOf _
  30290. * @category Object
  30291. * @param {Object} object The object to query.
  30292. * @param {Array|string} path The path to check.
  30293. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30294. * @example
  30295. *
  30296. * var object = { 'a': { 'b': 2 } };
  30297. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30298. *
  30299. * _.has(object, 'a');
  30300. * // => true
  30301. *
  30302. * _.has(object, 'a.b');
  30303. * // => true
  30304. *
  30305. * _.has(object, ['a', 'b']);
  30306. * // => true
  30307. *
  30308. * _.has(other, 'a');
  30309. * // => false
  30310. */
  30311. function has(object, path) {
  30312. return object != null && hasPath(object, path, baseHas);
  30313. }
  30314. /**
  30315. * Checks if `path` is a direct or inherited property of `object`.
  30316. *
  30317. * @static
  30318. * @memberOf _
  30319. * @since 4.0.0
  30320. * @category Object
  30321. * @param {Object} object The object to query.
  30322. * @param {Array|string} path The path to check.
  30323. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30324. * @example
  30325. *
  30326. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30327. *
  30328. * _.hasIn(object, 'a');
  30329. * // => true
  30330. *
  30331. * _.hasIn(object, 'a.b');
  30332. * // => true
  30333. *
  30334. * _.hasIn(object, ['a', 'b']);
  30335. * // => true
  30336. *
  30337. * _.hasIn(object, 'b');
  30338. * // => false
  30339. */
  30340. function hasIn(object, path) {
  30341. return object != null && hasPath(object, path, baseHasIn);
  30342. }
  30343. /**
  30344. * Creates an object composed of the inverted keys and values of `object`.
  30345. * If `object` contains duplicate values, subsequent values overwrite
  30346. * property assignments of previous values.
  30347. *
  30348. * @static
  30349. * @memberOf _
  30350. * @since 0.7.0
  30351. * @category Object
  30352. * @param {Object} object The object to invert.
  30353. * @returns {Object} Returns the new inverted object.
  30354. * @example
  30355. *
  30356. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30357. *
  30358. * _.invert(object);
  30359. * // => { '1': 'c', '2': 'b' }
  30360. */
  30361. var invert = createInverter(function(result, value, key) {
  30362. if (value != null &&
  30363. typeof value.toString != 'function') {
  30364. value = nativeObjectToString.call(value);
  30365. }
  30366. result[value] = key;
  30367. }, constant(identity));
  30368. /**
  30369. * This method is like `_.invert` except that the inverted object is generated
  30370. * from the results of running each element of `object` thru `iteratee`. The
  30371. * corresponding inverted value of each inverted key is an array of keys
  30372. * responsible for generating the inverted value. The iteratee is invoked
  30373. * with one argument: (value).
  30374. *
  30375. * @static
  30376. * @memberOf _
  30377. * @since 4.1.0
  30378. * @category Object
  30379. * @param {Object} object The object to invert.
  30380. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30381. * @returns {Object} Returns the new inverted object.
  30382. * @example
  30383. *
  30384. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30385. *
  30386. * _.invertBy(object);
  30387. * // => { '1': ['a', 'c'], '2': ['b'] }
  30388. *
  30389. * _.invertBy(object, function(value) {
  30390. * return 'group' + value;
  30391. * });
  30392. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30393. */
  30394. var invertBy = createInverter(function(result, value, key) {
  30395. if (value != null &&
  30396. typeof value.toString != 'function') {
  30397. value = nativeObjectToString.call(value);
  30398. }
  30399. if (hasOwnProperty.call(result, value)) {
  30400. result[value].push(key);
  30401. } else {
  30402. result[value] = [key];
  30403. }
  30404. }, getIteratee);
  30405. /**
  30406. * Invokes the method at `path` of `object`.
  30407. *
  30408. * @static
  30409. * @memberOf _
  30410. * @since 4.0.0
  30411. * @category Object
  30412. * @param {Object} object The object to query.
  30413. * @param {Array|string} path The path of the method to invoke.
  30414. * @param {...*} [args] The arguments to invoke the method with.
  30415. * @returns {*} Returns the result of the invoked method.
  30416. * @example
  30417. *
  30418. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30419. *
  30420. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30421. * // => [2, 3]
  30422. */
  30423. var invoke = baseRest(baseInvoke);
  30424. /**
  30425. * Creates an array of the own enumerable property names of `object`.
  30426. *
  30427. * **Note:** Non-object values are coerced to objects. See the
  30428. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30429. * for more details.
  30430. *
  30431. * @static
  30432. * @since 0.1.0
  30433. * @memberOf _
  30434. * @category Object
  30435. * @param {Object} object The object to query.
  30436. * @returns {Array} Returns the array of property names.
  30437. * @example
  30438. *
  30439. * function Foo() {
  30440. * this.a = 1;
  30441. * this.b = 2;
  30442. * }
  30443. *
  30444. * Foo.prototype.c = 3;
  30445. *
  30446. * _.keys(new Foo);
  30447. * // => ['a', 'b'] (iteration order is not guaranteed)
  30448. *
  30449. * _.keys('hi');
  30450. * // => ['0', '1']
  30451. */
  30452. function keys(object) {
  30453. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30454. }
  30455. /**
  30456. * Creates an array of the own and inherited enumerable property names of `object`.
  30457. *
  30458. * **Note:** Non-object values are coerced to objects.
  30459. *
  30460. * @static
  30461. * @memberOf _
  30462. * @since 3.0.0
  30463. * @category Object
  30464. * @param {Object} object The object to query.
  30465. * @returns {Array} Returns the array of property names.
  30466. * @example
  30467. *
  30468. * function Foo() {
  30469. * this.a = 1;
  30470. * this.b = 2;
  30471. * }
  30472. *
  30473. * Foo.prototype.c = 3;
  30474. *
  30475. * _.keysIn(new Foo);
  30476. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30477. */
  30478. function keysIn(object) {
  30479. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30480. }
  30481. /**
  30482. * The opposite of `_.mapValues`; this method creates an object with the
  30483. * same values as `object` and keys generated by running each own enumerable
  30484. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30485. * with three arguments: (value, key, object).
  30486. *
  30487. * @static
  30488. * @memberOf _
  30489. * @since 3.8.0
  30490. * @category Object
  30491. * @param {Object} object The object to iterate over.
  30492. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30493. * @returns {Object} Returns the new mapped object.
  30494. * @see _.mapValues
  30495. * @example
  30496. *
  30497. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30498. * return key + value;
  30499. * });
  30500. * // => { 'a1': 1, 'b2': 2 }
  30501. */
  30502. function mapKeys(object, iteratee) {
  30503. var result = {};
  30504. iteratee = getIteratee(iteratee, 3);
  30505. baseForOwn(object, function(value, key, object) {
  30506. baseAssignValue(result, iteratee(value, key, object), value);
  30507. });
  30508. return result;
  30509. }
  30510. /**
  30511. * Creates an object with the same keys as `object` and values generated
  30512. * by running each own enumerable string keyed property of `object` thru
  30513. * `iteratee`. The iteratee is invoked with three arguments:
  30514. * (value, key, object).
  30515. *
  30516. * @static
  30517. * @memberOf _
  30518. * @since 2.4.0
  30519. * @category Object
  30520. * @param {Object} object The object to iterate over.
  30521. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30522. * @returns {Object} Returns the new mapped object.
  30523. * @see _.mapKeys
  30524. * @example
  30525. *
  30526. * var users = {
  30527. * 'fred': { 'user': 'fred', 'age': 40 },
  30528. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30529. * };
  30530. *
  30531. * _.mapValues(users, function(o) { return o.age; });
  30532. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30533. *
  30534. * // The `_.property` iteratee shorthand.
  30535. * _.mapValues(users, 'age');
  30536. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30537. */
  30538. function mapValues(object, iteratee) {
  30539. var result = {};
  30540. iteratee = getIteratee(iteratee, 3);
  30541. baseForOwn(object, function(value, key, object) {
  30542. baseAssignValue(result, key, iteratee(value, key, object));
  30543. });
  30544. return result;
  30545. }
  30546. /**
  30547. * This method is like `_.assign` except that it recursively merges own and
  30548. * inherited enumerable string keyed properties of source objects into the
  30549. * destination object. Source properties that resolve to `undefined` are
  30550. * skipped if a destination value exists. Array and plain object properties
  30551. * are merged recursively. Other objects and value types are overridden by
  30552. * assignment. Source objects are applied from left to right. Subsequent
  30553. * sources overwrite property assignments of previous sources.
  30554. *
  30555. * **Note:** This method mutates `object`.
  30556. *
  30557. * @static
  30558. * @memberOf _
  30559. * @since 0.5.0
  30560. * @category Object
  30561. * @param {Object} object The destination object.
  30562. * @param {...Object} [sources] The source objects.
  30563. * @returns {Object} Returns `object`.
  30564. * @example
  30565. *
  30566. * var object = {
  30567. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30568. * };
  30569. *
  30570. * var other = {
  30571. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30572. * };
  30573. *
  30574. * _.merge(object, other);
  30575. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30576. */
  30577. var merge = createAssigner(function(object, source, srcIndex) {
  30578. baseMerge(object, source, srcIndex);
  30579. });
  30580. /**
  30581. * This method is like `_.merge` except that it accepts `customizer` which
  30582. * is invoked to produce the merged values of the destination and source
  30583. * properties. If `customizer` returns `undefined`, merging is handled by the
  30584. * method instead. The `customizer` is invoked with six arguments:
  30585. * (objValue, srcValue, key, object, source, stack).
  30586. *
  30587. * **Note:** This method mutates `object`.
  30588. *
  30589. * @static
  30590. * @memberOf _
  30591. * @since 4.0.0
  30592. * @category Object
  30593. * @param {Object} object The destination object.
  30594. * @param {...Object} sources The source objects.
  30595. * @param {Function} customizer The function to customize assigned values.
  30596. * @returns {Object} Returns `object`.
  30597. * @example
  30598. *
  30599. * function customizer(objValue, srcValue) {
  30600. * if (_.isArray(objValue)) {
  30601. * return objValue.concat(srcValue);
  30602. * }
  30603. * }
  30604. *
  30605. * var object = { 'a': [1], 'b': [2] };
  30606. * var other = { 'a': [3], 'b': [4] };
  30607. *
  30608. * _.mergeWith(object, other, customizer);
  30609. * // => { 'a': [1, 3], 'b': [2, 4] }
  30610. */
  30611. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30612. baseMerge(object, source, srcIndex, customizer);
  30613. });
  30614. /**
  30615. * The opposite of `_.pick`; this method creates an object composed of the
  30616. * own and inherited enumerable property paths of `object` that are not omitted.
  30617. *
  30618. * **Note:** This method is considerably slower than `_.pick`.
  30619. *
  30620. * @static
  30621. * @since 0.1.0
  30622. * @memberOf _
  30623. * @category Object
  30624. * @param {Object} object The source object.
  30625. * @param {...(string|string[])} [paths] The property paths to omit.
  30626. * @returns {Object} Returns the new object.
  30627. * @example
  30628. *
  30629. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30630. *
  30631. * _.omit(object, ['a', 'c']);
  30632. * // => { 'b': '2' }
  30633. */
  30634. var omit = flatRest(function(object, paths) {
  30635. var result = {};
  30636. if (object == null) {
  30637. return result;
  30638. }
  30639. var isDeep = false;
  30640. paths = arrayMap(paths, function(path) {
  30641. path = castPath(path, object);
  30642. isDeep || (isDeep = path.length > 1);
  30643. return path;
  30644. });
  30645. copyObject(object, getAllKeysIn(object), result);
  30646. if (isDeep) {
  30647. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30648. }
  30649. var length = paths.length;
  30650. while (length--) {
  30651. baseUnset(result, paths[length]);
  30652. }
  30653. return result;
  30654. });
  30655. /**
  30656. * The opposite of `_.pickBy`; this method creates an object composed of
  30657. * the own and inherited enumerable string keyed properties of `object` that
  30658. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30659. * arguments: (value, key).
  30660. *
  30661. * @static
  30662. * @memberOf _
  30663. * @since 4.0.0
  30664. * @category Object
  30665. * @param {Object} object The source object.
  30666. * @param {Function} [predicate=_.identity] The function invoked per property.
  30667. * @returns {Object} Returns the new object.
  30668. * @example
  30669. *
  30670. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30671. *
  30672. * _.omitBy(object, _.isNumber);
  30673. * // => { 'b': '2' }
  30674. */
  30675. function omitBy(object, predicate) {
  30676. return pickBy(object, negate(getIteratee(predicate)));
  30677. }
  30678. /**
  30679. * Creates an object composed of the picked `object` properties.
  30680. *
  30681. * @static
  30682. * @since 0.1.0
  30683. * @memberOf _
  30684. * @category Object
  30685. * @param {Object} object The source object.
  30686. * @param {...(string|string[])} [paths] The property paths to pick.
  30687. * @returns {Object} Returns the new object.
  30688. * @example
  30689. *
  30690. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30691. *
  30692. * _.pick(object, ['a', 'c']);
  30693. * // => { 'a': 1, 'c': 3 }
  30694. */
  30695. var pick = flatRest(function(object, paths) {
  30696. return object == null ? {} : basePick(object, paths);
  30697. });
  30698. /**
  30699. * Creates an object composed of the `object` properties `predicate` returns
  30700. * truthy for. The predicate is invoked with two arguments: (value, key).
  30701. *
  30702. * @static
  30703. * @memberOf _
  30704. * @since 4.0.0
  30705. * @category Object
  30706. * @param {Object} object The source object.
  30707. * @param {Function} [predicate=_.identity] The function invoked per property.
  30708. * @returns {Object} Returns the new object.
  30709. * @example
  30710. *
  30711. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30712. *
  30713. * _.pickBy(object, _.isNumber);
  30714. * // => { 'a': 1, 'c': 3 }
  30715. */
  30716. function pickBy(object, predicate) {
  30717. if (object == null) {
  30718. return {};
  30719. }
  30720. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30721. return [prop];
  30722. });
  30723. predicate = getIteratee(predicate);
  30724. return basePickBy(object, props, function(value, path) {
  30725. return predicate(value, path[0]);
  30726. });
  30727. }
  30728. /**
  30729. * This method is like `_.get` except that if the resolved value is a
  30730. * function it's invoked with the `this` binding of its parent object and
  30731. * its result is returned.
  30732. *
  30733. * @static
  30734. * @since 0.1.0
  30735. * @memberOf _
  30736. * @category Object
  30737. * @param {Object} object The object to query.
  30738. * @param {Array|string} path The path of the property to resolve.
  30739. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30740. * @returns {*} Returns the resolved value.
  30741. * @example
  30742. *
  30743. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  30744. *
  30745. * _.result(object, 'a[0].b.c1');
  30746. * // => 3
  30747. *
  30748. * _.result(object, 'a[0].b.c2');
  30749. * // => 4
  30750. *
  30751. * _.result(object, 'a[0].b.c3', 'default');
  30752. * // => 'default'
  30753. *
  30754. * _.result(object, 'a[0].b.c3', _.constant('default'));
  30755. * // => 'default'
  30756. */
  30757. function result(object, path, defaultValue) {
  30758. path = castPath(path, object);
  30759. var index = -1,
  30760. length = path.length;
  30761. // Ensure the loop is entered when path is empty.
  30762. if (!length) {
  30763. length = 1;
  30764. object = undefined;
  30765. }
  30766. while (++index < length) {
  30767. var value = object == null ? undefined : object[toKey(path[index])];
  30768. if (value === undefined) {
  30769. index = length;
  30770. value = defaultValue;
  30771. }
  30772. object = isFunction(value) ? value.call(object) : value;
  30773. }
  30774. return object;
  30775. }
  30776. /**
  30777. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  30778. * it's created. Arrays are created for missing index properties while objects
  30779. * are created for all other missing properties. Use `_.setWith` to customize
  30780. * `path` creation.
  30781. *
  30782. * **Note:** This method mutates `object`.
  30783. *
  30784. * @static
  30785. * @memberOf _
  30786. * @since 3.7.0
  30787. * @category Object
  30788. * @param {Object} object The object to modify.
  30789. * @param {Array|string} path The path of the property to set.
  30790. * @param {*} value The value to set.
  30791. * @returns {Object} Returns `object`.
  30792. * @example
  30793. *
  30794. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30795. *
  30796. * _.set(object, 'a[0].b.c', 4);
  30797. * console.log(object.a[0].b.c);
  30798. * // => 4
  30799. *
  30800. * _.set(object, ['x', '0', 'y', 'z'], 5);
  30801. * console.log(object.x[0].y.z);
  30802. * // => 5
  30803. */
  30804. function set(object, path, value) {
  30805. return object == null ? object : baseSet(object, path, value);
  30806. }
  30807. /**
  30808. * This method is like `_.set` except that it accepts `customizer` which is
  30809. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30810. * path creation is handled by the method instead. The `customizer` is invoked
  30811. * with three arguments: (nsValue, key, nsObject).
  30812. *
  30813. * **Note:** This method mutates `object`.
  30814. *
  30815. * @static
  30816. * @memberOf _
  30817. * @since 4.0.0
  30818. * @category Object
  30819. * @param {Object} object The object to modify.
  30820. * @param {Array|string} path The path of the property to set.
  30821. * @param {*} value The value to set.
  30822. * @param {Function} [customizer] The function to customize assigned values.
  30823. * @returns {Object} Returns `object`.
  30824. * @example
  30825. *
  30826. * var object = {};
  30827. *
  30828. * _.setWith(object, '[0][1]', 'a', Object);
  30829. * // => { '0': { '1': 'a' } }
  30830. */
  30831. function setWith(object, path, value, customizer) {
  30832. customizer = typeof customizer == 'function' ? customizer : undefined;
  30833. return object == null ? object : baseSet(object, path, value, customizer);
  30834. }
  30835. /**
  30836. * Creates an array of own enumerable string keyed-value pairs for `object`
  30837. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  30838. * entries are returned.
  30839. *
  30840. * @static
  30841. * @memberOf _
  30842. * @since 4.0.0
  30843. * @alias entries
  30844. * @category Object
  30845. * @param {Object} object The object to query.
  30846. * @returns {Array} Returns the key-value pairs.
  30847. * @example
  30848. *
  30849. * function Foo() {
  30850. * this.a = 1;
  30851. * this.b = 2;
  30852. * }
  30853. *
  30854. * Foo.prototype.c = 3;
  30855. *
  30856. * _.toPairs(new Foo);
  30857. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  30858. */
  30859. var toPairs = createToPairs(keys);
  30860. /**
  30861. * Creates an array of own and inherited enumerable string keyed-value pairs
  30862. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  30863. * or set, its entries are returned.
  30864. *
  30865. * @static
  30866. * @memberOf _
  30867. * @since 4.0.0
  30868. * @alias entriesIn
  30869. * @category Object
  30870. * @param {Object} object The object to query.
  30871. * @returns {Array} Returns the key-value pairs.
  30872. * @example
  30873. *
  30874. * function Foo() {
  30875. * this.a = 1;
  30876. * this.b = 2;
  30877. * }
  30878. *
  30879. * Foo.prototype.c = 3;
  30880. *
  30881. * _.toPairsIn(new Foo);
  30882. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  30883. */
  30884. var toPairsIn = createToPairs(keysIn);
  30885. /**
  30886. * An alternative to `_.reduce`; this method transforms `object` to a new
  30887. * `accumulator` object which is the result of running each of its own
  30888. * enumerable string keyed properties thru `iteratee`, with each invocation
  30889. * potentially mutating the `accumulator` object. If `accumulator` is not
  30890. * provided, a new object with the same `[[Prototype]]` will be used. The
  30891. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  30892. * Iteratee functions may exit iteration early by explicitly returning `false`.
  30893. *
  30894. * @static
  30895. * @memberOf _
  30896. * @since 1.3.0
  30897. * @category Object
  30898. * @param {Object} object The object to iterate over.
  30899. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30900. * @param {*} [accumulator] The custom accumulator value.
  30901. * @returns {*} Returns the accumulated value.
  30902. * @example
  30903. *
  30904. * _.transform([2, 3, 4], function(result, n) {
  30905. * result.push(n *= n);
  30906. * return n % 2 == 0;
  30907. * }, []);
  30908. * // => [4, 9]
  30909. *
  30910. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  30911. * (result[value] || (result[value] = [])).push(key);
  30912. * }, {});
  30913. * // => { '1': ['a', 'c'], '2': ['b'] }
  30914. */
  30915. function transform(object, iteratee, accumulator) {
  30916. var isArr = isArray(object),
  30917. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  30918. iteratee = getIteratee(iteratee, 4);
  30919. if (accumulator == null) {
  30920. var Ctor = object && object.constructor;
  30921. if (isArrLike) {
  30922. accumulator = isArr ? new Ctor : [];
  30923. }
  30924. else if (isObject(object)) {
  30925. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  30926. }
  30927. else {
  30928. accumulator = {};
  30929. }
  30930. }
  30931. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  30932. return iteratee(accumulator, value, index, object);
  30933. });
  30934. return accumulator;
  30935. }
  30936. /**
  30937. * Removes the property at `path` of `object`.
  30938. *
  30939. * **Note:** This method mutates `object`.
  30940. *
  30941. * @static
  30942. * @memberOf _
  30943. * @since 4.0.0
  30944. * @category Object
  30945. * @param {Object} object The object to modify.
  30946. * @param {Array|string} path The path of the property to unset.
  30947. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  30948. * @example
  30949. *
  30950. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  30951. * _.unset(object, 'a[0].b.c');
  30952. * // => true
  30953. *
  30954. * console.log(object);
  30955. * // => { 'a': [{ 'b': {} }] };
  30956. *
  30957. * _.unset(object, ['a', '0', 'b', 'c']);
  30958. * // => true
  30959. *
  30960. * console.log(object);
  30961. * // => { 'a': [{ 'b': {} }] };
  30962. */
  30963. function unset(object, path) {
  30964. return object == null ? true : baseUnset(object, path);
  30965. }
  30966. /**
  30967. * This method is like `_.set` except that accepts `updater` to produce the
  30968. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  30969. * is invoked with one argument: (value).
  30970. *
  30971. * **Note:** This method mutates `object`.
  30972. *
  30973. * @static
  30974. * @memberOf _
  30975. * @since 4.6.0
  30976. * @category Object
  30977. * @param {Object} object The object to modify.
  30978. * @param {Array|string} path The path of the property to set.
  30979. * @param {Function} updater The function to produce the updated value.
  30980. * @returns {Object} Returns `object`.
  30981. * @example
  30982. *
  30983. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30984. *
  30985. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  30986. * console.log(object.a[0].b.c);
  30987. * // => 9
  30988. *
  30989. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  30990. * console.log(object.x[0].y.z);
  30991. * // => 0
  30992. */
  30993. function update(object, path, updater) {
  30994. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  30995. }
  30996. /**
  30997. * This method is like `_.update` except that it accepts `customizer` which is
  30998. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30999. * path creation is handled by the method instead. The `customizer` is invoked
  31000. * with three arguments: (nsValue, key, nsObject).
  31001. *
  31002. * **Note:** This method mutates `object`.
  31003. *
  31004. * @static
  31005. * @memberOf _
  31006. * @since 4.6.0
  31007. * @category Object
  31008. * @param {Object} object The object to modify.
  31009. * @param {Array|string} path The path of the property to set.
  31010. * @param {Function} updater The function to produce the updated value.
  31011. * @param {Function} [customizer] The function to customize assigned values.
  31012. * @returns {Object} Returns `object`.
  31013. * @example
  31014. *
  31015. * var object = {};
  31016. *
  31017. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31018. * // => { '0': { '1': 'a' } }
  31019. */
  31020. function updateWith(object, path, updater, customizer) {
  31021. customizer = typeof customizer == 'function' ? customizer : undefined;
  31022. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31023. }
  31024. /**
  31025. * Creates an array of the own enumerable string keyed property values of `object`.
  31026. *
  31027. * **Note:** Non-object values are coerced to objects.
  31028. *
  31029. * @static
  31030. * @since 0.1.0
  31031. * @memberOf _
  31032. * @category Object
  31033. * @param {Object} object The object to query.
  31034. * @returns {Array} Returns the array of property values.
  31035. * @example
  31036. *
  31037. * function Foo() {
  31038. * this.a = 1;
  31039. * this.b = 2;
  31040. * }
  31041. *
  31042. * Foo.prototype.c = 3;
  31043. *
  31044. * _.values(new Foo);
  31045. * // => [1, 2] (iteration order is not guaranteed)
  31046. *
  31047. * _.values('hi');
  31048. * // => ['h', 'i']
  31049. */
  31050. function values(object) {
  31051. return object == null ? [] : baseValues(object, keys(object));
  31052. }
  31053. /**
  31054. * Creates an array of the own and inherited enumerable string keyed property
  31055. * values of `object`.
  31056. *
  31057. * **Note:** Non-object values are coerced to objects.
  31058. *
  31059. * @static
  31060. * @memberOf _
  31061. * @since 3.0.0
  31062. * @category Object
  31063. * @param {Object} object The object to query.
  31064. * @returns {Array} Returns the array of property values.
  31065. * @example
  31066. *
  31067. * function Foo() {
  31068. * this.a = 1;
  31069. * this.b = 2;
  31070. * }
  31071. *
  31072. * Foo.prototype.c = 3;
  31073. *
  31074. * _.valuesIn(new Foo);
  31075. * // => [1, 2, 3] (iteration order is not guaranteed)
  31076. */
  31077. function valuesIn(object) {
  31078. return object == null ? [] : baseValues(object, keysIn(object));
  31079. }
  31080. /*------------------------------------------------------------------------*/
  31081. /**
  31082. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31083. *
  31084. * @static
  31085. * @memberOf _
  31086. * @since 4.0.0
  31087. * @category Number
  31088. * @param {number} number The number to clamp.
  31089. * @param {number} [lower] The lower bound.
  31090. * @param {number} upper The upper bound.
  31091. * @returns {number} Returns the clamped number.
  31092. * @example
  31093. *
  31094. * _.clamp(-10, -5, 5);
  31095. * // => -5
  31096. *
  31097. * _.clamp(10, -5, 5);
  31098. * // => 5
  31099. */
  31100. function clamp(number, lower, upper) {
  31101. if (upper === undefined) {
  31102. upper = lower;
  31103. lower = undefined;
  31104. }
  31105. if (upper !== undefined) {
  31106. upper = toNumber(upper);
  31107. upper = upper === upper ? upper : 0;
  31108. }
  31109. if (lower !== undefined) {
  31110. lower = toNumber(lower);
  31111. lower = lower === lower ? lower : 0;
  31112. }
  31113. return baseClamp(toNumber(number), lower, upper);
  31114. }
  31115. /**
  31116. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31117. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31118. * If `start` is greater than `end` the params are swapped to support
  31119. * negative ranges.
  31120. *
  31121. * @static
  31122. * @memberOf _
  31123. * @since 3.3.0
  31124. * @category Number
  31125. * @param {number} number The number to check.
  31126. * @param {number} [start=0] The start of the range.
  31127. * @param {number} end The end of the range.
  31128. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31129. * @see _.range, _.rangeRight
  31130. * @example
  31131. *
  31132. * _.inRange(3, 2, 4);
  31133. * // => true
  31134. *
  31135. * _.inRange(4, 8);
  31136. * // => true
  31137. *
  31138. * _.inRange(4, 2);
  31139. * // => false
  31140. *
  31141. * _.inRange(2, 2);
  31142. * // => false
  31143. *
  31144. * _.inRange(1.2, 2);
  31145. * // => true
  31146. *
  31147. * _.inRange(5.2, 4);
  31148. * // => false
  31149. *
  31150. * _.inRange(-3, -2, -6);
  31151. * // => true
  31152. */
  31153. function inRange(number, start, end) {
  31154. start = toFinite(start);
  31155. if (end === undefined) {
  31156. end = start;
  31157. start = 0;
  31158. } else {
  31159. end = toFinite(end);
  31160. }
  31161. number = toNumber(number);
  31162. return baseInRange(number, start, end);
  31163. }
  31164. /**
  31165. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31166. * If only one argument is provided a number between `0` and the given number
  31167. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31168. * floats, a floating-point number is returned instead of an integer.
  31169. *
  31170. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31171. * floating-point values which can produce unexpected results.
  31172. *
  31173. * @static
  31174. * @memberOf _
  31175. * @since 0.7.0
  31176. * @category Number
  31177. * @param {number} [lower=0] The lower bound.
  31178. * @param {number} [upper=1] The upper bound.
  31179. * @param {boolean} [floating] Specify returning a floating-point number.
  31180. * @returns {number} Returns the random number.
  31181. * @example
  31182. *
  31183. * _.random(0, 5);
  31184. * // => an integer between 0 and 5
  31185. *
  31186. * _.random(5);
  31187. * // => also an integer between 0 and 5
  31188. *
  31189. * _.random(5, true);
  31190. * // => a floating-point number between 0 and 5
  31191. *
  31192. * _.random(1.2, 5.2);
  31193. * // => a floating-point number between 1.2 and 5.2
  31194. */
  31195. function random(lower, upper, floating) {
  31196. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31197. upper = floating = undefined;
  31198. }
  31199. if (floating === undefined) {
  31200. if (typeof upper == 'boolean') {
  31201. floating = upper;
  31202. upper = undefined;
  31203. }
  31204. else if (typeof lower == 'boolean') {
  31205. floating = lower;
  31206. lower = undefined;
  31207. }
  31208. }
  31209. if (lower === undefined && upper === undefined) {
  31210. lower = 0;
  31211. upper = 1;
  31212. }
  31213. else {
  31214. lower = toFinite(lower);
  31215. if (upper === undefined) {
  31216. upper = lower;
  31217. lower = 0;
  31218. } else {
  31219. upper = toFinite(upper);
  31220. }
  31221. }
  31222. if (lower > upper) {
  31223. var temp = lower;
  31224. lower = upper;
  31225. upper = temp;
  31226. }
  31227. if (floating || lower % 1 || upper % 1) {
  31228. var rand = nativeRandom();
  31229. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31230. }
  31231. return baseRandom(lower, upper);
  31232. }
  31233. /*------------------------------------------------------------------------*/
  31234. /**
  31235. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31236. *
  31237. * @static
  31238. * @memberOf _
  31239. * @since 3.0.0
  31240. * @category String
  31241. * @param {string} [string=''] The string to convert.
  31242. * @returns {string} Returns the camel cased string.
  31243. * @example
  31244. *
  31245. * _.camelCase('Foo Bar');
  31246. * // => 'fooBar'
  31247. *
  31248. * _.camelCase('--foo-bar--');
  31249. * // => 'fooBar'
  31250. *
  31251. * _.camelCase('__FOO_BAR__');
  31252. * // => 'fooBar'
  31253. */
  31254. var camelCase = createCompounder(function(result, word, index) {
  31255. word = word.toLowerCase();
  31256. return result + (index ? capitalize(word) : word);
  31257. });
  31258. /**
  31259. * Converts the first character of `string` to upper case and the remaining
  31260. * to lower case.
  31261. *
  31262. * @static
  31263. * @memberOf _
  31264. * @since 3.0.0
  31265. * @category String
  31266. * @param {string} [string=''] The string to capitalize.
  31267. * @returns {string} Returns the capitalized string.
  31268. * @example
  31269. *
  31270. * _.capitalize('FRED');
  31271. * // => 'Fred'
  31272. */
  31273. function capitalize(string) {
  31274. return upperFirst(toString(string).toLowerCase());
  31275. }
  31276. /**
  31277. * Deburrs `string` by converting
  31278. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31279. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31280. * letters to basic Latin letters and removing
  31281. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31282. *
  31283. * @static
  31284. * @memberOf _
  31285. * @since 3.0.0
  31286. * @category String
  31287. * @param {string} [string=''] The string to deburr.
  31288. * @returns {string} Returns the deburred string.
  31289. * @example
  31290. *
  31291. * _.deburr('déjà vu');
  31292. * // => 'deja vu'
  31293. */
  31294. function deburr(string) {
  31295. string = toString(string);
  31296. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31297. }
  31298. /**
  31299. * Checks if `string` ends with the given target string.
  31300. *
  31301. * @static
  31302. * @memberOf _
  31303. * @since 3.0.0
  31304. * @category String
  31305. * @param {string} [string=''] The string to inspect.
  31306. * @param {string} [target] The string to search for.
  31307. * @param {number} [position=string.length] The position to search up to.
  31308. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31309. * else `false`.
  31310. * @example
  31311. *
  31312. * _.endsWith('abc', 'c');
  31313. * // => true
  31314. *
  31315. * _.endsWith('abc', 'b');
  31316. * // => false
  31317. *
  31318. * _.endsWith('abc', 'b', 2);
  31319. * // => true
  31320. */
  31321. function endsWith(string, target, position) {
  31322. string = toString(string);
  31323. target = baseToString(target);
  31324. var length = string.length;
  31325. position = position === undefined
  31326. ? length
  31327. : baseClamp(toInteger(position), 0, length);
  31328. var end = position;
  31329. position -= target.length;
  31330. return position >= 0 && string.slice(position, end) == target;
  31331. }
  31332. /**
  31333. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31334. * corresponding HTML entities.
  31335. *
  31336. * **Note:** No other characters are escaped. To escape additional
  31337. * characters use a third-party library like [_he_](https://mths.be/he).
  31338. *
  31339. * Though the ">" character is escaped for symmetry, characters like
  31340. * ">" and "/" don't need escaping in HTML and have no special meaning
  31341. * unless they're part of a tag or unquoted attribute value. See
  31342. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31343. * (under "semi-related fun fact") for more details.
  31344. *
  31345. * When working with HTML you should always
  31346. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31347. * XSS vectors.
  31348. *
  31349. * @static
  31350. * @since 0.1.0
  31351. * @memberOf _
  31352. * @category String
  31353. * @param {string} [string=''] The string to escape.
  31354. * @returns {string} Returns the escaped string.
  31355. * @example
  31356. *
  31357. * _.escape('fred, barney, & pebbles');
  31358. * // => 'fred, barney, &amp; pebbles'
  31359. */
  31360. function escape(string) {
  31361. string = toString(string);
  31362. return (string && reHasUnescapedHtml.test(string))
  31363. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31364. : string;
  31365. }
  31366. /**
  31367. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31368. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31369. *
  31370. * @static
  31371. * @memberOf _
  31372. * @since 3.0.0
  31373. * @category String
  31374. * @param {string} [string=''] The string to escape.
  31375. * @returns {string} Returns the escaped string.
  31376. * @example
  31377. *
  31378. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31379. * // => '\[lodash\]\(https://lodash\.com/\)'
  31380. */
  31381. function escapeRegExp(string) {
  31382. string = toString(string);
  31383. return (string && reHasRegExpChar.test(string))
  31384. ? string.replace(reRegExpChar, '\\$&')
  31385. : string;
  31386. }
  31387. /**
  31388. * Converts `string` to
  31389. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31390. *
  31391. * @static
  31392. * @memberOf _
  31393. * @since 3.0.0
  31394. * @category String
  31395. * @param {string} [string=''] The string to convert.
  31396. * @returns {string} Returns the kebab cased string.
  31397. * @example
  31398. *
  31399. * _.kebabCase('Foo Bar');
  31400. * // => 'foo-bar'
  31401. *
  31402. * _.kebabCase('fooBar');
  31403. * // => 'foo-bar'
  31404. *
  31405. * _.kebabCase('__FOO_BAR__');
  31406. * // => 'foo-bar'
  31407. */
  31408. var kebabCase = createCompounder(function(result, word, index) {
  31409. return result + (index ? '-' : '') + word.toLowerCase();
  31410. });
  31411. /**
  31412. * Converts `string`, as space separated words, to lower case.
  31413. *
  31414. * @static
  31415. * @memberOf _
  31416. * @since 4.0.0
  31417. * @category String
  31418. * @param {string} [string=''] The string to convert.
  31419. * @returns {string} Returns the lower cased string.
  31420. * @example
  31421. *
  31422. * _.lowerCase('--Foo-Bar--');
  31423. * // => 'foo bar'
  31424. *
  31425. * _.lowerCase('fooBar');
  31426. * // => 'foo bar'
  31427. *
  31428. * _.lowerCase('__FOO_BAR__');
  31429. * // => 'foo bar'
  31430. */
  31431. var lowerCase = createCompounder(function(result, word, index) {
  31432. return result + (index ? ' ' : '') + word.toLowerCase();
  31433. });
  31434. /**
  31435. * Converts the first character of `string` to lower case.
  31436. *
  31437. * @static
  31438. * @memberOf _
  31439. * @since 4.0.0
  31440. * @category String
  31441. * @param {string} [string=''] The string to convert.
  31442. * @returns {string} Returns the converted string.
  31443. * @example
  31444. *
  31445. * _.lowerFirst('Fred');
  31446. * // => 'fred'
  31447. *
  31448. * _.lowerFirst('FRED');
  31449. * // => 'fRED'
  31450. */
  31451. var lowerFirst = createCaseFirst('toLowerCase');
  31452. /**
  31453. * Pads `string` on the left and right sides if it's shorter than `length`.
  31454. * Padding characters are truncated if they can't be evenly divided by `length`.
  31455. *
  31456. * @static
  31457. * @memberOf _
  31458. * @since 3.0.0
  31459. * @category String
  31460. * @param {string} [string=''] The string to pad.
  31461. * @param {number} [length=0] The padding length.
  31462. * @param {string} [chars=' '] The string used as padding.
  31463. * @returns {string} Returns the padded string.
  31464. * @example
  31465. *
  31466. * _.pad('abc', 8);
  31467. * // => ' abc '
  31468. *
  31469. * _.pad('abc', 8, '_-');
  31470. * // => '_-abc_-_'
  31471. *
  31472. * _.pad('abc', 3);
  31473. * // => 'abc'
  31474. */
  31475. function pad(string, length, chars) {
  31476. string = toString(string);
  31477. length = toInteger(length);
  31478. var strLength = length ? stringSize(string) : 0;
  31479. if (!length || strLength >= length) {
  31480. return string;
  31481. }
  31482. var mid = (length - strLength) / 2;
  31483. return (
  31484. createPadding(nativeFloor(mid), chars) +
  31485. string +
  31486. createPadding(nativeCeil(mid), chars)
  31487. );
  31488. }
  31489. /**
  31490. * Pads `string` on the right side if it's shorter than `length`. Padding
  31491. * characters are truncated if they exceed `length`.
  31492. *
  31493. * @static
  31494. * @memberOf _
  31495. * @since 4.0.0
  31496. * @category String
  31497. * @param {string} [string=''] The string to pad.
  31498. * @param {number} [length=0] The padding length.
  31499. * @param {string} [chars=' '] The string used as padding.
  31500. * @returns {string} Returns the padded string.
  31501. * @example
  31502. *
  31503. * _.padEnd('abc', 6);
  31504. * // => 'abc '
  31505. *
  31506. * _.padEnd('abc', 6, '_-');
  31507. * // => 'abc_-_'
  31508. *
  31509. * _.padEnd('abc', 3);
  31510. * // => 'abc'
  31511. */
  31512. function padEnd(string, length, chars) {
  31513. string = toString(string);
  31514. length = toInteger(length);
  31515. var strLength = length ? stringSize(string) : 0;
  31516. return (length && strLength < length)
  31517. ? (string + createPadding(length - strLength, chars))
  31518. : string;
  31519. }
  31520. /**
  31521. * Pads `string` on the left side if it's shorter than `length`. Padding
  31522. * characters are truncated if they exceed `length`.
  31523. *
  31524. * @static
  31525. * @memberOf _
  31526. * @since 4.0.0
  31527. * @category String
  31528. * @param {string} [string=''] The string to pad.
  31529. * @param {number} [length=0] The padding length.
  31530. * @param {string} [chars=' '] The string used as padding.
  31531. * @returns {string} Returns the padded string.
  31532. * @example
  31533. *
  31534. * _.padStart('abc', 6);
  31535. * // => ' abc'
  31536. *
  31537. * _.padStart('abc', 6, '_-');
  31538. * // => '_-_abc'
  31539. *
  31540. * _.padStart('abc', 3);
  31541. * // => 'abc'
  31542. */
  31543. function padStart(string, length, chars) {
  31544. string = toString(string);
  31545. length = toInteger(length);
  31546. var strLength = length ? stringSize(string) : 0;
  31547. return (length && strLength < length)
  31548. ? (createPadding(length - strLength, chars) + string)
  31549. : string;
  31550. }
  31551. /**
  31552. * Converts `string` to an integer of the specified radix. If `radix` is
  31553. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31554. * hexadecimal, in which case a `radix` of `16` is used.
  31555. *
  31556. * **Note:** This method aligns with the
  31557. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31558. *
  31559. * @static
  31560. * @memberOf _
  31561. * @since 1.1.0
  31562. * @category String
  31563. * @param {string} string The string to convert.
  31564. * @param {number} [radix=10] The radix to interpret `value` by.
  31565. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31566. * @returns {number} Returns the converted integer.
  31567. * @example
  31568. *
  31569. * _.parseInt('08');
  31570. * // => 8
  31571. *
  31572. * _.map(['6', '08', '10'], _.parseInt);
  31573. * // => [6, 8, 10]
  31574. */
  31575. function parseInt(string, radix, guard) {
  31576. if (guard || radix == null) {
  31577. radix = 0;
  31578. } else if (radix) {
  31579. radix = +radix;
  31580. }
  31581. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31582. }
  31583. /**
  31584. * Repeats the given string `n` times.
  31585. *
  31586. * @static
  31587. * @memberOf _
  31588. * @since 3.0.0
  31589. * @category String
  31590. * @param {string} [string=''] The string to repeat.
  31591. * @param {number} [n=1] The number of times to repeat the string.
  31592. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31593. * @returns {string} Returns the repeated string.
  31594. * @example
  31595. *
  31596. * _.repeat('*', 3);
  31597. * // => '***'
  31598. *
  31599. * _.repeat('abc', 2);
  31600. * // => 'abcabc'
  31601. *
  31602. * _.repeat('abc', 0);
  31603. * // => ''
  31604. */
  31605. function repeat(string, n, guard) {
  31606. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31607. n = 1;
  31608. } else {
  31609. n = toInteger(n);
  31610. }
  31611. return baseRepeat(toString(string), n);
  31612. }
  31613. /**
  31614. * Replaces matches for `pattern` in `string` with `replacement`.
  31615. *
  31616. * **Note:** This method is based on
  31617. * [`String#replace`](https://mdn.io/String/replace).
  31618. *
  31619. * @static
  31620. * @memberOf _
  31621. * @since 4.0.0
  31622. * @category String
  31623. * @param {string} [string=''] The string to modify.
  31624. * @param {RegExp|string} pattern The pattern to replace.
  31625. * @param {Function|string} replacement The match replacement.
  31626. * @returns {string} Returns the modified string.
  31627. * @example
  31628. *
  31629. * _.replace('Hi Fred', 'Fred', 'Barney');
  31630. * // => 'Hi Barney'
  31631. */
  31632. function replace() {
  31633. var args = arguments,
  31634. string = toString(args[0]);
  31635. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31636. }
  31637. /**
  31638. * Converts `string` to
  31639. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31640. *
  31641. * @static
  31642. * @memberOf _
  31643. * @since 3.0.0
  31644. * @category String
  31645. * @param {string} [string=''] The string to convert.
  31646. * @returns {string} Returns the snake cased string.
  31647. * @example
  31648. *
  31649. * _.snakeCase('Foo Bar');
  31650. * // => 'foo_bar'
  31651. *
  31652. * _.snakeCase('fooBar');
  31653. * // => 'foo_bar'
  31654. *
  31655. * _.snakeCase('--FOO-BAR--');
  31656. * // => 'foo_bar'
  31657. */
  31658. var snakeCase = createCompounder(function(result, word, index) {
  31659. return result + (index ? '_' : '') + word.toLowerCase();
  31660. });
  31661. /**
  31662. * Splits `string` by `separator`.
  31663. *
  31664. * **Note:** This method is based on
  31665. * [`String#split`](https://mdn.io/String/split).
  31666. *
  31667. * @static
  31668. * @memberOf _
  31669. * @since 4.0.0
  31670. * @category String
  31671. * @param {string} [string=''] The string to split.
  31672. * @param {RegExp|string} separator The separator pattern to split by.
  31673. * @param {number} [limit] The length to truncate results to.
  31674. * @returns {Array} Returns the string segments.
  31675. * @example
  31676. *
  31677. * _.split('a-b-c', '-', 2);
  31678. * // => ['a', 'b']
  31679. */
  31680. function split(string, separator, limit) {
  31681. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31682. separator = limit = undefined;
  31683. }
  31684. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31685. if (!limit) {
  31686. return [];
  31687. }
  31688. string = toString(string);
  31689. if (string && (
  31690. typeof separator == 'string' ||
  31691. (separator != null && !isRegExp(separator))
  31692. )) {
  31693. separator = baseToString(separator);
  31694. if (!separator && hasUnicode(string)) {
  31695. return castSlice(stringToArray(string), 0, limit);
  31696. }
  31697. }
  31698. return string.split(separator, limit);
  31699. }
  31700. /**
  31701. * Converts `string` to
  31702. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31703. *
  31704. * @static
  31705. * @memberOf _
  31706. * @since 3.1.0
  31707. * @category String
  31708. * @param {string} [string=''] The string to convert.
  31709. * @returns {string} Returns the start cased string.
  31710. * @example
  31711. *
  31712. * _.startCase('--foo-bar--');
  31713. * // => 'Foo Bar'
  31714. *
  31715. * _.startCase('fooBar');
  31716. * // => 'Foo Bar'
  31717. *
  31718. * _.startCase('__FOO_BAR__');
  31719. * // => 'FOO BAR'
  31720. */
  31721. var startCase = createCompounder(function(result, word, index) {
  31722. return result + (index ? ' ' : '') + upperFirst(word);
  31723. });
  31724. /**
  31725. * Checks if `string` starts with the given target string.
  31726. *
  31727. * @static
  31728. * @memberOf _
  31729. * @since 3.0.0
  31730. * @category String
  31731. * @param {string} [string=''] The string to inspect.
  31732. * @param {string} [target] The string to search for.
  31733. * @param {number} [position=0] The position to search from.
  31734. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31735. * else `false`.
  31736. * @example
  31737. *
  31738. * _.startsWith('abc', 'a');
  31739. * // => true
  31740. *
  31741. * _.startsWith('abc', 'b');
  31742. * // => false
  31743. *
  31744. * _.startsWith('abc', 'b', 1);
  31745. * // => true
  31746. */
  31747. function startsWith(string, target, position) {
  31748. string = toString(string);
  31749. position = position == null
  31750. ? 0
  31751. : baseClamp(toInteger(position), 0, string.length);
  31752. target = baseToString(target);
  31753. return string.slice(position, position + target.length) == target;
  31754. }
  31755. /**
  31756. * Creates a compiled template function that can interpolate data properties
  31757. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  31758. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  31759. * properties may be accessed as free variables in the template. If a setting
  31760. * object is given, it takes precedence over `_.templateSettings` values.
  31761. *
  31762. * **Note:** In the development build `_.template` utilizes
  31763. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  31764. * for easier debugging.
  31765. *
  31766. * For more information on precompiling templates see
  31767. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  31768. *
  31769. * For more information on Chrome extension sandboxes see
  31770. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  31771. *
  31772. * @static
  31773. * @since 0.1.0
  31774. * @memberOf _
  31775. * @category String
  31776. * @param {string} [string=''] The template string.
  31777. * @param {Object} [options={}] The options object.
  31778. * @param {RegExp} [options.escape=_.templateSettings.escape]
  31779. * The HTML "escape" delimiter.
  31780. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  31781. * The "evaluate" delimiter.
  31782. * @param {Object} [options.imports=_.templateSettings.imports]
  31783. * An object to import into the template as free variables.
  31784. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  31785. * The "interpolate" delimiter.
  31786. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  31787. * The sourceURL of the compiled template.
  31788. * @param {string} [options.variable='obj']
  31789. * The data object variable name.
  31790. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31791. * @returns {Function} Returns the compiled template function.
  31792. * @example
  31793. *
  31794. * // Use the "interpolate" delimiter to create a compiled template.
  31795. * var compiled = _.template('hello <%= user %>!');
  31796. * compiled({ 'user': 'fred' });
  31797. * // => 'hello fred!'
  31798. *
  31799. * // Use the HTML "escape" delimiter to escape data property values.
  31800. * var compiled = _.template('<b><%- value %></b>');
  31801. * compiled({ 'value': '<script>' });
  31802. * // => '<b>&lt;script&gt;</b>'
  31803. *
  31804. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  31805. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  31806. * compiled({ 'users': ['fred', 'barney'] });
  31807. * // => '<li>fred</li><li>barney</li>'
  31808. *
  31809. * // Use the internal `print` function in "evaluate" delimiters.
  31810. * var compiled = _.template('<% print("hello " + user); %>!');
  31811. * compiled({ 'user': 'barney' });
  31812. * // => 'hello barney!'
  31813. *
  31814. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  31815. * // Disable support by replacing the "interpolate" delimiter.
  31816. * var compiled = _.template('hello ${ user }!');
  31817. * compiled({ 'user': 'pebbles' });
  31818. * // => 'hello pebbles!'
  31819. *
  31820. * // Use backslashes to treat delimiters as plain text.
  31821. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  31822. * compiled({ 'value': 'ignored' });
  31823. * // => '<%- value %>'
  31824. *
  31825. * // Use the `imports` option to import `jQuery` as `jq`.
  31826. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  31827. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  31828. * compiled({ 'users': ['fred', 'barney'] });
  31829. * // => '<li>fred</li><li>barney</li>'
  31830. *
  31831. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  31832. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  31833. * compiled(data);
  31834. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  31835. *
  31836. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  31837. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  31838. * compiled.source;
  31839. * // => function(data) {
  31840. * // var __t, __p = '';
  31841. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  31842. * // return __p;
  31843. * // }
  31844. *
  31845. * // Use custom template delimiters.
  31846. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  31847. * var compiled = _.template('hello {{ user }}!');
  31848. * compiled({ 'user': 'mustache' });
  31849. * // => 'hello mustache!'
  31850. *
  31851. * // Use the `source` property to inline compiled templates for meaningful
  31852. * // line numbers in error messages and stack traces.
  31853. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  31854. * var JST = {\
  31855. * "main": ' + _.template(mainText).source + '\
  31856. * };\
  31857. * ');
  31858. */
  31859. function template(string, options, guard) {
  31860. // Based on John Resig's `tmpl` implementation
  31861. // (http://ejohn.org/blog/javascript-micro-templating/)
  31862. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  31863. var settings = lodash.templateSettings;
  31864. if (guard && isIterateeCall(string, options, guard)) {
  31865. options = undefined;
  31866. }
  31867. string = toString(string);
  31868. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  31869. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  31870. importsKeys = keys(imports),
  31871. importsValues = baseValues(imports, importsKeys);
  31872. var isEscaping,
  31873. isEvaluating,
  31874. index = 0,
  31875. interpolate = options.interpolate || reNoMatch,
  31876. source = "__p += '";
  31877. // Compile the regexp to match each delimiter.
  31878. var reDelimiters = RegExp(
  31879. (options.escape || reNoMatch).source + '|' +
  31880. interpolate.source + '|' +
  31881. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  31882. (options.evaluate || reNoMatch).source + '|$'
  31883. , 'g');
  31884. // Use a sourceURL for easier debugging.
  31885. // The sourceURL gets injected into the source that's eval-ed, so be careful
  31886. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  31887. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  31888. var sourceURL = '//# sourceURL=' +
  31889. (hasOwnProperty.call(options, 'sourceURL')
  31890. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  31891. : ('lodash.templateSources[' + (++templateCounter) + ']')
  31892. ) + '\n';
  31893. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  31894. interpolateValue || (interpolateValue = esTemplateValue);
  31895. // Escape characters that can't be included in string literals.
  31896. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  31897. // Replace delimiters with snippets.
  31898. if (escapeValue) {
  31899. isEscaping = true;
  31900. source += "' +\n__e(" + escapeValue + ") +\n'";
  31901. }
  31902. if (evaluateValue) {
  31903. isEvaluating = true;
  31904. source += "';\n" + evaluateValue + ";\n__p += '";
  31905. }
  31906. if (interpolateValue) {
  31907. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  31908. }
  31909. index = offset + match.length;
  31910. // The JS engine embedded in Adobe products needs `match` returned in
  31911. // order to produce the correct `offset` value.
  31912. return match;
  31913. });
  31914. source += "';\n";
  31915. // If `variable` is not specified wrap a with-statement around the generated
  31916. // code to add the data object to the top of the scope chain.
  31917. // Like with sourceURL, we take care to not check the option's prototype,
  31918. // as this configuration is a code injection vector.
  31919. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  31920. if (!variable) {
  31921. source = 'with (obj) {\n' + source + '\n}\n';
  31922. }
  31923. // Cleanup code by stripping empty strings.
  31924. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  31925. .replace(reEmptyStringMiddle, '$1')
  31926. .replace(reEmptyStringTrailing, '$1;');
  31927. // Frame code as the function body.
  31928. source = 'function(' + (variable || 'obj') + ') {\n' +
  31929. (variable
  31930. ? ''
  31931. : 'obj || (obj = {});\n'
  31932. ) +
  31933. "var __t, __p = ''" +
  31934. (isEscaping
  31935. ? ', __e = _.escape'
  31936. : ''
  31937. ) +
  31938. (isEvaluating
  31939. ? ', __j = Array.prototype.join;\n' +
  31940. "function print() { __p += __j.call(arguments, '') }\n"
  31941. : ';\n'
  31942. ) +
  31943. source +
  31944. 'return __p\n}';
  31945. var result = attempt(function() {
  31946. return Function(importsKeys, sourceURL + 'return ' + source)
  31947. .apply(undefined, importsValues);
  31948. });
  31949. // Provide the compiled function's source by its `toString` method or
  31950. // the `source` property as a convenience for inlining compiled templates.
  31951. result.source = source;
  31952. if (isError(result)) {
  31953. throw result;
  31954. }
  31955. return result;
  31956. }
  31957. /**
  31958. * Converts `string`, as a whole, to lower case just like
  31959. * [String#toLowerCase](https://mdn.io/toLowerCase).
  31960. *
  31961. * @static
  31962. * @memberOf _
  31963. * @since 4.0.0
  31964. * @category String
  31965. * @param {string} [string=''] The string to convert.
  31966. * @returns {string} Returns the lower cased string.
  31967. * @example
  31968. *
  31969. * _.toLower('--Foo-Bar--');
  31970. * // => '--foo-bar--'
  31971. *
  31972. * _.toLower('fooBar');
  31973. * // => 'foobar'
  31974. *
  31975. * _.toLower('__FOO_BAR__');
  31976. * // => '__foo_bar__'
  31977. */
  31978. function toLower(value) {
  31979. return toString(value).toLowerCase();
  31980. }
  31981. /**
  31982. * Converts `string`, as a whole, to upper case just like
  31983. * [String#toUpperCase](https://mdn.io/toUpperCase).
  31984. *
  31985. * @static
  31986. * @memberOf _
  31987. * @since 4.0.0
  31988. * @category String
  31989. * @param {string} [string=''] The string to convert.
  31990. * @returns {string} Returns the upper cased string.
  31991. * @example
  31992. *
  31993. * _.toUpper('--foo-bar--');
  31994. * // => '--FOO-BAR--'
  31995. *
  31996. * _.toUpper('fooBar');
  31997. * // => 'FOOBAR'
  31998. *
  31999. * _.toUpper('__foo_bar__');
  32000. * // => '__FOO_BAR__'
  32001. */
  32002. function toUpper(value) {
  32003. return toString(value).toUpperCase();
  32004. }
  32005. /**
  32006. * Removes leading and trailing whitespace or specified characters from `string`.
  32007. *
  32008. * @static
  32009. * @memberOf _
  32010. * @since 3.0.0
  32011. * @category String
  32012. * @param {string} [string=''] The string to trim.
  32013. * @param {string} [chars=whitespace] The characters to trim.
  32014. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32015. * @returns {string} Returns the trimmed string.
  32016. * @example
  32017. *
  32018. * _.trim(' abc ');
  32019. * // => 'abc'
  32020. *
  32021. * _.trim('-_-abc-_-', '_-');
  32022. * // => 'abc'
  32023. *
  32024. * _.map([' foo ', ' bar '], _.trim);
  32025. * // => ['foo', 'bar']
  32026. */
  32027. function trim(string, chars, guard) {
  32028. string = toString(string);
  32029. if (string && (guard || chars === undefined)) {
  32030. return string.replace(reTrim, '');
  32031. }
  32032. if (!string || !(chars = baseToString(chars))) {
  32033. return string;
  32034. }
  32035. var strSymbols = stringToArray(string),
  32036. chrSymbols = stringToArray(chars),
  32037. start = charsStartIndex(strSymbols, chrSymbols),
  32038. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32039. return castSlice(strSymbols, start, end).join('');
  32040. }
  32041. /**
  32042. * Removes trailing whitespace or specified characters from `string`.
  32043. *
  32044. * @static
  32045. * @memberOf _
  32046. * @since 4.0.0
  32047. * @category String
  32048. * @param {string} [string=''] The string to trim.
  32049. * @param {string} [chars=whitespace] The characters to trim.
  32050. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32051. * @returns {string} Returns the trimmed string.
  32052. * @example
  32053. *
  32054. * _.trimEnd(' abc ');
  32055. * // => ' abc'
  32056. *
  32057. * _.trimEnd('-_-abc-_-', '_-');
  32058. * // => '-_-abc'
  32059. */
  32060. function trimEnd(string, chars, guard) {
  32061. string = toString(string);
  32062. if (string && (guard || chars === undefined)) {
  32063. return string.replace(reTrimEnd, '');
  32064. }
  32065. if (!string || !(chars = baseToString(chars))) {
  32066. return string;
  32067. }
  32068. var strSymbols = stringToArray(string),
  32069. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32070. return castSlice(strSymbols, 0, end).join('');
  32071. }
  32072. /**
  32073. * Removes leading whitespace or specified characters from `string`.
  32074. *
  32075. * @static
  32076. * @memberOf _
  32077. * @since 4.0.0
  32078. * @category String
  32079. * @param {string} [string=''] The string to trim.
  32080. * @param {string} [chars=whitespace] The characters to trim.
  32081. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32082. * @returns {string} Returns the trimmed string.
  32083. * @example
  32084. *
  32085. * _.trimStart(' abc ');
  32086. * // => 'abc '
  32087. *
  32088. * _.trimStart('-_-abc-_-', '_-');
  32089. * // => 'abc-_-'
  32090. */
  32091. function trimStart(string, chars, guard) {
  32092. string = toString(string);
  32093. if (string && (guard || chars === undefined)) {
  32094. return string.replace(reTrimStart, '');
  32095. }
  32096. if (!string || !(chars = baseToString(chars))) {
  32097. return string;
  32098. }
  32099. var strSymbols = stringToArray(string),
  32100. start = charsStartIndex(strSymbols, stringToArray(chars));
  32101. return castSlice(strSymbols, start).join('');
  32102. }
  32103. /**
  32104. * Truncates `string` if it's longer than the given maximum string length.
  32105. * The last characters of the truncated string are replaced with the omission
  32106. * string which defaults to "...".
  32107. *
  32108. * @static
  32109. * @memberOf _
  32110. * @since 4.0.0
  32111. * @category String
  32112. * @param {string} [string=''] The string to truncate.
  32113. * @param {Object} [options={}] The options object.
  32114. * @param {number} [options.length=30] The maximum string length.
  32115. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32116. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32117. * @returns {string} Returns the truncated string.
  32118. * @example
  32119. *
  32120. * _.truncate('hi-diddly-ho there, neighborino');
  32121. * // => 'hi-diddly-ho there, neighbo...'
  32122. *
  32123. * _.truncate('hi-diddly-ho there, neighborino', {
  32124. * 'length': 24,
  32125. * 'separator': ' '
  32126. * });
  32127. * // => 'hi-diddly-ho there,...'
  32128. *
  32129. * _.truncate('hi-diddly-ho there, neighborino', {
  32130. * 'length': 24,
  32131. * 'separator': /,? +/
  32132. * });
  32133. * // => 'hi-diddly-ho there...'
  32134. *
  32135. * _.truncate('hi-diddly-ho there, neighborino', {
  32136. * 'omission': ' [...]'
  32137. * });
  32138. * // => 'hi-diddly-ho there, neig [...]'
  32139. */
  32140. function truncate(string, options) {
  32141. var length = DEFAULT_TRUNC_LENGTH,
  32142. omission = DEFAULT_TRUNC_OMISSION;
  32143. if (isObject(options)) {
  32144. var separator = 'separator' in options ? options.separator : separator;
  32145. length = 'length' in options ? toInteger(options.length) : length;
  32146. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32147. }
  32148. string = toString(string);
  32149. var strLength = string.length;
  32150. if (hasUnicode(string)) {
  32151. var strSymbols = stringToArray(string);
  32152. strLength = strSymbols.length;
  32153. }
  32154. if (length >= strLength) {
  32155. return string;
  32156. }
  32157. var end = length - stringSize(omission);
  32158. if (end < 1) {
  32159. return omission;
  32160. }
  32161. var result = strSymbols
  32162. ? castSlice(strSymbols, 0, end).join('')
  32163. : string.slice(0, end);
  32164. if (separator === undefined) {
  32165. return result + omission;
  32166. }
  32167. if (strSymbols) {
  32168. end += (result.length - end);
  32169. }
  32170. if (isRegExp(separator)) {
  32171. if (string.slice(end).search(separator)) {
  32172. var match,
  32173. substring = result;
  32174. if (!separator.global) {
  32175. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32176. }
  32177. separator.lastIndex = 0;
  32178. while ((match = separator.exec(substring))) {
  32179. var newEnd = match.index;
  32180. }
  32181. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32182. }
  32183. } else if (string.indexOf(baseToString(separator), end) != end) {
  32184. var index = result.lastIndexOf(separator);
  32185. if (index > -1) {
  32186. result = result.slice(0, index);
  32187. }
  32188. }
  32189. return result + omission;
  32190. }
  32191. /**
  32192. * The inverse of `_.escape`; this method converts the HTML entities
  32193. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32194. * their corresponding characters.
  32195. *
  32196. * **Note:** No other HTML entities are unescaped. To unescape additional
  32197. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32198. *
  32199. * @static
  32200. * @memberOf _
  32201. * @since 0.6.0
  32202. * @category String
  32203. * @param {string} [string=''] The string to unescape.
  32204. * @returns {string} Returns the unescaped string.
  32205. * @example
  32206. *
  32207. * _.unescape('fred, barney, &amp; pebbles');
  32208. * // => 'fred, barney, & pebbles'
  32209. */
  32210. function unescape(string) {
  32211. string = toString(string);
  32212. return (string && reHasEscapedHtml.test(string))
  32213. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32214. : string;
  32215. }
  32216. /**
  32217. * Converts `string`, as space separated words, to upper case.
  32218. *
  32219. * @static
  32220. * @memberOf _
  32221. * @since 4.0.0
  32222. * @category String
  32223. * @param {string} [string=''] The string to convert.
  32224. * @returns {string} Returns the upper cased string.
  32225. * @example
  32226. *
  32227. * _.upperCase('--foo-bar');
  32228. * // => 'FOO BAR'
  32229. *
  32230. * _.upperCase('fooBar');
  32231. * // => 'FOO BAR'
  32232. *
  32233. * _.upperCase('__foo_bar__');
  32234. * // => 'FOO BAR'
  32235. */
  32236. var upperCase = createCompounder(function(result, word, index) {
  32237. return result + (index ? ' ' : '') + word.toUpperCase();
  32238. });
  32239. /**
  32240. * Converts the first character of `string` to upper case.
  32241. *
  32242. * @static
  32243. * @memberOf _
  32244. * @since 4.0.0
  32245. * @category String
  32246. * @param {string} [string=''] The string to convert.
  32247. * @returns {string} Returns the converted string.
  32248. * @example
  32249. *
  32250. * _.upperFirst('fred');
  32251. * // => 'Fred'
  32252. *
  32253. * _.upperFirst('FRED');
  32254. * // => 'FRED'
  32255. */
  32256. var upperFirst = createCaseFirst('toUpperCase');
  32257. /**
  32258. * Splits `string` into an array of its words.
  32259. *
  32260. * @static
  32261. * @memberOf _
  32262. * @since 3.0.0
  32263. * @category String
  32264. * @param {string} [string=''] The string to inspect.
  32265. * @param {RegExp|string} [pattern] The pattern to match words.
  32266. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32267. * @returns {Array} Returns the words of `string`.
  32268. * @example
  32269. *
  32270. * _.words('fred, barney, & pebbles');
  32271. * // => ['fred', 'barney', 'pebbles']
  32272. *
  32273. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32274. * // => ['fred', 'barney', '&', 'pebbles']
  32275. */
  32276. function words(string, pattern, guard) {
  32277. string = toString(string);
  32278. pattern = guard ? undefined : pattern;
  32279. if (pattern === undefined) {
  32280. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32281. }
  32282. return string.match(pattern) || [];
  32283. }
  32284. /*------------------------------------------------------------------------*/
  32285. /**
  32286. * Attempts to invoke `func`, returning either the result or the caught error
  32287. * object. Any additional arguments are provided to `func` when it's invoked.
  32288. *
  32289. * @static
  32290. * @memberOf _
  32291. * @since 3.0.0
  32292. * @category Util
  32293. * @param {Function} func The function to attempt.
  32294. * @param {...*} [args] The arguments to invoke `func` with.
  32295. * @returns {*} Returns the `func` result or error object.
  32296. * @example
  32297. *
  32298. * // Avoid throwing errors for invalid selectors.
  32299. * var elements = _.attempt(function(selector) {
  32300. * return document.querySelectorAll(selector);
  32301. * }, '>_>');
  32302. *
  32303. * if (_.isError(elements)) {
  32304. * elements = [];
  32305. * }
  32306. */
  32307. var attempt = baseRest(function(func, args) {
  32308. try {
  32309. return apply(func, undefined, args);
  32310. } catch (e) {
  32311. return isError(e) ? e : new Error(e);
  32312. }
  32313. });
  32314. /**
  32315. * Binds methods of an object to the object itself, overwriting the existing
  32316. * method.
  32317. *
  32318. * **Note:** This method doesn't set the "length" property of bound functions.
  32319. *
  32320. * @static
  32321. * @since 0.1.0
  32322. * @memberOf _
  32323. * @category Util
  32324. * @param {Object} object The object to bind and assign the bound methods to.
  32325. * @param {...(string|string[])} methodNames The object method names to bind.
  32326. * @returns {Object} Returns `object`.
  32327. * @example
  32328. *
  32329. * var view = {
  32330. * 'label': 'docs',
  32331. * 'click': function() {
  32332. * console.log('clicked ' + this.label);
  32333. * }
  32334. * };
  32335. *
  32336. * _.bindAll(view, ['click']);
  32337. * jQuery(element).on('click', view.click);
  32338. * // => Logs 'clicked docs' when clicked.
  32339. */
  32340. var bindAll = flatRest(function(object, methodNames) {
  32341. arrayEach(methodNames, function(key) {
  32342. key = toKey(key);
  32343. baseAssignValue(object, key, bind(object[key], object));
  32344. });
  32345. return object;
  32346. });
  32347. /**
  32348. * Creates a function that iterates over `pairs` and invokes the corresponding
  32349. * function of the first predicate to return truthy. The predicate-function
  32350. * pairs are invoked with the `this` binding and arguments of the created
  32351. * function.
  32352. *
  32353. * @static
  32354. * @memberOf _
  32355. * @since 4.0.0
  32356. * @category Util
  32357. * @param {Array} pairs The predicate-function pairs.
  32358. * @returns {Function} Returns the new composite function.
  32359. * @example
  32360. *
  32361. * var func = _.cond([
  32362. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32363. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32364. * [_.stubTrue, _.constant('no match')]
  32365. * ]);
  32366. *
  32367. * func({ 'a': 1, 'b': 2 });
  32368. * // => 'matches A'
  32369. *
  32370. * func({ 'a': 0, 'b': 1 });
  32371. * // => 'matches B'
  32372. *
  32373. * func({ 'a': '1', 'b': '2' });
  32374. * // => 'no match'
  32375. */
  32376. function cond(pairs) {
  32377. var length = pairs == null ? 0 : pairs.length,
  32378. toIteratee = getIteratee();
  32379. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32380. if (typeof pair[1] != 'function') {
  32381. throw new TypeError(FUNC_ERROR_TEXT);
  32382. }
  32383. return [toIteratee(pair[0]), pair[1]];
  32384. });
  32385. return baseRest(function(args) {
  32386. var index = -1;
  32387. while (++index < length) {
  32388. var pair = pairs[index];
  32389. if (apply(pair[0], this, args)) {
  32390. return apply(pair[1], this, args);
  32391. }
  32392. }
  32393. });
  32394. }
  32395. /**
  32396. * Creates a function that invokes the predicate properties of `source` with
  32397. * the corresponding property values of a given object, returning `true` if
  32398. * all predicates return truthy, else `false`.
  32399. *
  32400. * **Note:** The created function is equivalent to `_.conformsTo` with
  32401. * `source` partially applied.
  32402. *
  32403. * @static
  32404. * @memberOf _
  32405. * @since 4.0.0
  32406. * @category Util
  32407. * @param {Object} source The object of property predicates to conform to.
  32408. * @returns {Function} Returns the new spec function.
  32409. * @example
  32410. *
  32411. * var objects = [
  32412. * { 'a': 2, 'b': 1 },
  32413. * { 'a': 1, 'b': 2 }
  32414. * ];
  32415. *
  32416. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32417. * // => [{ 'a': 1, 'b': 2 }]
  32418. */
  32419. function conforms(source) {
  32420. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32421. }
  32422. /**
  32423. * Creates a function that returns `value`.
  32424. *
  32425. * @static
  32426. * @memberOf _
  32427. * @since 2.4.0
  32428. * @category Util
  32429. * @param {*} value The value to return from the new function.
  32430. * @returns {Function} Returns the new constant function.
  32431. * @example
  32432. *
  32433. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32434. *
  32435. * console.log(objects);
  32436. * // => [{ 'a': 1 }, { 'a': 1 }]
  32437. *
  32438. * console.log(objects[0] === objects[1]);
  32439. * // => true
  32440. */
  32441. function constant(value) {
  32442. return function() {
  32443. return value;
  32444. };
  32445. }
  32446. /**
  32447. * Checks `value` to determine whether a default value should be returned in
  32448. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32449. * or `undefined`.
  32450. *
  32451. * @static
  32452. * @memberOf _
  32453. * @since 4.14.0
  32454. * @category Util
  32455. * @param {*} value The value to check.
  32456. * @param {*} defaultValue The default value.
  32457. * @returns {*} Returns the resolved value.
  32458. * @example
  32459. *
  32460. * _.defaultTo(1, 10);
  32461. * // => 1
  32462. *
  32463. * _.defaultTo(undefined, 10);
  32464. * // => 10
  32465. */
  32466. function defaultTo(value, defaultValue) {
  32467. return (value == null || value !== value) ? defaultValue : value;
  32468. }
  32469. /**
  32470. * Creates a function that returns the result of invoking the given functions
  32471. * with the `this` binding of the created function, where each successive
  32472. * invocation is supplied the return value of the previous.
  32473. *
  32474. * @static
  32475. * @memberOf _
  32476. * @since 3.0.0
  32477. * @category Util
  32478. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32479. * @returns {Function} Returns the new composite function.
  32480. * @see _.flowRight
  32481. * @example
  32482. *
  32483. * function square(n) {
  32484. * return n * n;
  32485. * }
  32486. *
  32487. * var addSquare = _.flow([_.add, square]);
  32488. * addSquare(1, 2);
  32489. * // => 9
  32490. */
  32491. var flow = createFlow();
  32492. /**
  32493. * This method is like `_.flow` except that it creates a function that
  32494. * invokes the given functions from right to left.
  32495. *
  32496. * @static
  32497. * @since 3.0.0
  32498. * @memberOf _
  32499. * @category Util
  32500. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32501. * @returns {Function} Returns the new composite function.
  32502. * @see _.flow
  32503. * @example
  32504. *
  32505. * function square(n) {
  32506. * return n * n;
  32507. * }
  32508. *
  32509. * var addSquare = _.flowRight([square, _.add]);
  32510. * addSquare(1, 2);
  32511. * // => 9
  32512. */
  32513. var flowRight = createFlow(true);
  32514. /**
  32515. * This method returns the first argument it receives.
  32516. *
  32517. * @static
  32518. * @since 0.1.0
  32519. * @memberOf _
  32520. * @category Util
  32521. * @param {*} value Any value.
  32522. * @returns {*} Returns `value`.
  32523. * @example
  32524. *
  32525. * var object = { 'a': 1 };
  32526. *
  32527. * console.log(_.identity(object) === object);
  32528. * // => true
  32529. */
  32530. function identity(value) {
  32531. return value;
  32532. }
  32533. /**
  32534. * Creates a function that invokes `func` with the arguments of the created
  32535. * function. If `func` is a property name, the created function returns the
  32536. * property value for a given element. If `func` is an array or object, the
  32537. * created function returns `true` for elements that contain the equivalent
  32538. * source properties, otherwise it returns `false`.
  32539. *
  32540. * @static
  32541. * @since 4.0.0
  32542. * @memberOf _
  32543. * @category Util
  32544. * @param {*} [func=_.identity] The value to convert to a callback.
  32545. * @returns {Function} Returns the callback.
  32546. * @example
  32547. *
  32548. * var users = [
  32549. * { 'user': 'barney', 'age': 36, 'active': true },
  32550. * { 'user': 'fred', 'age': 40, 'active': false }
  32551. * ];
  32552. *
  32553. * // The `_.matches` iteratee shorthand.
  32554. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32555. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32556. *
  32557. * // The `_.matchesProperty` iteratee shorthand.
  32558. * _.filter(users, _.iteratee(['user', 'fred']));
  32559. * // => [{ 'user': 'fred', 'age': 40 }]
  32560. *
  32561. * // The `_.property` iteratee shorthand.
  32562. * _.map(users, _.iteratee('user'));
  32563. * // => ['barney', 'fred']
  32564. *
  32565. * // Create custom iteratee shorthands.
  32566. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32567. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32568. * return func.test(string);
  32569. * };
  32570. * });
  32571. *
  32572. * _.filter(['abc', 'def'], /ef/);
  32573. * // => ['def']
  32574. */
  32575. function iteratee(func) {
  32576. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32577. }
  32578. /**
  32579. * Creates a function that performs a partial deep comparison between a given
  32580. * object and `source`, returning `true` if the given object has equivalent
  32581. * property values, else `false`.
  32582. *
  32583. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32584. * partially applied.
  32585. *
  32586. * Partial comparisons will match empty array and empty object `source`
  32587. * values against any array or object value, respectively. See `_.isEqual`
  32588. * for a list of supported value comparisons.
  32589. *
  32590. * @static
  32591. * @memberOf _
  32592. * @since 3.0.0
  32593. * @category Util
  32594. * @param {Object} source The object of property values to match.
  32595. * @returns {Function} Returns the new spec function.
  32596. * @example
  32597. *
  32598. * var objects = [
  32599. * { 'a': 1, 'b': 2, 'c': 3 },
  32600. * { 'a': 4, 'b': 5, 'c': 6 }
  32601. * ];
  32602. *
  32603. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32604. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32605. */
  32606. function matches(source) {
  32607. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32608. }
  32609. /**
  32610. * Creates a function that performs a partial deep comparison between the
  32611. * value at `path` of a given object to `srcValue`, returning `true` if the
  32612. * object value is equivalent, else `false`.
  32613. *
  32614. * **Note:** Partial comparisons will match empty array and empty object
  32615. * `srcValue` values against any array or object value, respectively. See
  32616. * `_.isEqual` for a list of supported value comparisons.
  32617. *
  32618. * @static
  32619. * @memberOf _
  32620. * @since 3.2.0
  32621. * @category Util
  32622. * @param {Array|string} path The path of the property to get.
  32623. * @param {*} srcValue The value to match.
  32624. * @returns {Function} Returns the new spec function.
  32625. * @example
  32626. *
  32627. * var objects = [
  32628. * { 'a': 1, 'b': 2, 'c': 3 },
  32629. * { 'a': 4, 'b': 5, 'c': 6 }
  32630. * ];
  32631. *
  32632. * _.find(objects, _.matchesProperty('a', 4));
  32633. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32634. */
  32635. function matchesProperty(path, srcValue) {
  32636. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32637. }
  32638. /**
  32639. * Creates a function that invokes the method at `path` of a given object.
  32640. * Any additional arguments are provided to the invoked method.
  32641. *
  32642. * @static
  32643. * @memberOf _
  32644. * @since 3.7.0
  32645. * @category Util
  32646. * @param {Array|string} path The path of the method to invoke.
  32647. * @param {...*} [args] The arguments to invoke the method with.
  32648. * @returns {Function} Returns the new invoker function.
  32649. * @example
  32650. *
  32651. * var objects = [
  32652. * { 'a': { 'b': _.constant(2) } },
  32653. * { 'a': { 'b': _.constant(1) } }
  32654. * ];
  32655. *
  32656. * _.map(objects, _.method('a.b'));
  32657. * // => [2, 1]
  32658. *
  32659. * _.map(objects, _.method(['a', 'b']));
  32660. * // => [2, 1]
  32661. */
  32662. var method = baseRest(function(path, args) {
  32663. return function(object) {
  32664. return baseInvoke(object, path, args);
  32665. };
  32666. });
  32667. /**
  32668. * The opposite of `_.method`; this method creates a function that invokes
  32669. * the method at a given path of `object`. Any additional arguments are
  32670. * provided to the invoked method.
  32671. *
  32672. * @static
  32673. * @memberOf _
  32674. * @since 3.7.0
  32675. * @category Util
  32676. * @param {Object} object The object to query.
  32677. * @param {...*} [args] The arguments to invoke the method with.
  32678. * @returns {Function} Returns the new invoker function.
  32679. * @example
  32680. *
  32681. * var array = _.times(3, _.constant),
  32682. * object = { 'a': array, 'b': array, 'c': array };
  32683. *
  32684. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32685. * // => [2, 0]
  32686. *
  32687. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32688. * // => [2, 0]
  32689. */
  32690. var methodOf = baseRest(function(object, args) {
  32691. return function(path) {
  32692. return baseInvoke(object, path, args);
  32693. };
  32694. });
  32695. /**
  32696. * Adds all own enumerable string keyed function properties of a source
  32697. * object to the destination object. If `object` is a function, then methods
  32698. * are added to its prototype as well.
  32699. *
  32700. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32701. * avoid conflicts caused by modifying the original.
  32702. *
  32703. * @static
  32704. * @since 0.1.0
  32705. * @memberOf _
  32706. * @category Util
  32707. * @param {Function|Object} [object=lodash] The destination object.
  32708. * @param {Object} source The object of functions to add.
  32709. * @param {Object} [options={}] The options object.
  32710. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32711. * @returns {Function|Object} Returns `object`.
  32712. * @example
  32713. *
  32714. * function vowels(string) {
  32715. * return _.filter(string, function(v) {
  32716. * return /[aeiou]/i.test(v);
  32717. * });
  32718. * }
  32719. *
  32720. * _.mixin({ 'vowels': vowels });
  32721. * _.vowels('fred');
  32722. * // => ['e']
  32723. *
  32724. * _('fred').vowels().value();
  32725. * // => ['e']
  32726. *
  32727. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32728. * _('fred').vowels();
  32729. * // => ['e']
  32730. */
  32731. function mixin(object, source, options) {
  32732. var props = keys(source),
  32733. methodNames = baseFunctions(source, props);
  32734. if (options == null &&
  32735. !(isObject(source) && (methodNames.length || !props.length))) {
  32736. options = source;
  32737. source = object;
  32738. object = this;
  32739. methodNames = baseFunctions(source, keys(source));
  32740. }
  32741. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  32742. isFunc = isFunction(object);
  32743. arrayEach(methodNames, function(methodName) {
  32744. var func = source[methodName];
  32745. object[methodName] = func;
  32746. if (isFunc) {
  32747. object.prototype[methodName] = function() {
  32748. var chainAll = this.__chain__;
  32749. if (chain || chainAll) {
  32750. var result = object(this.__wrapped__),
  32751. actions = result.__actions__ = copyArray(this.__actions__);
  32752. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  32753. result.__chain__ = chainAll;
  32754. return result;
  32755. }
  32756. return func.apply(object, arrayPush([this.value()], arguments));
  32757. };
  32758. }
  32759. });
  32760. return object;
  32761. }
  32762. /**
  32763. * Reverts the `_` variable to its previous value and returns a reference to
  32764. * the `lodash` function.
  32765. *
  32766. * @static
  32767. * @since 0.1.0
  32768. * @memberOf _
  32769. * @category Util
  32770. * @returns {Function} Returns the `lodash` function.
  32771. * @example
  32772. *
  32773. * var lodash = _.noConflict();
  32774. */
  32775. function noConflict() {
  32776. if (root._ === this) {
  32777. root._ = oldDash;
  32778. }
  32779. return this;
  32780. }
  32781. /**
  32782. * This method returns `undefined`.
  32783. *
  32784. * @static
  32785. * @memberOf _
  32786. * @since 2.3.0
  32787. * @category Util
  32788. * @example
  32789. *
  32790. * _.times(2, _.noop);
  32791. * // => [undefined, undefined]
  32792. */
  32793. function noop() {
  32794. // No operation performed.
  32795. }
  32796. /**
  32797. * Creates a function that gets the argument at index `n`. If `n` is negative,
  32798. * the nth argument from the end is returned.
  32799. *
  32800. * @static
  32801. * @memberOf _
  32802. * @since 4.0.0
  32803. * @category Util
  32804. * @param {number} [n=0] The index of the argument to return.
  32805. * @returns {Function} Returns the new pass-thru function.
  32806. * @example
  32807. *
  32808. * var func = _.nthArg(1);
  32809. * func('a', 'b', 'c', 'd');
  32810. * // => 'b'
  32811. *
  32812. * var func = _.nthArg(-2);
  32813. * func('a', 'b', 'c', 'd');
  32814. * // => 'c'
  32815. */
  32816. function nthArg(n) {
  32817. n = toInteger(n);
  32818. return baseRest(function(args) {
  32819. return baseNth(args, n);
  32820. });
  32821. }
  32822. /**
  32823. * Creates a function that invokes `iteratees` with the arguments it receives
  32824. * and returns their results.
  32825. *
  32826. * @static
  32827. * @memberOf _
  32828. * @since 4.0.0
  32829. * @category Util
  32830. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  32831. * The iteratees to invoke.
  32832. * @returns {Function} Returns the new function.
  32833. * @example
  32834. *
  32835. * var func = _.over([Math.max, Math.min]);
  32836. *
  32837. * func(1, 2, 3, 4);
  32838. * // => [4, 1]
  32839. */
  32840. var over = createOver(arrayMap);
  32841. /**
  32842. * Creates a function that checks if **all** of the `predicates` return
  32843. * truthy when invoked with the arguments it receives.
  32844. *
  32845. * @static
  32846. * @memberOf _
  32847. * @since 4.0.0
  32848. * @category Util
  32849. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32850. * The predicates to check.
  32851. * @returns {Function} Returns the new function.
  32852. * @example
  32853. *
  32854. * var func = _.overEvery([Boolean, isFinite]);
  32855. *
  32856. * func('1');
  32857. * // => true
  32858. *
  32859. * func(null);
  32860. * // => false
  32861. *
  32862. * func(NaN);
  32863. * // => false
  32864. */
  32865. var overEvery = createOver(arrayEvery);
  32866. /**
  32867. * Creates a function that checks if **any** of the `predicates` return
  32868. * truthy when invoked with the arguments it receives.
  32869. *
  32870. * @static
  32871. * @memberOf _
  32872. * @since 4.0.0
  32873. * @category Util
  32874. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32875. * The predicates to check.
  32876. * @returns {Function} Returns the new function.
  32877. * @example
  32878. *
  32879. * var func = _.overSome([Boolean, isFinite]);
  32880. *
  32881. * func('1');
  32882. * // => true
  32883. *
  32884. * func(null);
  32885. * // => true
  32886. *
  32887. * func(NaN);
  32888. * // => false
  32889. */
  32890. var overSome = createOver(arraySome);
  32891. /**
  32892. * Creates a function that returns the value at `path` of a given object.
  32893. *
  32894. * @static
  32895. * @memberOf _
  32896. * @since 2.4.0
  32897. * @category Util
  32898. * @param {Array|string} path The path of the property to get.
  32899. * @returns {Function} Returns the new accessor function.
  32900. * @example
  32901. *
  32902. * var objects = [
  32903. * { 'a': { 'b': 2 } },
  32904. * { 'a': { 'b': 1 } }
  32905. * ];
  32906. *
  32907. * _.map(objects, _.property('a.b'));
  32908. * // => [2, 1]
  32909. *
  32910. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  32911. * // => [1, 2]
  32912. */
  32913. function property(path) {
  32914. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  32915. }
  32916. /**
  32917. * The opposite of `_.property`; this method creates a function that returns
  32918. * the value at a given path of `object`.
  32919. *
  32920. * @static
  32921. * @memberOf _
  32922. * @since 3.0.0
  32923. * @category Util
  32924. * @param {Object} object The object to query.
  32925. * @returns {Function} Returns the new accessor function.
  32926. * @example
  32927. *
  32928. * var array = [0, 1, 2],
  32929. * object = { 'a': array, 'b': array, 'c': array };
  32930. *
  32931. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  32932. * // => [2, 0]
  32933. *
  32934. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  32935. * // => [2, 0]
  32936. */
  32937. function propertyOf(object) {
  32938. return function(path) {
  32939. return object == null ? undefined : baseGet(object, path);
  32940. };
  32941. }
  32942. /**
  32943. * Creates an array of numbers (positive and/or negative) progressing from
  32944. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  32945. * `start` is specified without an `end` or `step`. If `end` is not specified,
  32946. * it's set to `start` with `start` then set to `0`.
  32947. *
  32948. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32949. * floating-point values which can produce unexpected results.
  32950. *
  32951. * @static
  32952. * @since 0.1.0
  32953. * @memberOf _
  32954. * @category Util
  32955. * @param {number} [start=0] The start of the range.
  32956. * @param {number} end The end of the range.
  32957. * @param {number} [step=1] The value to increment or decrement by.
  32958. * @returns {Array} Returns the range of numbers.
  32959. * @see _.inRange, _.rangeRight
  32960. * @example
  32961. *
  32962. * _.range(4);
  32963. * // => [0, 1, 2, 3]
  32964. *
  32965. * _.range(-4);
  32966. * // => [0, -1, -2, -3]
  32967. *
  32968. * _.range(1, 5);
  32969. * // => [1, 2, 3, 4]
  32970. *
  32971. * _.range(0, 20, 5);
  32972. * // => [0, 5, 10, 15]
  32973. *
  32974. * _.range(0, -4, -1);
  32975. * // => [0, -1, -2, -3]
  32976. *
  32977. * _.range(1, 4, 0);
  32978. * // => [1, 1, 1]
  32979. *
  32980. * _.range(0);
  32981. * // => []
  32982. */
  32983. var range = createRange();
  32984. /**
  32985. * This method is like `_.range` except that it populates values in
  32986. * descending order.
  32987. *
  32988. * @static
  32989. * @memberOf _
  32990. * @since 4.0.0
  32991. * @category Util
  32992. * @param {number} [start=0] The start of the range.
  32993. * @param {number} end The end of the range.
  32994. * @param {number} [step=1] The value to increment or decrement by.
  32995. * @returns {Array} Returns the range of numbers.
  32996. * @see _.inRange, _.range
  32997. * @example
  32998. *
  32999. * _.rangeRight(4);
  33000. * // => [3, 2, 1, 0]
  33001. *
  33002. * _.rangeRight(-4);
  33003. * // => [-3, -2, -1, 0]
  33004. *
  33005. * _.rangeRight(1, 5);
  33006. * // => [4, 3, 2, 1]
  33007. *
  33008. * _.rangeRight(0, 20, 5);
  33009. * // => [15, 10, 5, 0]
  33010. *
  33011. * _.rangeRight(0, -4, -1);
  33012. * // => [-3, -2, -1, 0]
  33013. *
  33014. * _.rangeRight(1, 4, 0);
  33015. * // => [1, 1, 1]
  33016. *
  33017. * _.rangeRight(0);
  33018. * // => []
  33019. */
  33020. var rangeRight = createRange(true);
  33021. /**
  33022. * This method returns a new empty array.
  33023. *
  33024. * @static
  33025. * @memberOf _
  33026. * @since 4.13.0
  33027. * @category Util
  33028. * @returns {Array} Returns the new empty array.
  33029. * @example
  33030. *
  33031. * var arrays = _.times(2, _.stubArray);
  33032. *
  33033. * console.log(arrays);
  33034. * // => [[], []]
  33035. *
  33036. * console.log(arrays[0] === arrays[1]);
  33037. * // => false
  33038. */
  33039. function stubArray() {
  33040. return [];
  33041. }
  33042. /**
  33043. * This method returns `false`.
  33044. *
  33045. * @static
  33046. * @memberOf _
  33047. * @since 4.13.0
  33048. * @category Util
  33049. * @returns {boolean} Returns `false`.
  33050. * @example
  33051. *
  33052. * _.times(2, _.stubFalse);
  33053. * // => [false, false]
  33054. */
  33055. function stubFalse() {
  33056. return false;
  33057. }
  33058. /**
  33059. * This method returns a new empty object.
  33060. *
  33061. * @static
  33062. * @memberOf _
  33063. * @since 4.13.0
  33064. * @category Util
  33065. * @returns {Object} Returns the new empty object.
  33066. * @example
  33067. *
  33068. * var objects = _.times(2, _.stubObject);
  33069. *
  33070. * console.log(objects);
  33071. * // => [{}, {}]
  33072. *
  33073. * console.log(objects[0] === objects[1]);
  33074. * // => false
  33075. */
  33076. function stubObject() {
  33077. return {};
  33078. }
  33079. /**
  33080. * This method returns an empty string.
  33081. *
  33082. * @static
  33083. * @memberOf _
  33084. * @since 4.13.0
  33085. * @category Util
  33086. * @returns {string} Returns the empty string.
  33087. * @example
  33088. *
  33089. * _.times(2, _.stubString);
  33090. * // => ['', '']
  33091. */
  33092. function stubString() {
  33093. return '';
  33094. }
  33095. /**
  33096. * This method returns `true`.
  33097. *
  33098. * @static
  33099. * @memberOf _
  33100. * @since 4.13.0
  33101. * @category Util
  33102. * @returns {boolean} Returns `true`.
  33103. * @example
  33104. *
  33105. * _.times(2, _.stubTrue);
  33106. * // => [true, true]
  33107. */
  33108. function stubTrue() {
  33109. return true;
  33110. }
  33111. /**
  33112. * Invokes the iteratee `n` times, returning an array of the results of
  33113. * each invocation. The iteratee is invoked with one argument; (index).
  33114. *
  33115. * @static
  33116. * @since 0.1.0
  33117. * @memberOf _
  33118. * @category Util
  33119. * @param {number} n The number of times to invoke `iteratee`.
  33120. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33121. * @returns {Array} Returns the array of results.
  33122. * @example
  33123. *
  33124. * _.times(3, String);
  33125. * // => ['0', '1', '2']
  33126. *
  33127. * _.times(4, _.constant(0));
  33128. * // => [0, 0, 0, 0]
  33129. */
  33130. function times(n, iteratee) {
  33131. n = toInteger(n);
  33132. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33133. return [];
  33134. }
  33135. var index = MAX_ARRAY_LENGTH,
  33136. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33137. iteratee = getIteratee(iteratee);
  33138. n -= MAX_ARRAY_LENGTH;
  33139. var result = baseTimes(length, iteratee);
  33140. while (++index < n) {
  33141. iteratee(index);
  33142. }
  33143. return result;
  33144. }
  33145. /**
  33146. * Converts `value` to a property path array.
  33147. *
  33148. * @static
  33149. * @memberOf _
  33150. * @since 4.0.0
  33151. * @category Util
  33152. * @param {*} value The value to convert.
  33153. * @returns {Array} Returns the new property path array.
  33154. * @example
  33155. *
  33156. * _.toPath('a.b.c');
  33157. * // => ['a', 'b', 'c']
  33158. *
  33159. * _.toPath('a[0].b.c');
  33160. * // => ['a', '0', 'b', 'c']
  33161. */
  33162. function toPath(value) {
  33163. if (isArray(value)) {
  33164. return arrayMap(value, toKey);
  33165. }
  33166. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33167. }
  33168. /**
  33169. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33170. *
  33171. * @static
  33172. * @since 0.1.0
  33173. * @memberOf _
  33174. * @category Util
  33175. * @param {string} [prefix=''] The value to prefix the ID with.
  33176. * @returns {string} Returns the unique ID.
  33177. * @example
  33178. *
  33179. * _.uniqueId('contact_');
  33180. * // => 'contact_104'
  33181. *
  33182. * _.uniqueId();
  33183. * // => '105'
  33184. */
  33185. function uniqueId(prefix) {
  33186. var id = ++idCounter;
  33187. return toString(prefix) + id;
  33188. }
  33189. /*------------------------------------------------------------------------*/
  33190. /**
  33191. * Adds two numbers.
  33192. *
  33193. * @static
  33194. * @memberOf _
  33195. * @since 3.4.0
  33196. * @category Math
  33197. * @param {number} augend The first number in an addition.
  33198. * @param {number} addend The second number in an addition.
  33199. * @returns {number} Returns the total.
  33200. * @example
  33201. *
  33202. * _.add(6, 4);
  33203. * // => 10
  33204. */
  33205. var add = createMathOperation(function(augend, addend) {
  33206. return augend + addend;
  33207. }, 0);
  33208. /**
  33209. * Computes `number` rounded up to `precision`.
  33210. *
  33211. * @static
  33212. * @memberOf _
  33213. * @since 3.10.0
  33214. * @category Math
  33215. * @param {number} number The number to round up.
  33216. * @param {number} [precision=0] The precision to round up to.
  33217. * @returns {number} Returns the rounded up number.
  33218. * @example
  33219. *
  33220. * _.ceil(4.006);
  33221. * // => 5
  33222. *
  33223. * _.ceil(6.004, 2);
  33224. * // => 6.01
  33225. *
  33226. * _.ceil(6040, -2);
  33227. * // => 6100
  33228. */
  33229. var ceil = createRound('ceil');
  33230. /**
  33231. * Divide two numbers.
  33232. *
  33233. * @static
  33234. * @memberOf _
  33235. * @since 4.7.0
  33236. * @category Math
  33237. * @param {number} dividend The first number in a division.
  33238. * @param {number} divisor The second number in a division.
  33239. * @returns {number} Returns the quotient.
  33240. * @example
  33241. *
  33242. * _.divide(6, 4);
  33243. * // => 1.5
  33244. */
  33245. var divide = createMathOperation(function(dividend, divisor) {
  33246. return dividend / divisor;
  33247. }, 1);
  33248. /**
  33249. * Computes `number` rounded down to `precision`.
  33250. *
  33251. * @static
  33252. * @memberOf _
  33253. * @since 3.10.0
  33254. * @category Math
  33255. * @param {number} number The number to round down.
  33256. * @param {number} [precision=0] The precision to round down to.
  33257. * @returns {number} Returns the rounded down number.
  33258. * @example
  33259. *
  33260. * _.floor(4.006);
  33261. * // => 4
  33262. *
  33263. * _.floor(0.046, 2);
  33264. * // => 0.04
  33265. *
  33266. * _.floor(4060, -2);
  33267. * // => 4000
  33268. */
  33269. var floor = createRound('floor');
  33270. /**
  33271. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33272. * `undefined` is returned.
  33273. *
  33274. * @static
  33275. * @since 0.1.0
  33276. * @memberOf _
  33277. * @category Math
  33278. * @param {Array} array The array to iterate over.
  33279. * @returns {*} Returns the maximum value.
  33280. * @example
  33281. *
  33282. * _.max([4, 2, 8, 6]);
  33283. * // => 8
  33284. *
  33285. * _.max([]);
  33286. * // => undefined
  33287. */
  33288. function max(array) {
  33289. return (array && array.length)
  33290. ? baseExtremum(array, identity, baseGt)
  33291. : undefined;
  33292. }
  33293. /**
  33294. * This method is like `_.max` except that it accepts `iteratee` which is
  33295. * invoked for each element in `array` to generate the criterion by which
  33296. * the value is ranked. The iteratee is invoked with one argument: (value).
  33297. *
  33298. * @static
  33299. * @memberOf _
  33300. * @since 4.0.0
  33301. * @category Math
  33302. * @param {Array} array The array to iterate over.
  33303. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33304. * @returns {*} Returns the maximum value.
  33305. * @example
  33306. *
  33307. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33308. *
  33309. * _.maxBy(objects, function(o) { return o.n; });
  33310. * // => { 'n': 2 }
  33311. *
  33312. * // The `_.property` iteratee shorthand.
  33313. * _.maxBy(objects, 'n');
  33314. * // => { 'n': 2 }
  33315. */
  33316. function maxBy(array, iteratee) {
  33317. return (array && array.length)
  33318. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33319. : undefined;
  33320. }
  33321. /**
  33322. * Computes the mean of the values in `array`.
  33323. *
  33324. * @static
  33325. * @memberOf _
  33326. * @since 4.0.0
  33327. * @category Math
  33328. * @param {Array} array The array to iterate over.
  33329. * @returns {number} Returns the mean.
  33330. * @example
  33331. *
  33332. * _.mean([4, 2, 8, 6]);
  33333. * // => 5
  33334. */
  33335. function mean(array) {
  33336. return baseMean(array, identity);
  33337. }
  33338. /**
  33339. * This method is like `_.mean` except that it accepts `iteratee` which is
  33340. * invoked for each element in `array` to generate the value to be averaged.
  33341. * The iteratee is invoked with one argument: (value).
  33342. *
  33343. * @static
  33344. * @memberOf _
  33345. * @since 4.7.0
  33346. * @category Math
  33347. * @param {Array} array The array to iterate over.
  33348. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33349. * @returns {number} Returns the mean.
  33350. * @example
  33351. *
  33352. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33353. *
  33354. * _.meanBy(objects, function(o) { return o.n; });
  33355. * // => 5
  33356. *
  33357. * // The `_.property` iteratee shorthand.
  33358. * _.meanBy(objects, 'n');
  33359. * // => 5
  33360. */
  33361. function meanBy(array, iteratee) {
  33362. return baseMean(array, getIteratee(iteratee, 2));
  33363. }
  33364. /**
  33365. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33366. * `undefined` is returned.
  33367. *
  33368. * @static
  33369. * @since 0.1.0
  33370. * @memberOf _
  33371. * @category Math
  33372. * @param {Array} array The array to iterate over.
  33373. * @returns {*} Returns the minimum value.
  33374. * @example
  33375. *
  33376. * _.min([4, 2, 8, 6]);
  33377. * // => 2
  33378. *
  33379. * _.min([]);
  33380. * // => undefined
  33381. */
  33382. function min(array) {
  33383. return (array && array.length)
  33384. ? baseExtremum(array, identity, baseLt)
  33385. : undefined;
  33386. }
  33387. /**
  33388. * This method is like `_.min` except that it accepts `iteratee` which is
  33389. * invoked for each element in `array` to generate the criterion by which
  33390. * the value is ranked. The iteratee is invoked with one argument: (value).
  33391. *
  33392. * @static
  33393. * @memberOf _
  33394. * @since 4.0.0
  33395. * @category Math
  33396. * @param {Array} array The array to iterate over.
  33397. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33398. * @returns {*} Returns the minimum value.
  33399. * @example
  33400. *
  33401. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33402. *
  33403. * _.minBy(objects, function(o) { return o.n; });
  33404. * // => { 'n': 1 }
  33405. *
  33406. * // The `_.property` iteratee shorthand.
  33407. * _.minBy(objects, 'n');
  33408. * // => { 'n': 1 }
  33409. */
  33410. function minBy(array, iteratee) {
  33411. return (array && array.length)
  33412. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33413. : undefined;
  33414. }
  33415. /**
  33416. * Multiply two numbers.
  33417. *
  33418. * @static
  33419. * @memberOf _
  33420. * @since 4.7.0
  33421. * @category Math
  33422. * @param {number} multiplier The first number in a multiplication.
  33423. * @param {number} multiplicand The second number in a multiplication.
  33424. * @returns {number} Returns the product.
  33425. * @example
  33426. *
  33427. * _.multiply(6, 4);
  33428. * // => 24
  33429. */
  33430. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33431. return multiplier * multiplicand;
  33432. }, 1);
  33433. /**
  33434. * Computes `number` rounded to `precision`.
  33435. *
  33436. * @static
  33437. * @memberOf _
  33438. * @since 3.10.0
  33439. * @category Math
  33440. * @param {number} number The number to round.
  33441. * @param {number} [precision=0] The precision to round to.
  33442. * @returns {number} Returns the rounded number.
  33443. * @example
  33444. *
  33445. * _.round(4.006);
  33446. * // => 4
  33447. *
  33448. * _.round(4.006, 2);
  33449. * // => 4.01
  33450. *
  33451. * _.round(4060, -2);
  33452. * // => 4100
  33453. */
  33454. var round = createRound('round');
  33455. /**
  33456. * Subtract two numbers.
  33457. *
  33458. * @static
  33459. * @memberOf _
  33460. * @since 4.0.0
  33461. * @category Math
  33462. * @param {number} minuend The first number in a subtraction.
  33463. * @param {number} subtrahend The second number in a subtraction.
  33464. * @returns {number} Returns the difference.
  33465. * @example
  33466. *
  33467. * _.subtract(6, 4);
  33468. * // => 2
  33469. */
  33470. var subtract = createMathOperation(function(minuend, subtrahend) {
  33471. return minuend - subtrahend;
  33472. }, 0);
  33473. /**
  33474. * Computes the sum of the values in `array`.
  33475. *
  33476. * @static
  33477. * @memberOf _
  33478. * @since 3.4.0
  33479. * @category Math
  33480. * @param {Array} array The array to iterate over.
  33481. * @returns {number} Returns the sum.
  33482. * @example
  33483. *
  33484. * _.sum([4, 2, 8, 6]);
  33485. * // => 20
  33486. */
  33487. function sum(array) {
  33488. return (array && array.length)
  33489. ? baseSum(array, identity)
  33490. : 0;
  33491. }
  33492. /**
  33493. * This method is like `_.sum` except that it accepts `iteratee` which is
  33494. * invoked for each element in `array` to generate the value to be summed.
  33495. * The iteratee is invoked with one argument: (value).
  33496. *
  33497. * @static
  33498. * @memberOf _
  33499. * @since 4.0.0
  33500. * @category Math
  33501. * @param {Array} array The array to iterate over.
  33502. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33503. * @returns {number} Returns the sum.
  33504. * @example
  33505. *
  33506. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33507. *
  33508. * _.sumBy(objects, function(o) { return o.n; });
  33509. * // => 20
  33510. *
  33511. * // The `_.property` iteratee shorthand.
  33512. * _.sumBy(objects, 'n');
  33513. * // => 20
  33514. */
  33515. function sumBy(array, iteratee) {
  33516. return (array && array.length)
  33517. ? baseSum(array, getIteratee(iteratee, 2))
  33518. : 0;
  33519. }
  33520. /*------------------------------------------------------------------------*/
  33521. // Add methods that return wrapped values in chain sequences.
  33522. lodash.after = after;
  33523. lodash.ary = ary;
  33524. lodash.assign = assign;
  33525. lodash.assignIn = assignIn;
  33526. lodash.assignInWith = assignInWith;
  33527. lodash.assignWith = assignWith;
  33528. lodash.at = at;
  33529. lodash.before = before;
  33530. lodash.bind = bind;
  33531. lodash.bindAll = bindAll;
  33532. lodash.bindKey = bindKey;
  33533. lodash.castArray = castArray;
  33534. lodash.chain = chain;
  33535. lodash.chunk = chunk;
  33536. lodash.compact = compact;
  33537. lodash.concat = concat;
  33538. lodash.cond = cond;
  33539. lodash.conforms = conforms;
  33540. lodash.constant = constant;
  33541. lodash.countBy = countBy;
  33542. lodash.create = create;
  33543. lodash.curry = curry;
  33544. lodash.curryRight = curryRight;
  33545. lodash.debounce = debounce;
  33546. lodash.defaults = defaults;
  33547. lodash.defaultsDeep = defaultsDeep;
  33548. lodash.defer = defer;
  33549. lodash.delay = delay;
  33550. lodash.difference = difference;
  33551. lodash.differenceBy = differenceBy;
  33552. lodash.differenceWith = differenceWith;
  33553. lodash.drop = drop;
  33554. lodash.dropRight = dropRight;
  33555. lodash.dropRightWhile = dropRightWhile;
  33556. lodash.dropWhile = dropWhile;
  33557. lodash.fill = fill;
  33558. lodash.filter = filter;
  33559. lodash.flatMap = flatMap;
  33560. lodash.flatMapDeep = flatMapDeep;
  33561. lodash.flatMapDepth = flatMapDepth;
  33562. lodash.flatten = flatten;
  33563. lodash.flattenDeep = flattenDeep;
  33564. lodash.flattenDepth = flattenDepth;
  33565. lodash.flip = flip;
  33566. lodash.flow = flow;
  33567. lodash.flowRight = flowRight;
  33568. lodash.fromPairs = fromPairs;
  33569. lodash.functions = functions;
  33570. lodash.functionsIn = functionsIn;
  33571. lodash.groupBy = groupBy;
  33572. lodash.initial = initial;
  33573. lodash.intersection = intersection;
  33574. lodash.intersectionBy = intersectionBy;
  33575. lodash.intersectionWith = intersectionWith;
  33576. lodash.invert = invert;
  33577. lodash.invertBy = invertBy;
  33578. lodash.invokeMap = invokeMap;
  33579. lodash.iteratee = iteratee;
  33580. lodash.keyBy = keyBy;
  33581. lodash.keys = keys;
  33582. lodash.keysIn = keysIn;
  33583. lodash.map = map;
  33584. lodash.mapKeys = mapKeys;
  33585. lodash.mapValues = mapValues;
  33586. lodash.matches = matches;
  33587. lodash.matchesProperty = matchesProperty;
  33588. lodash.memoize = memoize;
  33589. lodash.merge = merge;
  33590. lodash.mergeWith = mergeWith;
  33591. lodash.method = method;
  33592. lodash.methodOf = methodOf;
  33593. lodash.mixin = mixin;
  33594. lodash.negate = negate;
  33595. lodash.nthArg = nthArg;
  33596. lodash.omit = omit;
  33597. lodash.omitBy = omitBy;
  33598. lodash.once = once;
  33599. lodash.orderBy = orderBy;
  33600. lodash.over = over;
  33601. lodash.overArgs = overArgs;
  33602. lodash.overEvery = overEvery;
  33603. lodash.overSome = overSome;
  33604. lodash.partial = partial;
  33605. lodash.partialRight = partialRight;
  33606. lodash.partition = partition;
  33607. lodash.pick = pick;
  33608. lodash.pickBy = pickBy;
  33609. lodash.property = property;
  33610. lodash.propertyOf = propertyOf;
  33611. lodash.pull = pull;
  33612. lodash.pullAll = pullAll;
  33613. lodash.pullAllBy = pullAllBy;
  33614. lodash.pullAllWith = pullAllWith;
  33615. lodash.pullAt = pullAt;
  33616. lodash.range = range;
  33617. lodash.rangeRight = rangeRight;
  33618. lodash.rearg = rearg;
  33619. lodash.reject = reject;
  33620. lodash.remove = remove;
  33621. lodash.rest = rest;
  33622. lodash.reverse = reverse;
  33623. lodash.sampleSize = sampleSize;
  33624. lodash.set = set;
  33625. lodash.setWith = setWith;
  33626. lodash.shuffle = shuffle;
  33627. lodash.slice = slice;
  33628. lodash.sortBy = sortBy;
  33629. lodash.sortedUniq = sortedUniq;
  33630. lodash.sortedUniqBy = sortedUniqBy;
  33631. lodash.split = split;
  33632. lodash.spread = spread;
  33633. lodash.tail = tail;
  33634. lodash.take = take;
  33635. lodash.takeRight = takeRight;
  33636. lodash.takeRightWhile = takeRightWhile;
  33637. lodash.takeWhile = takeWhile;
  33638. lodash.tap = tap;
  33639. lodash.throttle = throttle;
  33640. lodash.thru = thru;
  33641. lodash.toArray = toArray;
  33642. lodash.toPairs = toPairs;
  33643. lodash.toPairsIn = toPairsIn;
  33644. lodash.toPath = toPath;
  33645. lodash.toPlainObject = toPlainObject;
  33646. lodash.transform = transform;
  33647. lodash.unary = unary;
  33648. lodash.union = union;
  33649. lodash.unionBy = unionBy;
  33650. lodash.unionWith = unionWith;
  33651. lodash.uniq = uniq;
  33652. lodash.uniqBy = uniqBy;
  33653. lodash.uniqWith = uniqWith;
  33654. lodash.unset = unset;
  33655. lodash.unzip = unzip;
  33656. lodash.unzipWith = unzipWith;
  33657. lodash.update = update;
  33658. lodash.updateWith = updateWith;
  33659. lodash.values = values;
  33660. lodash.valuesIn = valuesIn;
  33661. lodash.without = without;
  33662. lodash.words = words;
  33663. lodash.wrap = wrap;
  33664. lodash.xor = xor;
  33665. lodash.xorBy = xorBy;
  33666. lodash.xorWith = xorWith;
  33667. lodash.zip = zip;
  33668. lodash.zipObject = zipObject;
  33669. lodash.zipObjectDeep = zipObjectDeep;
  33670. lodash.zipWith = zipWith;
  33671. // Add aliases.
  33672. lodash.entries = toPairs;
  33673. lodash.entriesIn = toPairsIn;
  33674. lodash.extend = assignIn;
  33675. lodash.extendWith = assignInWith;
  33676. // Add methods to `lodash.prototype`.
  33677. mixin(lodash, lodash);
  33678. /*------------------------------------------------------------------------*/
  33679. // Add methods that return unwrapped values in chain sequences.
  33680. lodash.add = add;
  33681. lodash.attempt = attempt;
  33682. lodash.camelCase = camelCase;
  33683. lodash.capitalize = capitalize;
  33684. lodash.ceil = ceil;
  33685. lodash.clamp = clamp;
  33686. lodash.clone = clone;
  33687. lodash.cloneDeep = cloneDeep;
  33688. lodash.cloneDeepWith = cloneDeepWith;
  33689. lodash.cloneWith = cloneWith;
  33690. lodash.conformsTo = conformsTo;
  33691. lodash.deburr = deburr;
  33692. lodash.defaultTo = defaultTo;
  33693. lodash.divide = divide;
  33694. lodash.endsWith = endsWith;
  33695. lodash.eq = eq;
  33696. lodash.escape = escape;
  33697. lodash.escapeRegExp = escapeRegExp;
  33698. lodash.every = every;
  33699. lodash.find = find;
  33700. lodash.findIndex = findIndex;
  33701. lodash.findKey = findKey;
  33702. lodash.findLast = findLast;
  33703. lodash.findLastIndex = findLastIndex;
  33704. lodash.findLastKey = findLastKey;
  33705. lodash.floor = floor;
  33706. lodash.forEach = forEach;
  33707. lodash.forEachRight = forEachRight;
  33708. lodash.forIn = forIn;
  33709. lodash.forInRight = forInRight;
  33710. lodash.forOwn = forOwn;
  33711. lodash.forOwnRight = forOwnRight;
  33712. lodash.get = get;
  33713. lodash.gt = gt;
  33714. lodash.gte = gte;
  33715. lodash.has = has;
  33716. lodash.hasIn = hasIn;
  33717. lodash.head = head;
  33718. lodash.identity = identity;
  33719. lodash.includes = includes;
  33720. lodash.indexOf = indexOf;
  33721. lodash.inRange = inRange;
  33722. lodash.invoke = invoke;
  33723. lodash.isArguments = isArguments;
  33724. lodash.isArray = isArray;
  33725. lodash.isArrayBuffer = isArrayBuffer;
  33726. lodash.isArrayLike = isArrayLike;
  33727. lodash.isArrayLikeObject = isArrayLikeObject;
  33728. lodash.isBoolean = isBoolean;
  33729. lodash.isBuffer = isBuffer;
  33730. lodash.isDate = isDate;
  33731. lodash.isElement = isElement;
  33732. lodash.isEmpty = isEmpty;
  33733. lodash.isEqual = isEqual;
  33734. lodash.isEqualWith = isEqualWith;
  33735. lodash.isError = isError;
  33736. lodash.isFinite = isFinite;
  33737. lodash.isFunction = isFunction;
  33738. lodash.isInteger = isInteger;
  33739. lodash.isLength = isLength;
  33740. lodash.isMap = isMap;
  33741. lodash.isMatch = isMatch;
  33742. lodash.isMatchWith = isMatchWith;
  33743. lodash.isNaN = isNaN;
  33744. lodash.isNative = isNative;
  33745. lodash.isNil = isNil;
  33746. lodash.isNull = isNull;
  33747. lodash.isNumber = isNumber;
  33748. lodash.isObject = isObject;
  33749. lodash.isObjectLike = isObjectLike;
  33750. lodash.isPlainObject = isPlainObject;
  33751. lodash.isRegExp = isRegExp;
  33752. lodash.isSafeInteger = isSafeInteger;
  33753. lodash.isSet = isSet;
  33754. lodash.isString = isString;
  33755. lodash.isSymbol = isSymbol;
  33756. lodash.isTypedArray = isTypedArray;
  33757. lodash.isUndefined = isUndefined;
  33758. lodash.isWeakMap = isWeakMap;
  33759. lodash.isWeakSet = isWeakSet;
  33760. lodash.join = join;
  33761. lodash.kebabCase = kebabCase;
  33762. lodash.last = last;
  33763. lodash.lastIndexOf = lastIndexOf;
  33764. lodash.lowerCase = lowerCase;
  33765. lodash.lowerFirst = lowerFirst;
  33766. lodash.lt = lt;
  33767. lodash.lte = lte;
  33768. lodash.max = max;
  33769. lodash.maxBy = maxBy;
  33770. lodash.mean = mean;
  33771. lodash.meanBy = meanBy;
  33772. lodash.min = min;
  33773. lodash.minBy = minBy;
  33774. lodash.stubArray = stubArray;
  33775. lodash.stubFalse = stubFalse;
  33776. lodash.stubObject = stubObject;
  33777. lodash.stubString = stubString;
  33778. lodash.stubTrue = stubTrue;
  33779. lodash.multiply = multiply;
  33780. lodash.nth = nth;
  33781. lodash.noConflict = noConflict;
  33782. lodash.noop = noop;
  33783. lodash.now = now;
  33784. lodash.pad = pad;
  33785. lodash.padEnd = padEnd;
  33786. lodash.padStart = padStart;
  33787. lodash.parseInt = parseInt;
  33788. lodash.random = random;
  33789. lodash.reduce = reduce;
  33790. lodash.reduceRight = reduceRight;
  33791. lodash.repeat = repeat;
  33792. lodash.replace = replace;
  33793. lodash.result = result;
  33794. lodash.round = round;
  33795. lodash.runInContext = runInContext;
  33796. lodash.sample = sample;
  33797. lodash.size = size;
  33798. lodash.snakeCase = snakeCase;
  33799. lodash.some = some;
  33800. lodash.sortedIndex = sortedIndex;
  33801. lodash.sortedIndexBy = sortedIndexBy;
  33802. lodash.sortedIndexOf = sortedIndexOf;
  33803. lodash.sortedLastIndex = sortedLastIndex;
  33804. lodash.sortedLastIndexBy = sortedLastIndexBy;
  33805. lodash.sortedLastIndexOf = sortedLastIndexOf;
  33806. lodash.startCase = startCase;
  33807. lodash.startsWith = startsWith;
  33808. lodash.subtract = subtract;
  33809. lodash.sum = sum;
  33810. lodash.sumBy = sumBy;
  33811. lodash.template = template;
  33812. lodash.times = times;
  33813. lodash.toFinite = toFinite;
  33814. lodash.toInteger = toInteger;
  33815. lodash.toLength = toLength;
  33816. lodash.toLower = toLower;
  33817. lodash.toNumber = toNumber;
  33818. lodash.toSafeInteger = toSafeInteger;
  33819. lodash.toString = toString;
  33820. lodash.toUpper = toUpper;
  33821. lodash.trim = trim;
  33822. lodash.trimEnd = trimEnd;
  33823. lodash.trimStart = trimStart;
  33824. lodash.truncate = truncate;
  33825. lodash.unescape = unescape;
  33826. lodash.uniqueId = uniqueId;
  33827. lodash.upperCase = upperCase;
  33828. lodash.upperFirst = upperFirst;
  33829. // Add aliases.
  33830. lodash.each = forEach;
  33831. lodash.eachRight = forEachRight;
  33832. lodash.first = head;
  33833. mixin(lodash, (function() {
  33834. var source = {};
  33835. baseForOwn(lodash, function(func, methodName) {
  33836. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  33837. source[methodName] = func;
  33838. }
  33839. });
  33840. return source;
  33841. }()), { 'chain': false });
  33842. /*------------------------------------------------------------------------*/
  33843. /**
  33844. * The semantic version number.
  33845. *
  33846. * @static
  33847. * @memberOf _
  33848. * @type {string}
  33849. */
  33850. lodash.VERSION = VERSION;
  33851. // Assign default placeholders.
  33852. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  33853. lodash[methodName].placeholder = lodash;
  33854. });
  33855. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  33856. arrayEach(['drop', 'take'], function(methodName, index) {
  33857. LazyWrapper.prototype[methodName] = function(n) {
  33858. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  33859. var result = (this.__filtered__ && !index)
  33860. ? new LazyWrapper(this)
  33861. : this.clone();
  33862. if (result.__filtered__) {
  33863. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  33864. } else {
  33865. result.__views__.push({
  33866. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  33867. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  33868. });
  33869. }
  33870. return result;
  33871. };
  33872. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  33873. return this.reverse()[methodName](n).reverse();
  33874. };
  33875. });
  33876. // Add `LazyWrapper` methods that accept an `iteratee` value.
  33877. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  33878. var type = index + 1,
  33879. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  33880. LazyWrapper.prototype[methodName] = function(iteratee) {
  33881. var result = this.clone();
  33882. result.__iteratees__.push({
  33883. 'iteratee': getIteratee(iteratee, 3),
  33884. 'type': type
  33885. });
  33886. result.__filtered__ = result.__filtered__ || isFilter;
  33887. return result;
  33888. };
  33889. });
  33890. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  33891. arrayEach(['head', 'last'], function(methodName, index) {
  33892. var takeName = 'take' + (index ? 'Right' : '');
  33893. LazyWrapper.prototype[methodName] = function() {
  33894. return this[takeName](1).value()[0];
  33895. };
  33896. });
  33897. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  33898. arrayEach(['initial', 'tail'], function(methodName, index) {
  33899. var dropName = 'drop' + (index ? '' : 'Right');
  33900. LazyWrapper.prototype[methodName] = function() {
  33901. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  33902. };
  33903. });
  33904. LazyWrapper.prototype.compact = function() {
  33905. return this.filter(identity);
  33906. };
  33907. LazyWrapper.prototype.find = function(predicate) {
  33908. return this.filter(predicate).head();
  33909. };
  33910. LazyWrapper.prototype.findLast = function(predicate) {
  33911. return this.reverse().find(predicate);
  33912. };
  33913. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  33914. if (typeof path == 'function') {
  33915. return new LazyWrapper(this);
  33916. }
  33917. return this.map(function(value) {
  33918. return baseInvoke(value, path, args);
  33919. });
  33920. });
  33921. LazyWrapper.prototype.reject = function(predicate) {
  33922. return this.filter(negate(getIteratee(predicate)));
  33923. };
  33924. LazyWrapper.prototype.slice = function(start, end) {
  33925. start = toInteger(start);
  33926. var result = this;
  33927. if (result.__filtered__ && (start > 0 || end < 0)) {
  33928. return new LazyWrapper(result);
  33929. }
  33930. if (start < 0) {
  33931. result = result.takeRight(-start);
  33932. } else if (start) {
  33933. result = result.drop(start);
  33934. }
  33935. if (end !== undefined) {
  33936. end = toInteger(end);
  33937. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  33938. }
  33939. return result;
  33940. };
  33941. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  33942. return this.reverse().takeWhile(predicate).reverse();
  33943. };
  33944. LazyWrapper.prototype.toArray = function() {
  33945. return this.take(MAX_ARRAY_LENGTH);
  33946. };
  33947. // Add `LazyWrapper` methods to `lodash.prototype`.
  33948. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33949. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  33950. isTaker = /^(?:head|last)$/.test(methodName),
  33951. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  33952. retUnwrapped = isTaker || /^find/.test(methodName);
  33953. if (!lodashFunc) {
  33954. return;
  33955. }
  33956. lodash.prototype[methodName] = function() {
  33957. var value = this.__wrapped__,
  33958. args = isTaker ? [1] : arguments,
  33959. isLazy = value instanceof LazyWrapper,
  33960. iteratee = args[0],
  33961. useLazy = isLazy || isArray(value);
  33962. var interceptor = function(value) {
  33963. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  33964. return (isTaker && chainAll) ? result[0] : result;
  33965. };
  33966. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  33967. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  33968. isLazy = useLazy = false;
  33969. }
  33970. var chainAll = this.__chain__,
  33971. isHybrid = !!this.__actions__.length,
  33972. isUnwrapped = retUnwrapped && !chainAll,
  33973. onlyLazy = isLazy && !isHybrid;
  33974. if (!retUnwrapped && useLazy) {
  33975. value = onlyLazy ? value : new LazyWrapper(this);
  33976. var result = func.apply(value, args);
  33977. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  33978. return new LodashWrapper(result, chainAll);
  33979. }
  33980. if (isUnwrapped && onlyLazy) {
  33981. return func.apply(this, args);
  33982. }
  33983. result = this.thru(interceptor);
  33984. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  33985. };
  33986. });
  33987. // Add `Array` methods to `lodash.prototype`.
  33988. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  33989. var func = arrayProto[methodName],
  33990. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  33991. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  33992. lodash.prototype[methodName] = function() {
  33993. var args = arguments;
  33994. if (retUnwrapped && !this.__chain__) {
  33995. var value = this.value();
  33996. return func.apply(isArray(value) ? value : [], args);
  33997. }
  33998. return this[chainName](function(value) {
  33999. return func.apply(isArray(value) ? value : [], args);
  34000. });
  34001. };
  34002. });
  34003. // Map minified method names to their real names.
  34004. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34005. var lodashFunc = lodash[methodName];
  34006. if (lodashFunc) {
  34007. var key = lodashFunc.name + '';
  34008. if (!hasOwnProperty.call(realNames, key)) {
  34009. realNames[key] = [];
  34010. }
  34011. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34012. }
  34013. });
  34014. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34015. 'name': 'wrapper',
  34016. 'func': undefined
  34017. }];
  34018. // Add methods to `LazyWrapper`.
  34019. LazyWrapper.prototype.clone = lazyClone;
  34020. LazyWrapper.prototype.reverse = lazyReverse;
  34021. LazyWrapper.prototype.value = lazyValue;
  34022. // Add chain sequence methods to the `lodash` wrapper.
  34023. lodash.prototype.at = wrapperAt;
  34024. lodash.prototype.chain = wrapperChain;
  34025. lodash.prototype.commit = wrapperCommit;
  34026. lodash.prototype.next = wrapperNext;
  34027. lodash.prototype.plant = wrapperPlant;
  34028. lodash.prototype.reverse = wrapperReverse;
  34029. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34030. // Add lazy aliases.
  34031. lodash.prototype.first = lodash.prototype.head;
  34032. if (symIterator) {
  34033. lodash.prototype[symIterator] = wrapperToIterator;
  34034. }
  34035. return lodash;
  34036. });
  34037. /*--------------------------------------------------------------------------*/
  34038. // Export lodash.
  34039. var _ = runInContext();
  34040. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34041. if (true) {
  34042. // Expose Lodash on the global object to prevent errors when Lodash is
  34043. // loaded by a script tag in the presence of an AMD loader.
  34044. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34045. // Use `_.noConflict` to remove Lodash from the global object.
  34046. root._ = _;
  34047. // Define as an anonymous module so, through path mapping, it can be
  34048. // referenced as the "underscore" module.
  34049. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34050. return _;
  34051. }).call(exports, __webpack_require__, exports, module),
  34052. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34053. }
  34054. // Check for `exports` after `define` in case a build optimizer adds it.
  34055. else {}
  34056. }.call(this));
  34057. /* 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)))
  34058. /***/ }),
  34059. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34060. /*!***************************************************!*\
  34061. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34062. \***************************************************/
  34063. /*! exports provided: default */
  34064. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34065. "use strict";
  34066. __webpack_require__.r(__webpack_exports__);
  34067. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34068. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34069. * @version 1.16.1
  34070. * @license
  34071. * Copyright (c) 2016 Federico Zivolo and contributors
  34072. *
  34073. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34074. * of this software and associated documentation files (the "Software"), to deal
  34075. * in the Software without restriction, including without limitation the rights
  34076. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34077. * copies of the Software, and to permit persons to whom the Software is
  34078. * furnished to do so, subject to the following conditions:
  34079. *
  34080. * The above copyright notice and this permission notice shall be included in all
  34081. * copies or substantial portions of the Software.
  34082. *
  34083. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34084. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34085. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34086. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34087. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34088. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34089. * SOFTWARE.
  34090. */
  34091. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34092. var timeoutDuration = function () {
  34093. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34094. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34095. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34096. return 1;
  34097. }
  34098. }
  34099. return 0;
  34100. }();
  34101. function microtaskDebounce(fn) {
  34102. var called = false;
  34103. return function () {
  34104. if (called) {
  34105. return;
  34106. }
  34107. called = true;
  34108. window.Promise.resolve().then(function () {
  34109. called = false;
  34110. fn();
  34111. });
  34112. };
  34113. }
  34114. function taskDebounce(fn) {
  34115. var scheduled = false;
  34116. return function () {
  34117. if (!scheduled) {
  34118. scheduled = true;
  34119. setTimeout(function () {
  34120. scheduled = false;
  34121. fn();
  34122. }, timeoutDuration);
  34123. }
  34124. };
  34125. }
  34126. var supportsMicroTasks = isBrowser && window.Promise;
  34127. /**
  34128. * Create a debounced version of a method, that's asynchronously deferred
  34129. * but called in the minimum time possible.
  34130. *
  34131. * @method
  34132. * @memberof Popper.Utils
  34133. * @argument {Function} fn
  34134. * @returns {Function}
  34135. */
  34136. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34137. /**
  34138. * Check if the given variable is a function
  34139. * @method
  34140. * @memberof Popper.Utils
  34141. * @argument {Any} functionToCheck - variable to check
  34142. * @returns {Boolean} answer to: is a function?
  34143. */
  34144. function isFunction(functionToCheck) {
  34145. var getType = {};
  34146. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34147. }
  34148. /**
  34149. * Get CSS computed property of the given element
  34150. * @method
  34151. * @memberof Popper.Utils
  34152. * @argument {Eement} element
  34153. * @argument {String} property
  34154. */
  34155. function getStyleComputedProperty(element, property) {
  34156. if (element.nodeType !== 1) {
  34157. return [];
  34158. }
  34159. // NOTE: 1 DOM access here
  34160. var window = element.ownerDocument.defaultView;
  34161. var css = window.getComputedStyle(element, null);
  34162. return property ? css[property] : css;
  34163. }
  34164. /**
  34165. * Returns the parentNode or the host of the element
  34166. * @method
  34167. * @memberof Popper.Utils
  34168. * @argument {Element} element
  34169. * @returns {Element} parent
  34170. */
  34171. function getParentNode(element) {
  34172. if (element.nodeName === 'HTML') {
  34173. return element;
  34174. }
  34175. return element.parentNode || element.host;
  34176. }
  34177. /**
  34178. * Returns the scrolling parent of the given element
  34179. * @method
  34180. * @memberof Popper.Utils
  34181. * @argument {Element} element
  34182. * @returns {Element} scroll parent
  34183. */
  34184. function getScrollParent(element) {
  34185. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34186. if (!element) {
  34187. return document.body;
  34188. }
  34189. switch (element.nodeName) {
  34190. case 'HTML':
  34191. case 'BODY':
  34192. return element.ownerDocument.body;
  34193. case '#document':
  34194. return element.body;
  34195. }
  34196. // Firefox want us to check `-x` and `-y` variations as well
  34197. var _getStyleComputedProp = getStyleComputedProperty(element),
  34198. overflow = _getStyleComputedProp.overflow,
  34199. overflowX = _getStyleComputedProp.overflowX,
  34200. overflowY = _getStyleComputedProp.overflowY;
  34201. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34202. return element;
  34203. }
  34204. return getScrollParent(getParentNode(element));
  34205. }
  34206. /**
  34207. * Returns the reference node of the reference object, or the reference object itself.
  34208. * @method
  34209. * @memberof Popper.Utils
  34210. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34211. * @returns {Element} parent
  34212. */
  34213. function getReferenceNode(reference) {
  34214. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34215. }
  34216. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34217. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34218. /**
  34219. * Determines if the browser is Internet Explorer
  34220. * @method
  34221. * @memberof Popper.Utils
  34222. * @param {Number} version to check
  34223. * @returns {Boolean} isIE
  34224. */
  34225. function isIE(version) {
  34226. if (version === 11) {
  34227. return isIE11;
  34228. }
  34229. if (version === 10) {
  34230. return isIE10;
  34231. }
  34232. return isIE11 || isIE10;
  34233. }
  34234. /**
  34235. * Returns the offset parent of the given element
  34236. * @method
  34237. * @memberof Popper.Utils
  34238. * @argument {Element} element
  34239. * @returns {Element} offset parent
  34240. */
  34241. function getOffsetParent(element) {
  34242. if (!element) {
  34243. return document.documentElement;
  34244. }
  34245. var noOffsetParent = isIE(10) ? document.body : null;
  34246. // NOTE: 1 DOM access here
  34247. var offsetParent = element.offsetParent || null;
  34248. // Skip hidden elements which don't have an offsetParent
  34249. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34250. offsetParent = (element = element.nextElementSibling).offsetParent;
  34251. }
  34252. var nodeName = offsetParent && offsetParent.nodeName;
  34253. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34254. return element ? element.ownerDocument.documentElement : document.documentElement;
  34255. }
  34256. // .offsetParent will return the closest TH, TD or TABLE in case
  34257. // no offsetParent is present, I hate this job...
  34258. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34259. return getOffsetParent(offsetParent);
  34260. }
  34261. return offsetParent;
  34262. }
  34263. function isOffsetContainer(element) {
  34264. var nodeName = element.nodeName;
  34265. if (nodeName === 'BODY') {
  34266. return false;
  34267. }
  34268. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34269. }
  34270. /**
  34271. * Finds the root node (document, shadowDOM root) of the given element
  34272. * @method
  34273. * @memberof Popper.Utils
  34274. * @argument {Element} node
  34275. * @returns {Element} root node
  34276. */
  34277. function getRoot(node) {
  34278. if (node.parentNode !== null) {
  34279. return getRoot(node.parentNode);
  34280. }
  34281. return node;
  34282. }
  34283. /**
  34284. * Finds the offset parent common to the two provided nodes
  34285. * @method
  34286. * @memberof Popper.Utils
  34287. * @argument {Element} element1
  34288. * @argument {Element} element2
  34289. * @returns {Element} common offset parent
  34290. */
  34291. function findCommonOffsetParent(element1, element2) {
  34292. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34293. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34294. return document.documentElement;
  34295. }
  34296. // Here we make sure to give as "start" the element that comes first in the DOM
  34297. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34298. var start = order ? element1 : element2;
  34299. var end = order ? element2 : element1;
  34300. // Get common ancestor container
  34301. var range = document.createRange();
  34302. range.setStart(start, 0);
  34303. range.setEnd(end, 0);
  34304. var commonAncestorContainer = range.commonAncestorContainer;
  34305. // Both nodes are inside #document
  34306. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34307. if (isOffsetContainer(commonAncestorContainer)) {
  34308. return commonAncestorContainer;
  34309. }
  34310. return getOffsetParent(commonAncestorContainer);
  34311. }
  34312. // one of the nodes is inside shadowDOM, find which one
  34313. var element1root = getRoot(element1);
  34314. if (element1root.host) {
  34315. return findCommonOffsetParent(element1root.host, element2);
  34316. } else {
  34317. return findCommonOffsetParent(element1, getRoot(element2).host);
  34318. }
  34319. }
  34320. /**
  34321. * Gets the scroll value of the given element in the given side (top and left)
  34322. * @method
  34323. * @memberof Popper.Utils
  34324. * @argument {Element} element
  34325. * @argument {String} side `top` or `left`
  34326. * @returns {number} amount of scrolled pixels
  34327. */
  34328. function getScroll(element) {
  34329. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34330. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34331. var nodeName = element.nodeName;
  34332. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34333. var html = element.ownerDocument.documentElement;
  34334. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34335. return scrollingElement[upperSide];
  34336. }
  34337. return element[upperSide];
  34338. }
  34339. /*
  34340. * Sum or subtract the element scroll values (left and top) from a given rect object
  34341. * @method
  34342. * @memberof Popper.Utils
  34343. * @param {Object} rect - Rect object you want to change
  34344. * @param {HTMLElement} element - The element from the function reads the scroll values
  34345. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34346. * @return {Object} rect - The modifier rect object
  34347. */
  34348. function includeScroll(rect, element) {
  34349. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34350. var scrollTop = getScroll(element, 'top');
  34351. var scrollLeft = getScroll(element, 'left');
  34352. var modifier = subtract ? -1 : 1;
  34353. rect.top += scrollTop * modifier;
  34354. rect.bottom += scrollTop * modifier;
  34355. rect.left += scrollLeft * modifier;
  34356. rect.right += scrollLeft * modifier;
  34357. return rect;
  34358. }
  34359. /*
  34360. * Helper to detect borders of a given element
  34361. * @method
  34362. * @memberof Popper.Utils
  34363. * @param {CSSStyleDeclaration} styles
  34364. * Result of `getStyleComputedProperty` on the given element
  34365. * @param {String} axis - `x` or `y`
  34366. * @return {number} borders - The borders size of the given axis
  34367. */
  34368. function getBordersSize(styles, axis) {
  34369. var sideA = axis === 'x' ? 'Left' : 'Top';
  34370. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34371. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34372. }
  34373. function getSize(axis, body, html, computedStyle) {
  34374. 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);
  34375. }
  34376. function getWindowSizes(document) {
  34377. var body = document.body;
  34378. var html = document.documentElement;
  34379. var computedStyle = isIE(10) && getComputedStyle(html);
  34380. return {
  34381. height: getSize('Height', body, html, computedStyle),
  34382. width: getSize('Width', body, html, computedStyle)
  34383. };
  34384. }
  34385. var classCallCheck = function (instance, Constructor) {
  34386. if (!(instance instanceof Constructor)) {
  34387. throw new TypeError("Cannot call a class as a function");
  34388. }
  34389. };
  34390. var createClass = function () {
  34391. function defineProperties(target, props) {
  34392. for (var i = 0; i < props.length; i++) {
  34393. var descriptor = props[i];
  34394. descriptor.enumerable = descriptor.enumerable || false;
  34395. descriptor.configurable = true;
  34396. if ("value" in descriptor) descriptor.writable = true;
  34397. Object.defineProperty(target, descriptor.key, descriptor);
  34398. }
  34399. }
  34400. return function (Constructor, protoProps, staticProps) {
  34401. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34402. if (staticProps) defineProperties(Constructor, staticProps);
  34403. return Constructor;
  34404. };
  34405. }();
  34406. var defineProperty = function (obj, key, value) {
  34407. if (key in obj) {
  34408. Object.defineProperty(obj, key, {
  34409. value: value,
  34410. enumerable: true,
  34411. configurable: true,
  34412. writable: true
  34413. });
  34414. } else {
  34415. obj[key] = value;
  34416. }
  34417. return obj;
  34418. };
  34419. var _extends = Object.assign || function (target) {
  34420. for (var i = 1; i < arguments.length; i++) {
  34421. var source = arguments[i];
  34422. for (var key in source) {
  34423. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34424. target[key] = source[key];
  34425. }
  34426. }
  34427. }
  34428. return target;
  34429. };
  34430. /**
  34431. * Given element offsets, generate an output similar to getBoundingClientRect
  34432. * @method
  34433. * @memberof Popper.Utils
  34434. * @argument {Object} offsets
  34435. * @returns {Object} ClientRect like output
  34436. */
  34437. function getClientRect(offsets) {
  34438. return _extends({}, offsets, {
  34439. right: offsets.left + offsets.width,
  34440. bottom: offsets.top + offsets.height
  34441. });
  34442. }
  34443. /**
  34444. * Get bounding client rect of given element
  34445. * @method
  34446. * @memberof Popper.Utils
  34447. * @param {HTMLElement} element
  34448. * @return {Object} client rect
  34449. */
  34450. function getBoundingClientRect(element) {
  34451. var rect = {};
  34452. // IE10 10 FIX: Please, don't ask, the element isn't
  34453. // considered in DOM in some circumstances...
  34454. // This isn't reproducible in IE10 compatibility mode of IE11
  34455. try {
  34456. if (isIE(10)) {
  34457. rect = element.getBoundingClientRect();
  34458. var scrollTop = getScroll(element, 'top');
  34459. var scrollLeft = getScroll(element, 'left');
  34460. rect.top += scrollTop;
  34461. rect.left += scrollLeft;
  34462. rect.bottom += scrollTop;
  34463. rect.right += scrollLeft;
  34464. } else {
  34465. rect = element.getBoundingClientRect();
  34466. }
  34467. } catch (e) {}
  34468. var result = {
  34469. left: rect.left,
  34470. top: rect.top,
  34471. width: rect.right - rect.left,
  34472. height: rect.bottom - rect.top
  34473. };
  34474. // subtract scrollbar size from sizes
  34475. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34476. var width = sizes.width || element.clientWidth || result.width;
  34477. var height = sizes.height || element.clientHeight || result.height;
  34478. var horizScrollbar = element.offsetWidth - width;
  34479. var vertScrollbar = element.offsetHeight - height;
  34480. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34481. // we make this check conditional for performance reasons
  34482. if (horizScrollbar || vertScrollbar) {
  34483. var styles = getStyleComputedProperty(element);
  34484. horizScrollbar -= getBordersSize(styles, 'x');
  34485. vertScrollbar -= getBordersSize(styles, 'y');
  34486. result.width -= horizScrollbar;
  34487. result.height -= vertScrollbar;
  34488. }
  34489. return getClientRect(result);
  34490. }
  34491. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34492. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34493. var isIE10 = isIE(10);
  34494. var isHTML = parent.nodeName === 'HTML';
  34495. var childrenRect = getBoundingClientRect(children);
  34496. var parentRect = getBoundingClientRect(parent);
  34497. var scrollParent = getScrollParent(children);
  34498. var styles = getStyleComputedProperty(parent);
  34499. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34500. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34501. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34502. if (fixedPosition && isHTML) {
  34503. parentRect.top = Math.max(parentRect.top, 0);
  34504. parentRect.left = Math.max(parentRect.left, 0);
  34505. }
  34506. var offsets = getClientRect({
  34507. top: childrenRect.top - parentRect.top - borderTopWidth,
  34508. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34509. width: childrenRect.width,
  34510. height: childrenRect.height
  34511. });
  34512. offsets.marginTop = 0;
  34513. offsets.marginLeft = 0;
  34514. // Subtract margins of documentElement in case it's being used as parent
  34515. // we do this only on HTML because it's the only element that behaves
  34516. // differently when margins are applied to it. The margins are included in
  34517. // the box of the documentElement, in the other cases not.
  34518. if (!isIE10 && isHTML) {
  34519. var marginTop = parseFloat(styles.marginTop);
  34520. var marginLeft = parseFloat(styles.marginLeft);
  34521. offsets.top -= borderTopWidth - marginTop;
  34522. offsets.bottom -= borderTopWidth - marginTop;
  34523. offsets.left -= borderLeftWidth - marginLeft;
  34524. offsets.right -= borderLeftWidth - marginLeft;
  34525. // Attach marginTop and marginLeft because in some circumstances we may need them
  34526. offsets.marginTop = marginTop;
  34527. offsets.marginLeft = marginLeft;
  34528. }
  34529. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34530. offsets = includeScroll(offsets, parent);
  34531. }
  34532. return offsets;
  34533. }
  34534. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34535. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34536. var html = element.ownerDocument.documentElement;
  34537. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34538. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34539. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34540. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34541. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34542. var offset = {
  34543. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34544. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34545. width: width,
  34546. height: height
  34547. };
  34548. return getClientRect(offset);
  34549. }
  34550. /**
  34551. * Check if the given element is fixed or is inside a fixed parent
  34552. * @method
  34553. * @memberof Popper.Utils
  34554. * @argument {Element} element
  34555. * @argument {Element} customContainer
  34556. * @returns {Boolean} answer to "isFixed?"
  34557. */
  34558. function isFixed(element) {
  34559. var nodeName = element.nodeName;
  34560. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34561. return false;
  34562. }
  34563. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34564. return true;
  34565. }
  34566. var parentNode = getParentNode(element);
  34567. if (!parentNode) {
  34568. return false;
  34569. }
  34570. return isFixed(parentNode);
  34571. }
  34572. /**
  34573. * Finds the first parent of an element that has a transformed property defined
  34574. * @method
  34575. * @memberof Popper.Utils
  34576. * @argument {Element} element
  34577. * @returns {Element} first transformed parent or documentElement
  34578. */
  34579. function getFixedPositionOffsetParent(element) {
  34580. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34581. if (!element || !element.parentElement || isIE()) {
  34582. return document.documentElement;
  34583. }
  34584. var el = element.parentElement;
  34585. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34586. el = el.parentElement;
  34587. }
  34588. return el || document.documentElement;
  34589. }
  34590. /**
  34591. * Computed the boundaries limits and return them
  34592. * @method
  34593. * @memberof Popper.Utils
  34594. * @param {HTMLElement} popper
  34595. * @param {HTMLElement} reference
  34596. * @param {number} padding
  34597. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34598. * @param {Boolean} fixedPosition - Is in fixed position mode
  34599. * @returns {Object} Coordinates of the boundaries
  34600. */
  34601. function getBoundaries(popper, reference, padding, boundariesElement) {
  34602. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34603. // NOTE: 1 DOM access here
  34604. var boundaries = { top: 0, left: 0 };
  34605. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34606. // Handle viewport case
  34607. if (boundariesElement === 'viewport') {
  34608. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34609. } else {
  34610. // Handle other cases based on DOM element used as boundaries
  34611. var boundariesNode = void 0;
  34612. if (boundariesElement === 'scrollParent') {
  34613. boundariesNode = getScrollParent(getParentNode(reference));
  34614. if (boundariesNode.nodeName === 'BODY') {
  34615. boundariesNode = popper.ownerDocument.documentElement;
  34616. }
  34617. } else if (boundariesElement === 'window') {
  34618. boundariesNode = popper.ownerDocument.documentElement;
  34619. } else {
  34620. boundariesNode = boundariesElement;
  34621. }
  34622. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34623. // In case of HTML, we need a different computation
  34624. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34625. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34626. height = _getWindowSizes.height,
  34627. width = _getWindowSizes.width;
  34628. boundaries.top += offsets.top - offsets.marginTop;
  34629. boundaries.bottom = height + offsets.top;
  34630. boundaries.left += offsets.left - offsets.marginLeft;
  34631. boundaries.right = width + offsets.left;
  34632. } else {
  34633. // for all the other DOM elements, this one is good
  34634. boundaries = offsets;
  34635. }
  34636. }
  34637. // Add paddings
  34638. padding = padding || 0;
  34639. var isPaddingNumber = typeof padding === 'number';
  34640. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34641. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34642. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34643. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34644. return boundaries;
  34645. }
  34646. function getArea(_ref) {
  34647. var width = _ref.width,
  34648. height = _ref.height;
  34649. return width * height;
  34650. }
  34651. /**
  34652. * Utility used to transform the `auto` placement to the placement with more
  34653. * available space.
  34654. * @method
  34655. * @memberof Popper.Utils
  34656. * @argument {Object} data - The data object generated by update method
  34657. * @argument {Object} options - Modifiers configuration and options
  34658. * @returns {Object} The data object, properly modified
  34659. */
  34660. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34661. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34662. if (placement.indexOf('auto') === -1) {
  34663. return placement;
  34664. }
  34665. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34666. var rects = {
  34667. top: {
  34668. width: boundaries.width,
  34669. height: refRect.top - boundaries.top
  34670. },
  34671. right: {
  34672. width: boundaries.right - refRect.right,
  34673. height: boundaries.height
  34674. },
  34675. bottom: {
  34676. width: boundaries.width,
  34677. height: boundaries.bottom - refRect.bottom
  34678. },
  34679. left: {
  34680. width: refRect.left - boundaries.left,
  34681. height: boundaries.height
  34682. }
  34683. };
  34684. var sortedAreas = Object.keys(rects).map(function (key) {
  34685. return _extends({
  34686. key: key
  34687. }, rects[key], {
  34688. area: getArea(rects[key])
  34689. });
  34690. }).sort(function (a, b) {
  34691. return b.area - a.area;
  34692. });
  34693. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34694. var width = _ref2.width,
  34695. height = _ref2.height;
  34696. return width >= popper.clientWidth && height >= popper.clientHeight;
  34697. });
  34698. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34699. var variation = placement.split('-')[1];
  34700. return computedPlacement + (variation ? '-' + variation : '');
  34701. }
  34702. /**
  34703. * Get offsets to the reference element
  34704. * @method
  34705. * @memberof Popper.Utils
  34706. * @param {Object} state
  34707. * @param {Element} popper - the popper element
  34708. * @param {Element} reference - the reference element (the popper will be relative to this)
  34709. * @param {Element} fixedPosition - is in fixed position mode
  34710. * @returns {Object} An object containing the offsets which will be applied to the popper
  34711. */
  34712. function getReferenceOffsets(state, popper, reference) {
  34713. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34714. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34715. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34716. }
  34717. /**
  34718. * Get the outer sizes of the given element (offset size + margins)
  34719. * @method
  34720. * @memberof Popper.Utils
  34721. * @argument {Element} element
  34722. * @returns {Object} object containing width and height properties
  34723. */
  34724. function getOuterSizes(element) {
  34725. var window = element.ownerDocument.defaultView;
  34726. var styles = window.getComputedStyle(element);
  34727. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34728. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34729. var result = {
  34730. width: element.offsetWidth + y,
  34731. height: element.offsetHeight + x
  34732. };
  34733. return result;
  34734. }
  34735. /**
  34736. * Get the opposite placement of the given one
  34737. * @method
  34738. * @memberof Popper.Utils
  34739. * @argument {String} placement
  34740. * @returns {String} flipped placement
  34741. */
  34742. function getOppositePlacement(placement) {
  34743. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  34744. return placement.replace(/left|right|bottom|top/g, function (matched) {
  34745. return hash[matched];
  34746. });
  34747. }
  34748. /**
  34749. * Get offsets to the popper
  34750. * @method
  34751. * @memberof Popper.Utils
  34752. * @param {Object} position - CSS position the Popper will get applied
  34753. * @param {HTMLElement} popper - the popper element
  34754. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  34755. * @param {String} placement - one of the valid placement options
  34756. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  34757. */
  34758. function getPopperOffsets(popper, referenceOffsets, placement) {
  34759. placement = placement.split('-')[0];
  34760. // Get popper node sizes
  34761. var popperRect = getOuterSizes(popper);
  34762. // Add position, width and height to our offsets object
  34763. var popperOffsets = {
  34764. width: popperRect.width,
  34765. height: popperRect.height
  34766. };
  34767. // depending by the popper placement we have to compute its offsets slightly differently
  34768. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  34769. var mainSide = isHoriz ? 'top' : 'left';
  34770. var secondarySide = isHoriz ? 'left' : 'top';
  34771. var measurement = isHoriz ? 'height' : 'width';
  34772. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  34773. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  34774. if (placement === secondarySide) {
  34775. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  34776. } else {
  34777. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  34778. }
  34779. return popperOffsets;
  34780. }
  34781. /**
  34782. * Mimics the `find` method of Array
  34783. * @method
  34784. * @memberof Popper.Utils
  34785. * @argument {Array} arr
  34786. * @argument prop
  34787. * @argument value
  34788. * @returns index or -1
  34789. */
  34790. function find(arr, check) {
  34791. // use native find if supported
  34792. if (Array.prototype.find) {
  34793. return arr.find(check);
  34794. }
  34795. // use `filter` to obtain the same behavior of `find`
  34796. return arr.filter(check)[0];
  34797. }
  34798. /**
  34799. * Return the index of the matching object
  34800. * @method
  34801. * @memberof Popper.Utils
  34802. * @argument {Array} arr
  34803. * @argument prop
  34804. * @argument value
  34805. * @returns index or -1
  34806. */
  34807. function findIndex(arr, prop, value) {
  34808. // use native findIndex if supported
  34809. if (Array.prototype.findIndex) {
  34810. return arr.findIndex(function (cur) {
  34811. return cur[prop] === value;
  34812. });
  34813. }
  34814. // use `find` + `indexOf` if `findIndex` isn't supported
  34815. var match = find(arr, function (obj) {
  34816. return obj[prop] === value;
  34817. });
  34818. return arr.indexOf(match);
  34819. }
  34820. /**
  34821. * Loop trough the list of modifiers and run them in order,
  34822. * each of them will then edit the data object.
  34823. * @method
  34824. * @memberof Popper.Utils
  34825. * @param {dataObject} data
  34826. * @param {Array} modifiers
  34827. * @param {String} ends - Optional modifier name used as stopper
  34828. * @returns {dataObject}
  34829. */
  34830. function runModifiers(modifiers, data, ends) {
  34831. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  34832. modifiersToRun.forEach(function (modifier) {
  34833. if (modifier['function']) {
  34834. // eslint-disable-line dot-notation
  34835. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  34836. }
  34837. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  34838. if (modifier.enabled && isFunction(fn)) {
  34839. // Add properties to offsets to make them a complete clientRect object
  34840. // we do this before each modifier to make sure the previous one doesn't
  34841. // mess with these values
  34842. data.offsets.popper = getClientRect(data.offsets.popper);
  34843. data.offsets.reference = getClientRect(data.offsets.reference);
  34844. data = fn(data, modifier);
  34845. }
  34846. });
  34847. return data;
  34848. }
  34849. /**
  34850. * Updates the position of the popper, computing the new offsets and applying
  34851. * the new style.<br />
  34852. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  34853. * @method
  34854. * @memberof Popper
  34855. */
  34856. function update() {
  34857. // if popper is destroyed, don't perform any further update
  34858. if (this.state.isDestroyed) {
  34859. return;
  34860. }
  34861. var data = {
  34862. instance: this,
  34863. styles: {},
  34864. arrowStyles: {},
  34865. attributes: {},
  34866. flipped: false,
  34867. offsets: {}
  34868. };
  34869. // compute reference element offsets
  34870. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  34871. // compute auto placement, store placement inside the data object,
  34872. // modifiers will be able to edit `placement` if needed
  34873. // and refer to originalPlacement to know the original value
  34874. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  34875. // store the computed placement inside `originalPlacement`
  34876. data.originalPlacement = data.placement;
  34877. data.positionFixed = this.options.positionFixed;
  34878. // compute the popper offsets
  34879. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  34880. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  34881. // run the modifiers
  34882. data = runModifiers(this.modifiers, data);
  34883. // the first `update` will call `onCreate` callback
  34884. // the other ones will call `onUpdate` callback
  34885. if (!this.state.isCreated) {
  34886. this.state.isCreated = true;
  34887. this.options.onCreate(data);
  34888. } else {
  34889. this.options.onUpdate(data);
  34890. }
  34891. }
  34892. /**
  34893. * Helper used to know if the given modifier is enabled.
  34894. * @method
  34895. * @memberof Popper.Utils
  34896. * @returns {Boolean}
  34897. */
  34898. function isModifierEnabled(modifiers, modifierName) {
  34899. return modifiers.some(function (_ref) {
  34900. var name = _ref.name,
  34901. enabled = _ref.enabled;
  34902. return enabled && name === modifierName;
  34903. });
  34904. }
  34905. /**
  34906. * Get the prefixed supported property name
  34907. * @method
  34908. * @memberof Popper.Utils
  34909. * @argument {String} property (camelCase)
  34910. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  34911. */
  34912. function getSupportedPropertyName(property) {
  34913. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  34914. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  34915. for (var i = 0; i < prefixes.length; i++) {
  34916. var prefix = prefixes[i];
  34917. var toCheck = prefix ? '' + prefix + upperProp : property;
  34918. if (typeof document.body.style[toCheck] !== 'undefined') {
  34919. return toCheck;
  34920. }
  34921. }
  34922. return null;
  34923. }
  34924. /**
  34925. * Destroys the popper.
  34926. * @method
  34927. * @memberof Popper
  34928. */
  34929. function destroy() {
  34930. this.state.isDestroyed = true;
  34931. // touch DOM only if `applyStyle` modifier is enabled
  34932. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  34933. this.popper.removeAttribute('x-placement');
  34934. this.popper.style.position = '';
  34935. this.popper.style.top = '';
  34936. this.popper.style.left = '';
  34937. this.popper.style.right = '';
  34938. this.popper.style.bottom = '';
  34939. this.popper.style.willChange = '';
  34940. this.popper.style[getSupportedPropertyName('transform')] = '';
  34941. }
  34942. this.disableEventListeners();
  34943. // remove the popper if user explicitly asked for the deletion on destroy
  34944. // do not use `remove` because IE11 doesn't support it
  34945. if (this.options.removeOnDestroy) {
  34946. this.popper.parentNode.removeChild(this.popper);
  34947. }
  34948. return this;
  34949. }
  34950. /**
  34951. * Get the window associated with the element
  34952. * @argument {Element} element
  34953. * @returns {Window}
  34954. */
  34955. function getWindow(element) {
  34956. var ownerDocument = element.ownerDocument;
  34957. return ownerDocument ? ownerDocument.defaultView : window;
  34958. }
  34959. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  34960. var isBody = scrollParent.nodeName === 'BODY';
  34961. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  34962. target.addEventListener(event, callback, { passive: true });
  34963. if (!isBody) {
  34964. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  34965. }
  34966. scrollParents.push(target);
  34967. }
  34968. /**
  34969. * Setup needed event listeners used to update the popper position
  34970. * @method
  34971. * @memberof Popper.Utils
  34972. * @private
  34973. */
  34974. function setupEventListeners(reference, options, state, updateBound) {
  34975. // Resize event listener on window
  34976. state.updateBound = updateBound;
  34977. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  34978. // Scroll event listener on scroll parents
  34979. var scrollElement = getScrollParent(reference);
  34980. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  34981. state.scrollElement = scrollElement;
  34982. state.eventsEnabled = true;
  34983. return state;
  34984. }
  34985. /**
  34986. * It will add resize/scroll events and start recalculating
  34987. * position of the popper element when they are triggered.
  34988. * @method
  34989. * @memberof Popper
  34990. */
  34991. function enableEventListeners() {
  34992. if (!this.state.eventsEnabled) {
  34993. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  34994. }
  34995. }
  34996. /**
  34997. * Remove event listeners used to update the popper position
  34998. * @method
  34999. * @memberof Popper.Utils
  35000. * @private
  35001. */
  35002. function removeEventListeners(reference, state) {
  35003. // Remove resize event listener on window
  35004. getWindow(reference).removeEventListener('resize', state.updateBound);
  35005. // Remove scroll event listener on scroll parents
  35006. state.scrollParents.forEach(function (target) {
  35007. target.removeEventListener('scroll', state.updateBound);
  35008. });
  35009. // Reset state
  35010. state.updateBound = null;
  35011. state.scrollParents = [];
  35012. state.scrollElement = null;
  35013. state.eventsEnabled = false;
  35014. return state;
  35015. }
  35016. /**
  35017. * It will remove resize/scroll events and won't recalculate popper position
  35018. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35019. * unless you call `update` method manually.
  35020. * @method
  35021. * @memberof Popper
  35022. */
  35023. function disableEventListeners() {
  35024. if (this.state.eventsEnabled) {
  35025. cancelAnimationFrame(this.scheduleUpdate);
  35026. this.state = removeEventListeners(this.reference, this.state);
  35027. }
  35028. }
  35029. /**
  35030. * Tells if a given input is a number
  35031. * @method
  35032. * @memberof Popper.Utils
  35033. * @param {*} input to check
  35034. * @return {Boolean}
  35035. */
  35036. function isNumeric(n) {
  35037. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35038. }
  35039. /**
  35040. * Set the style to the given popper
  35041. * @method
  35042. * @memberof Popper.Utils
  35043. * @argument {Element} element - Element to apply the style to
  35044. * @argument {Object} styles
  35045. * Object with a list of properties and values which will be applied to the element
  35046. */
  35047. function setStyles(element, styles) {
  35048. Object.keys(styles).forEach(function (prop) {
  35049. var unit = '';
  35050. // add unit if the value is numeric and is one of the following
  35051. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35052. unit = 'px';
  35053. }
  35054. element.style[prop] = styles[prop] + unit;
  35055. });
  35056. }
  35057. /**
  35058. * Set the attributes to the given popper
  35059. * @method
  35060. * @memberof Popper.Utils
  35061. * @argument {Element} element - Element to apply the attributes to
  35062. * @argument {Object} styles
  35063. * Object with a list of properties and values which will be applied to the element
  35064. */
  35065. function setAttributes(element, attributes) {
  35066. Object.keys(attributes).forEach(function (prop) {
  35067. var value = attributes[prop];
  35068. if (value !== false) {
  35069. element.setAttribute(prop, attributes[prop]);
  35070. } else {
  35071. element.removeAttribute(prop);
  35072. }
  35073. });
  35074. }
  35075. /**
  35076. * @function
  35077. * @memberof Modifiers
  35078. * @argument {Object} data - The data object generated by `update` method
  35079. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35080. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35081. * @argument {Object} options - Modifiers configuration and options
  35082. * @returns {Object} The same data object
  35083. */
  35084. function applyStyle(data) {
  35085. // any property present in `data.styles` will be applied to the popper,
  35086. // in this way we can make the 3rd party modifiers add custom styles to it
  35087. // Be aware, modifiers could override the properties defined in the previous
  35088. // lines of this modifier!
  35089. setStyles(data.instance.popper, data.styles);
  35090. // any property present in `data.attributes` will be applied to the popper,
  35091. // they will be set as HTML attributes of the element
  35092. setAttributes(data.instance.popper, data.attributes);
  35093. // if arrowElement is defined and arrowStyles has some properties
  35094. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35095. setStyles(data.arrowElement, data.arrowStyles);
  35096. }
  35097. return data;
  35098. }
  35099. /**
  35100. * Set the x-placement attribute before everything else because it could be used
  35101. * to add margins to the popper margins needs to be calculated to get the
  35102. * correct popper offsets.
  35103. * @method
  35104. * @memberof Popper.modifiers
  35105. * @param {HTMLElement} reference - The reference element used to position the popper
  35106. * @param {HTMLElement} popper - The HTML element used as popper
  35107. * @param {Object} options - Popper.js options
  35108. */
  35109. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35110. // compute reference element offsets
  35111. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35112. // compute auto placement, store placement inside the data object,
  35113. // modifiers will be able to edit `placement` if needed
  35114. // and refer to originalPlacement to know the original value
  35115. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35116. popper.setAttribute('x-placement', placement);
  35117. // Apply `position` to popper before anything else because
  35118. // without the position applied we can't guarantee correct computations
  35119. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35120. return options;
  35121. }
  35122. /**
  35123. * @function
  35124. * @memberof Popper.Utils
  35125. * @argument {Object} data - The data object generated by `update` method
  35126. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35127. * @returns {Object} The popper's position offsets rounded
  35128. *
  35129. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35130. * good as it can be within reason.
  35131. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35132. *
  35133. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35134. * as well on High DPI screens).
  35135. *
  35136. * Firefox prefers no rounding for positioning and does not have blurriness on
  35137. * high DPI screens.
  35138. *
  35139. * Only horizontal placement and left/right values need to be considered.
  35140. */
  35141. function getRoundedOffsets(data, shouldRound) {
  35142. var _data$offsets = data.offsets,
  35143. popper = _data$offsets.popper,
  35144. reference = _data$offsets.reference;
  35145. var round = Math.round,
  35146. floor = Math.floor;
  35147. var noRound = function noRound(v) {
  35148. return v;
  35149. };
  35150. var referenceWidth = round(reference.width);
  35151. var popperWidth = round(popper.width);
  35152. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35153. var isVariation = data.placement.indexOf('-') !== -1;
  35154. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35155. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35156. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35157. var verticalToInteger = !shouldRound ? noRound : round;
  35158. return {
  35159. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35160. top: verticalToInteger(popper.top),
  35161. bottom: verticalToInteger(popper.bottom),
  35162. right: horizontalToInteger(popper.right)
  35163. };
  35164. }
  35165. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35166. /**
  35167. * @function
  35168. * @memberof Modifiers
  35169. * @argument {Object} data - The data object generated by `update` method
  35170. * @argument {Object} options - Modifiers configuration and options
  35171. * @returns {Object} The data object, properly modified
  35172. */
  35173. function computeStyle(data, options) {
  35174. var x = options.x,
  35175. y = options.y;
  35176. var popper = data.offsets.popper;
  35177. // Remove this legacy support in Popper.js v2
  35178. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35179. return modifier.name === 'applyStyle';
  35180. }).gpuAcceleration;
  35181. if (legacyGpuAccelerationOption !== undefined) {
  35182. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35183. }
  35184. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35185. var offsetParent = getOffsetParent(data.instance.popper);
  35186. var offsetParentRect = getBoundingClientRect(offsetParent);
  35187. // Styles
  35188. var styles = {
  35189. position: popper.position
  35190. };
  35191. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35192. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35193. var sideB = y === 'right' ? 'left' : 'right';
  35194. // if gpuAcceleration is set to `true` and transform is supported,
  35195. // we use `translate3d` to apply the position to the popper we
  35196. // automatically use the supported prefixed version if needed
  35197. var prefixedProperty = getSupportedPropertyName('transform');
  35198. // now, let's make a step back and look at this code closely (wtf?)
  35199. // If the content of the popper grows once it's been positioned, it
  35200. // may happen that the popper gets misplaced because of the new content
  35201. // overflowing its reference element
  35202. // To avoid this problem, we provide two options (x and y), which allow
  35203. // the consumer to define the offset origin.
  35204. // If we position a popper on top of a reference element, we can set
  35205. // `x` to `top` to make the popper grow towards its top instead of
  35206. // its bottom.
  35207. var left = void 0,
  35208. top = void 0;
  35209. if (sideA === 'bottom') {
  35210. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35211. // and not the bottom of the html element
  35212. if (offsetParent.nodeName === 'HTML') {
  35213. top = -offsetParent.clientHeight + offsets.bottom;
  35214. } else {
  35215. top = -offsetParentRect.height + offsets.bottom;
  35216. }
  35217. } else {
  35218. top = offsets.top;
  35219. }
  35220. if (sideB === 'right') {
  35221. if (offsetParent.nodeName === 'HTML') {
  35222. left = -offsetParent.clientWidth + offsets.right;
  35223. } else {
  35224. left = -offsetParentRect.width + offsets.right;
  35225. }
  35226. } else {
  35227. left = offsets.left;
  35228. }
  35229. if (gpuAcceleration && prefixedProperty) {
  35230. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35231. styles[sideA] = 0;
  35232. styles[sideB] = 0;
  35233. styles.willChange = 'transform';
  35234. } else {
  35235. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35236. var invertTop = sideA === 'bottom' ? -1 : 1;
  35237. var invertLeft = sideB === 'right' ? -1 : 1;
  35238. styles[sideA] = top * invertTop;
  35239. styles[sideB] = left * invertLeft;
  35240. styles.willChange = sideA + ', ' + sideB;
  35241. }
  35242. // Attributes
  35243. var attributes = {
  35244. 'x-placement': data.placement
  35245. };
  35246. // Update `data` attributes, styles and arrowStyles
  35247. data.attributes = _extends({}, attributes, data.attributes);
  35248. data.styles = _extends({}, styles, data.styles);
  35249. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35250. return data;
  35251. }
  35252. /**
  35253. * Helper used to know if the given modifier depends from another one.<br />
  35254. * It checks if the needed modifier is listed and enabled.
  35255. * @method
  35256. * @memberof Popper.Utils
  35257. * @param {Array} modifiers - list of modifiers
  35258. * @param {String} requestingName - name of requesting modifier
  35259. * @param {String} requestedName - name of requested modifier
  35260. * @returns {Boolean}
  35261. */
  35262. function isModifierRequired(modifiers, requestingName, requestedName) {
  35263. var requesting = find(modifiers, function (_ref) {
  35264. var name = _ref.name;
  35265. return name === requestingName;
  35266. });
  35267. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35268. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35269. });
  35270. if (!isRequired) {
  35271. var _requesting = '`' + requestingName + '`';
  35272. var requested = '`' + requestedName + '`';
  35273. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35274. }
  35275. return isRequired;
  35276. }
  35277. /**
  35278. * @function
  35279. * @memberof Modifiers
  35280. * @argument {Object} data - The data object generated by update method
  35281. * @argument {Object} options - Modifiers configuration and options
  35282. * @returns {Object} The data object, properly modified
  35283. */
  35284. function arrow(data, options) {
  35285. var _data$offsets$arrow;
  35286. // arrow depends on keepTogether in order to work
  35287. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35288. return data;
  35289. }
  35290. var arrowElement = options.element;
  35291. // if arrowElement is a string, suppose it's a CSS selector
  35292. if (typeof arrowElement === 'string') {
  35293. arrowElement = data.instance.popper.querySelector(arrowElement);
  35294. // if arrowElement is not found, don't run the modifier
  35295. if (!arrowElement) {
  35296. return data;
  35297. }
  35298. } else {
  35299. // if the arrowElement isn't a query selector we must check that the
  35300. // provided DOM node is child of its popper node
  35301. if (!data.instance.popper.contains(arrowElement)) {
  35302. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35303. return data;
  35304. }
  35305. }
  35306. var placement = data.placement.split('-')[0];
  35307. var _data$offsets = data.offsets,
  35308. popper = _data$offsets.popper,
  35309. reference = _data$offsets.reference;
  35310. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35311. var len = isVertical ? 'height' : 'width';
  35312. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35313. var side = sideCapitalized.toLowerCase();
  35314. var altSide = isVertical ? 'left' : 'top';
  35315. var opSide = isVertical ? 'bottom' : 'right';
  35316. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35317. //
  35318. // extends keepTogether behavior making sure the popper and its
  35319. // reference have enough pixels in conjunction
  35320. //
  35321. // top/left side
  35322. if (reference[opSide] - arrowElementSize < popper[side]) {
  35323. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35324. }
  35325. // bottom/right side
  35326. if (reference[side] + arrowElementSize > popper[opSide]) {
  35327. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35328. }
  35329. data.offsets.popper = getClientRect(data.offsets.popper);
  35330. // compute center of the popper
  35331. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35332. // Compute the sideValue using the updated popper offsets
  35333. // take popper margin in account because we don't have this info available
  35334. var css = getStyleComputedProperty(data.instance.popper);
  35335. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35336. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35337. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35338. // prevent arrowElement from being placed not contiguously to its popper
  35339. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35340. data.arrowElement = arrowElement;
  35341. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35342. return data;
  35343. }
  35344. /**
  35345. * Get the opposite placement variation of the given one
  35346. * @method
  35347. * @memberof Popper.Utils
  35348. * @argument {String} placement variation
  35349. * @returns {String} flipped placement variation
  35350. */
  35351. function getOppositeVariation(variation) {
  35352. if (variation === 'end') {
  35353. return 'start';
  35354. } else if (variation === 'start') {
  35355. return 'end';
  35356. }
  35357. return variation;
  35358. }
  35359. /**
  35360. * List of accepted placements to use as values of the `placement` option.<br />
  35361. * Valid placements are:
  35362. * - `auto`
  35363. * - `top`
  35364. * - `right`
  35365. * - `bottom`
  35366. * - `left`
  35367. *
  35368. * Each placement can have a variation from this list:
  35369. * - `-start`
  35370. * - `-end`
  35371. *
  35372. * Variations are interpreted easily if you think of them as the left to right
  35373. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35374. * is right.<br />
  35375. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35376. *
  35377. * Some valid examples are:
  35378. * - `top-end` (on top of reference, right aligned)
  35379. * - `right-start` (on right of reference, top aligned)
  35380. * - `bottom` (on bottom, centered)
  35381. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35382. *
  35383. * @static
  35384. * @type {Array}
  35385. * @enum {String}
  35386. * @readonly
  35387. * @method placements
  35388. * @memberof Popper
  35389. */
  35390. 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'];
  35391. // Get rid of `auto` `auto-start` and `auto-end`
  35392. var validPlacements = placements.slice(3);
  35393. /**
  35394. * Given an initial placement, returns all the subsequent placements
  35395. * clockwise (or counter-clockwise).
  35396. *
  35397. * @method
  35398. * @memberof Popper.Utils
  35399. * @argument {String} placement - A valid placement (it accepts variations)
  35400. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35401. * @returns {Array} placements including their variations
  35402. */
  35403. function clockwise(placement) {
  35404. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35405. var index = validPlacements.indexOf(placement);
  35406. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35407. return counter ? arr.reverse() : arr;
  35408. }
  35409. var BEHAVIORS = {
  35410. FLIP: 'flip',
  35411. CLOCKWISE: 'clockwise',
  35412. COUNTERCLOCKWISE: 'counterclockwise'
  35413. };
  35414. /**
  35415. * @function
  35416. * @memberof Modifiers
  35417. * @argument {Object} data - The data object generated by update method
  35418. * @argument {Object} options - Modifiers configuration and options
  35419. * @returns {Object} The data object, properly modified
  35420. */
  35421. function flip(data, options) {
  35422. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35423. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35424. return data;
  35425. }
  35426. if (data.flipped && data.placement === data.originalPlacement) {
  35427. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35428. return data;
  35429. }
  35430. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35431. var placement = data.placement.split('-')[0];
  35432. var placementOpposite = getOppositePlacement(placement);
  35433. var variation = data.placement.split('-')[1] || '';
  35434. var flipOrder = [];
  35435. switch (options.behavior) {
  35436. case BEHAVIORS.FLIP:
  35437. flipOrder = [placement, placementOpposite];
  35438. break;
  35439. case BEHAVIORS.CLOCKWISE:
  35440. flipOrder = clockwise(placement);
  35441. break;
  35442. case BEHAVIORS.COUNTERCLOCKWISE:
  35443. flipOrder = clockwise(placement, true);
  35444. break;
  35445. default:
  35446. flipOrder = options.behavior;
  35447. }
  35448. flipOrder.forEach(function (step, index) {
  35449. if (placement !== step || flipOrder.length === index + 1) {
  35450. return data;
  35451. }
  35452. placement = data.placement.split('-')[0];
  35453. placementOpposite = getOppositePlacement(placement);
  35454. var popperOffsets = data.offsets.popper;
  35455. var refOffsets = data.offsets.reference;
  35456. // using floor because the reference offsets may contain decimals we are not going to consider here
  35457. var floor = Math.floor;
  35458. 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);
  35459. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35460. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35461. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35462. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35463. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35464. // flip the variation if required
  35465. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35466. // flips variation if reference element overflows boundaries
  35467. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35468. // flips variation if popper content overflows boundaries
  35469. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35470. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35471. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35472. // this boolean to detect any flip loop
  35473. data.flipped = true;
  35474. if (overlapsRef || overflowsBoundaries) {
  35475. placement = flipOrder[index + 1];
  35476. }
  35477. if (flippedVariation) {
  35478. variation = getOppositeVariation(variation);
  35479. }
  35480. data.placement = placement + (variation ? '-' + variation : '');
  35481. // this object contains `position`, we want to preserve it along with
  35482. // any additional property we may add in the future
  35483. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35484. data = runModifiers(data.instance.modifiers, data, 'flip');
  35485. }
  35486. });
  35487. return data;
  35488. }
  35489. /**
  35490. * @function
  35491. * @memberof Modifiers
  35492. * @argument {Object} data - The data object generated by update method
  35493. * @argument {Object} options - Modifiers configuration and options
  35494. * @returns {Object} The data object, properly modified
  35495. */
  35496. function keepTogether(data) {
  35497. var _data$offsets = data.offsets,
  35498. popper = _data$offsets.popper,
  35499. reference = _data$offsets.reference;
  35500. var placement = data.placement.split('-')[0];
  35501. var floor = Math.floor;
  35502. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35503. var side = isVertical ? 'right' : 'bottom';
  35504. var opSide = isVertical ? 'left' : 'top';
  35505. var measurement = isVertical ? 'width' : 'height';
  35506. if (popper[side] < floor(reference[opSide])) {
  35507. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35508. }
  35509. if (popper[opSide] > floor(reference[side])) {
  35510. data.offsets.popper[opSide] = floor(reference[side]);
  35511. }
  35512. return data;
  35513. }
  35514. /**
  35515. * Converts a string containing value + unit into a px value number
  35516. * @function
  35517. * @memberof {modifiers~offset}
  35518. * @private
  35519. * @argument {String} str - Value + unit string
  35520. * @argument {String} measurement - `height` or `width`
  35521. * @argument {Object} popperOffsets
  35522. * @argument {Object} referenceOffsets
  35523. * @returns {Number|String}
  35524. * Value in pixels, or original string if no values were extracted
  35525. */
  35526. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35527. // separate value from unit
  35528. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35529. var value = +split[1];
  35530. var unit = split[2];
  35531. // If it's not a number it's an operator, I guess
  35532. if (!value) {
  35533. return str;
  35534. }
  35535. if (unit.indexOf('%') === 0) {
  35536. var element = void 0;
  35537. switch (unit) {
  35538. case '%p':
  35539. element = popperOffsets;
  35540. break;
  35541. case '%':
  35542. case '%r':
  35543. default:
  35544. element = referenceOffsets;
  35545. }
  35546. var rect = getClientRect(element);
  35547. return rect[measurement] / 100 * value;
  35548. } else if (unit === 'vh' || unit === 'vw') {
  35549. // if is a vh or vw, we calculate the size based on the viewport
  35550. var size = void 0;
  35551. if (unit === 'vh') {
  35552. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35553. } else {
  35554. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35555. }
  35556. return size / 100 * value;
  35557. } else {
  35558. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35559. // if is an implicit unit, it's px, and we return just the value
  35560. return value;
  35561. }
  35562. }
  35563. /**
  35564. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35565. * @function
  35566. * @memberof {modifiers~offset}
  35567. * @private
  35568. * @argument {String} offset
  35569. * @argument {Object} popperOffsets
  35570. * @argument {Object} referenceOffsets
  35571. * @argument {String} basePlacement
  35572. * @returns {Array} a two cells array with x and y offsets in numbers
  35573. */
  35574. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35575. var offsets = [0, 0];
  35576. // Use height if placement is left or right and index is 0 otherwise use width
  35577. // in this way the first offset will use an axis and the second one
  35578. // will use the other one
  35579. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35580. // Split the offset string to obtain a list of values and operands
  35581. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35582. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35583. return frag.trim();
  35584. });
  35585. // Detect if the offset string contains a pair of values or a single one
  35586. // they could be separated by comma or space
  35587. var divider = fragments.indexOf(find(fragments, function (frag) {
  35588. return frag.search(/,|\s/) !== -1;
  35589. }));
  35590. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35591. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35592. }
  35593. // If divider is found, we divide the list of values and operands to divide
  35594. // them by ofset X and Y.
  35595. var splitRegex = /\s*,\s*|\s+/;
  35596. 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];
  35597. // Convert the values with units to absolute pixels to allow our computations
  35598. ops = ops.map(function (op, index) {
  35599. // Most of the units rely on the orientation of the popper
  35600. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35601. var mergeWithPrevious = false;
  35602. return op
  35603. // This aggregates any `+` or `-` sign that aren't considered operators
  35604. // e.g.: 10 + +5 => [10, +, +5]
  35605. .reduce(function (a, b) {
  35606. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35607. a[a.length - 1] = b;
  35608. mergeWithPrevious = true;
  35609. return a;
  35610. } else if (mergeWithPrevious) {
  35611. a[a.length - 1] += b;
  35612. mergeWithPrevious = false;
  35613. return a;
  35614. } else {
  35615. return a.concat(b);
  35616. }
  35617. }, [])
  35618. // Here we convert the string values into number values (in px)
  35619. .map(function (str) {
  35620. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35621. });
  35622. });
  35623. // Loop trough the offsets arrays and execute the operations
  35624. ops.forEach(function (op, index) {
  35625. op.forEach(function (frag, index2) {
  35626. if (isNumeric(frag)) {
  35627. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35628. }
  35629. });
  35630. });
  35631. return offsets;
  35632. }
  35633. /**
  35634. * @function
  35635. * @memberof Modifiers
  35636. * @argument {Object} data - The data object generated by update method
  35637. * @argument {Object} options - Modifiers configuration and options
  35638. * @argument {Number|String} options.offset=0
  35639. * The offset value as described in the modifier description
  35640. * @returns {Object} The data object, properly modified
  35641. */
  35642. function offset(data, _ref) {
  35643. var offset = _ref.offset;
  35644. var placement = data.placement,
  35645. _data$offsets = data.offsets,
  35646. popper = _data$offsets.popper,
  35647. reference = _data$offsets.reference;
  35648. var basePlacement = placement.split('-')[0];
  35649. var offsets = void 0;
  35650. if (isNumeric(+offset)) {
  35651. offsets = [+offset, 0];
  35652. } else {
  35653. offsets = parseOffset(offset, popper, reference, basePlacement);
  35654. }
  35655. if (basePlacement === 'left') {
  35656. popper.top += offsets[0];
  35657. popper.left -= offsets[1];
  35658. } else if (basePlacement === 'right') {
  35659. popper.top += offsets[0];
  35660. popper.left += offsets[1];
  35661. } else if (basePlacement === 'top') {
  35662. popper.left += offsets[0];
  35663. popper.top -= offsets[1];
  35664. } else if (basePlacement === 'bottom') {
  35665. popper.left += offsets[0];
  35666. popper.top += offsets[1];
  35667. }
  35668. data.popper = popper;
  35669. return data;
  35670. }
  35671. /**
  35672. * @function
  35673. * @memberof Modifiers
  35674. * @argument {Object} data - The data object generated by `update` method
  35675. * @argument {Object} options - Modifiers configuration and options
  35676. * @returns {Object} The data object, properly modified
  35677. */
  35678. function preventOverflow(data, options) {
  35679. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35680. // If offsetParent is the reference element, we really want to
  35681. // go one step up and use the next offsetParent as reference to
  35682. // avoid to make this modifier completely useless and look like broken
  35683. if (data.instance.reference === boundariesElement) {
  35684. boundariesElement = getOffsetParent(boundariesElement);
  35685. }
  35686. // NOTE: DOM access here
  35687. // resets the popper's position so that the document size can be calculated excluding
  35688. // the size of the popper element itself
  35689. var transformProp = getSupportedPropertyName('transform');
  35690. var popperStyles = data.instance.popper.style; // assignment to help minification
  35691. var top = popperStyles.top,
  35692. left = popperStyles.left,
  35693. transform = popperStyles[transformProp];
  35694. popperStyles.top = '';
  35695. popperStyles.left = '';
  35696. popperStyles[transformProp] = '';
  35697. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35698. // NOTE: DOM access here
  35699. // restores the original style properties after the offsets have been computed
  35700. popperStyles.top = top;
  35701. popperStyles.left = left;
  35702. popperStyles[transformProp] = transform;
  35703. options.boundaries = boundaries;
  35704. var order = options.priority;
  35705. var popper = data.offsets.popper;
  35706. var check = {
  35707. primary: function primary(placement) {
  35708. var value = popper[placement];
  35709. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35710. value = Math.max(popper[placement], boundaries[placement]);
  35711. }
  35712. return defineProperty({}, placement, value);
  35713. },
  35714. secondary: function secondary(placement) {
  35715. var mainSide = placement === 'right' ? 'left' : 'top';
  35716. var value = popper[mainSide];
  35717. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35718. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35719. }
  35720. return defineProperty({}, mainSide, value);
  35721. }
  35722. };
  35723. order.forEach(function (placement) {
  35724. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35725. popper = _extends({}, popper, check[side](placement));
  35726. });
  35727. data.offsets.popper = popper;
  35728. return data;
  35729. }
  35730. /**
  35731. * @function
  35732. * @memberof Modifiers
  35733. * @argument {Object} data - The data object generated by `update` method
  35734. * @argument {Object} options - Modifiers configuration and options
  35735. * @returns {Object} The data object, properly modified
  35736. */
  35737. function shift(data) {
  35738. var placement = data.placement;
  35739. var basePlacement = placement.split('-')[0];
  35740. var shiftvariation = placement.split('-')[1];
  35741. // if shift shiftvariation is specified, run the modifier
  35742. if (shiftvariation) {
  35743. var _data$offsets = data.offsets,
  35744. reference = _data$offsets.reference,
  35745. popper = _data$offsets.popper;
  35746. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  35747. var side = isVertical ? 'left' : 'top';
  35748. var measurement = isVertical ? 'width' : 'height';
  35749. var shiftOffsets = {
  35750. start: defineProperty({}, side, reference[side]),
  35751. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  35752. };
  35753. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  35754. }
  35755. return data;
  35756. }
  35757. /**
  35758. * @function
  35759. * @memberof Modifiers
  35760. * @argument {Object} data - The data object generated by update method
  35761. * @argument {Object} options - Modifiers configuration and options
  35762. * @returns {Object} The data object, properly modified
  35763. */
  35764. function hide(data) {
  35765. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  35766. return data;
  35767. }
  35768. var refRect = data.offsets.reference;
  35769. var bound = find(data.instance.modifiers, function (modifier) {
  35770. return modifier.name === 'preventOverflow';
  35771. }).boundaries;
  35772. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  35773. // Avoid unnecessary DOM access if visibility hasn't changed
  35774. if (data.hide === true) {
  35775. return data;
  35776. }
  35777. data.hide = true;
  35778. data.attributes['x-out-of-boundaries'] = '';
  35779. } else {
  35780. // Avoid unnecessary DOM access if visibility hasn't changed
  35781. if (data.hide === false) {
  35782. return data;
  35783. }
  35784. data.hide = false;
  35785. data.attributes['x-out-of-boundaries'] = false;
  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 inner(data) {
  35797. var placement = data.placement;
  35798. var basePlacement = placement.split('-')[0];
  35799. var _data$offsets = data.offsets,
  35800. popper = _data$offsets.popper,
  35801. reference = _data$offsets.reference;
  35802. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  35803. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  35804. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  35805. data.placement = getOppositePlacement(placement);
  35806. data.offsets.popper = getClientRect(popper);
  35807. return data;
  35808. }
  35809. /**
  35810. * Modifier function, each modifier can have a function of this type assigned
  35811. * to its `fn` property.<br />
  35812. * These functions will be called on each update, this means that you must
  35813. * make sure they are performant enough to avoid performance bottlenecks.
  35814. *
  35815. * @function ModifierFn
  35816. * @argument {dataObject} data - The data object generated by `update` method
  35817. * @argument {Object} options - Modifiers configuration and options
  35818. * @returns {dataObject} The data object, properly modified
  35819. */
  35820. /**
  35821. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  35822. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  35823. * needed by the library.
  35824. *
  35825. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  35826. * All the other properties are configurations that could be tweaked.
  35827. * @namespace modifiers
  35828. */
  35829. var modifiers = {
  35830. /**
  35831. * Modifier used to shift the popper on the start or end of its reference
  35832. * element.<br />
  35833. * It will read the variation of the `placement` property.<br />
  35834. * It can be one either `-end` or `-start`.
  35835. * @memberof modifiers
  35836. * @inner
  35837. */
  35838. shift: {
  35839. /** @prop {number} order=100 - Index used to define the order of execution */
  35840. order: 100,
  35841. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35842. enabled: true,
  35843. /** @prop {ModifierFn} */
  35844. fn: shift
  35845. },
  35846. /**
  35847. * The `offset` modifier can shift your popper on both its axis.
  35848. *
  35849. * It accepts the following units:
  35850. * - `px` or unit-less, interpreted as pixels
  35851. * - `%` or `%r`, percentage relative to the length of the reference element
  35852. * - `%p`, percentage relative to the length of the popper element
  35853. * - `vw`, CSS viewport width unit
  35854. * - `vh`, CSS viewport height unit
  35855. *
  35856. * For length is intended the main axis relative to the placement of the popper.<br />
  35857. * This means that if the placement is `top` or `bottom`, the length will be the
  35858. * `width`. In case of `left` or `right`, it will be the `height`.
  35859. *
  35860. * You can provide a single value (as `Number` or `String`), or a pair of values
  35861. * as `String` divided by a comma or one (or more) white spaces.<br />
  35862. * The latter is a deprecated method because it leads to confusion and will be
  35863. * removed in v2.<br />
  35864. * Additionally, it accepts additions and subtractions between different units.
  35865. * Note that multiplications and divisions aren't supported.
  35866. *
  35867. * Valid examples are:
  35868. * ```
  35869. * 10
  35870. * '10%'
  35871. * '10, 10'
  35872. * '10%, 10'
  35873. * '10 + 10%'
  35874. * '10 - 5vh + 3%'
  35875. * '-10px + 5vh, 5px - 6%'
  35876. * ```
  35877. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  35878. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  35879. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  35880. *
  35881. * @memberof modifiers
  35882. * @inner
  35883. */
  35884. offset: {
  35885. /** @prop {number} order=200 - Index used to define the order of execution */
  35886. order: 200,
  35887. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35888. enabled: true,
  35889. /** @prop {ModifierFn} */
  35890. fn: offset,
  35891. /** @prop {Number|String} offset=0
  35892. * The offset value as described in the modifier description
  35893. */
  35894. offset: 0
  35895. },
  35896. /**
  35897. * Modifier used to prevent the popper from being positioned outside the boundary.
  35898. *
  35899. * A scenario exists where the reference itself is not within the boundaries.<br />
  35900. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  35901. * In this case we need to decide whether the popper should either:
  35902. *
  35903. * - detach from the reference and remain "trapped" in the boundaries, or
  35904. * - if it should ignore the boundary and "escape with its reference"
  35905. *
  35906. * When `escapeWithReference` is set to`true` and reference is completely
  35907. * outside its boundaries, the popper will overflow (or completely leave)
  35908. * the boundaries in order to remain attached to the edge of the reference.
  35909. *
  35910. * @memberof modifiers
  35911. * @inner
  35912. */
  35913. preventOverflow: {
  35914. /** @prop {number} order=300 - Index used to define the order of execution */
  35915. order: 300,
  35916. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35917. enabled: true,
  35918. /** @prop {ModifierFn} */
  35919. fn: preventOverflow,
  35920. /**
  35921. * @prop {Array} [priority=['left','right','top','bottom']]
  35922. * Popper will try to prevent overflow following these priorities by default,
  35923. * then, it could overflow on the left and on top of the `boundariesElement`
  35924. */
  35925. priority: ['left', 'right', 'top', 'bottom'],
  35926. /**
  35927. * @prop {number} padding=5
  35928. * Amount of pixel used to define a minimum distance between the boundaries
  35929. * and the popper. This makes sure the popper always has a little padding
  35930. * between the edges of its container
  35931. */
  35932. padding: 5,
  35933. /**
  35934. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  35935. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  35936. * `viewport` or any DOM element.
  35937. */
  35938. boundariesElement: 'scrollParent'
  35939. },
  35940. /**
  35941. * Modifier used to make sure the reference and its popper stay near each other
  35942. * without leaving any gap between the two. Especially useful when the arrow is
  35943. * enabled and you want to ensure that it points to its reference element.
  35944. * It cares only about the first axis. You can still have poppers with margin
  35945. * between the popper and its reference element.
  35946. * @memberof modifiers
  35947. * @inner
  35948. */
  35949. keepTogether: {
  35950. /** @prop {number} order=400 - Index used to define the order of execution */
  35951. order: 400,
  35952. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35953. enabled: true,
  35954. /** @prop {ModifierFn} */
  35955. fn: keepTogether
  35956. },
  35957. /**
  35958. * This modifier is used to move the `arrowElement` of the popper to make
  35959. * sure it is positioned between the reference element and its popper element.
  35960. * It will read the outer size of the `arrowElement` node to detect how many
  35961. * pixels of conjunction are needed.
  35962. *
  35963. * It has no effect if no `arrowElement` is provided.
  35964. * @memberof modifiers
  35965. * @inner
  35966. */
  35967. arrow: {
  35968. /** @prop {number} order=500 - Index used to define the order of execution */
  35969. order: 500,
  35970. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35971. enabled: true,
  35972. /** @prop {ModifierFn} */
  35973. fn: arrow,
  35974. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  35975. element: '[x-arrow]'
  35976. },
  35977. /**
  35978. * Modifier used to flip the popper's placement when it starts to overlap its
  35979. * reference element.
  35980. *
  35981. * Requires the `preventOverflow` modifier before it in order to work.
  35982. *
  35983. * **NOTE:** this modifier will interrupt the current update cycle and will
  35984. * restart it if it detects the need to flip the placement.
  35985. * @memberof modifiers
  35986. * @inner
  35987. */
  35988. flip: {
  35989. /** @prop {number} order=600 - Index used to define the order of execution */
  35990. order: 600,
  35991. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35992. enabled: true,
  35993. /** @prop {ModifierFn} */
  35994. fn: flip,
  35995. /**
  35996. * @prop {String|Array} behavior='flip'
  35997. * The behavior used to change the popper's placement. It can be one of
  35998. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  35999. * placements (with optional variations)
  36000. */
  36001. behavior: 'flip',
  36002. /**
  36003. * @prop {number} padding=5
  36004. * The popper will flip if it hits the edges of the `boundariesElement`
  36005. */
  36006. padding: 5,
  36007. /**
  36008. * @prop {String|HTMLElement} boundariesElement='viewport'
  36009. * The element which will define the boundaries of the popper position.
  36010. * The popper will never be placed outside of the defined boundaries
  36011. * (except if `keepTogether` is enabled)
  36012. */
  36013. boundariesElement: 'viewport',
  36014. /**
  36015. * @prop {Boolean} flipVariations=false
  36016. * The popper will switch placement variation between `-start` and `-end` when
  36017. * the reference element overlaps its boundaries.
  36018. *
  36019. * The original placement should have a set variation.
  36020. */
  36021. flipVariations: false,
  36022. /**
  36023. * @prop {Boolean} flipVariationsByContent=false
  36024. * The popper will switch placement variation between `-start` and `-end` when
  36025. * the popper element overlaps its reference boundaries.
  36026. *
  36027. * The original placement should have a set variation.
  36028. */
  36029. flipVariationsByContent: false
  36030. },
  36031. /**
  36032. * Modifier used to make the popper flow toward the inner of the reference element.
  36033. * By default, when this modifier is disabled, the popper will be placed outside
  36034. * the reference element.
  36035. * @memberof modifiers
  36036. * @inner
  36037. */
  36038. inner: {
  36039. /** @prop {number} order=700 - Index used to define the order of execution */
  36040. order: 700,
  36041. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36042. enabled: false,
  36043. /** @prop {ModifierFn} */
  36044. fn: inner
  36045. },
  36046. /**
  36047. * Modifier used to hide the popper when its reference element is outside of the
  36048. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36049. * be used to hide with a CSS selector the popper when its reference is
  36050. * out of boundaries.
  36051. *
  36052. * Requires the `preventOverflow` modifier before it in order to work.
  36053. * @memberof modifiers
  36054. * @inner
  36055. */
  36056. hide: {
  36057. /** @prop {number} order=800 - Index used to define the order of execution */
  36058. order: 800,
  36059. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36060. enabled: true,
  36061. /** @prop {ModifierFn} */
  36062. fn: hide
  36063. },
  36064. /**
  36065. * Computes the style that will be applied to the popper element to gets
  36066. * properly positioned.
  36067. *
  36068. * Note that this modifier will not touch the DOM, it just prepares the styles
  36069. * so that `applyStyle` modifier can apply it. This separation is useful
  36070. * in case you need to replace `applyStyle` with a custom implementation.
  36071. *
  36072. * This modifier has `850` as `order` value to maintain backward compatibility
  36073. * with previous versions of Popper.js. Expect the modifiers ordering method
  36074. * to change in future major versions of the library.
  36075. *
  36076. * @memberof modifiers
  36077. * @inner
  36078. */
  36079. computeStyle: {
  36080. /** @prop {number} order=850 - Index used to define the order of execution */
  36081. order: 850,
  36082. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36083. enabled: true,
  36084. /** @prop {ModifierFn} */
  36085. fn: computeStyle,
  36086. /**
  36087. * @prop {Boolean} gpuAcceleration=true
  36088. * If true, it uses the CSS 3D transformation to position the popper.
  36089. * Otherwise, it will use the `top` and `left` properties
  36090. */
  36091. gpuAcceleration: true,
  36092. /**
  36093. * @prop {string} [x='bottom']
  36094. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36095. * Change this if your popper should grow in a direction different from `bottom`
  36096. */
  36097. x: 'bottom',
  36098. /**
  36099. * @prop {string} [x='left']
  36100. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36101. * Change this if your popper should grow in a direction different from `right`
  36102. */
  36103. y: 'right'
  36104. },
  36105. /**
  36106. * Applies the computed styles to the popper element.
  36107. *
  36108. * All the DOM manipulations are limited to this modifier. This is useful in case
  36109. * you want to integrate Popper.js inside a framework or view library and you
  36110. * want to delegate all the DOM manipulations to it.
  36111. *
  36112. * Note that if you disable this modifier, you must make sure the popper element
  36113. * has its position set to `absolute` before Popper.js can do its work!
  36114. *
  36115. * Just disable this modifier and define your own to achieve the desired effect.
  36116. *
  36117. * @memberof modifiers
  36118. * @inner
  36119. */
  36120. applyStyle: {
  36121. /** @prop {number} order=900 - Index used to define the order of execution */
  36122. order: 900,
  36123. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36124. enabled: true,
  36125. /** @prop {ModifierFn} */
  36126. fn: applyStyle,
  36127. /** @prop {Function} */
  36128. onLoad: applyStyleOnLoad,
  36129. /**
  36130. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36131. * @prop {Boolean} gpuAcceleration=true
  36132. * If true, it uses the CSS 3D transformation to position the popper.
  36133. * Otherwise, it will use the `top` and `left` properties
  36134. */
  36135. gpuAcceleration: undefined
  36136. }
  36137. };
  36138. /**
  36139. * The `dataObject` is an object containing all the information used by Popper.js.
  36140. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36141. * @name dataObject
  36142. * @property {Object} data.instance The Popper.js instance
  36143. * @property {String} data.placement Placement applied to popper
  36144. * @property {String} data.originalPlacement Placement originally defined on init
  36145. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36146. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36147. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36148. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36149. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36150. * @property {Object} data.boundaries Offsets of the popper boundaries
  36151. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36152. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36153. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36154. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36155. */
  36156. /**
  36157. * Default options provided to Popper.js constructor.<br />
  36158. * These can be overridden using the `options` argument of Popper.js.<br />
  36159. * To override an option, simply pass an object with the same
  36160. * structure of the `options` object, as the 3rd argument. For example:
  36161. * ```
  36162. * new Popper(ref, pop, {
  36163. * modifiers: {
  36164. * preventOverflow: { enabled: false }
  36165. * }
  36166. * })
  36167. * ```
  36168. * @type {Object}
  36169. * @static
  36170. * @memberof Popper
  36171. */
  36172. var Defaults = {
  36173. /**
  36174. * Popper's placement.
  36175. * @prop {Popper.placements} placement='bottom'
  36176. */
  36177. placement: 'bottom',
  36178. /**
  36179. * Set this to true if you want popper to position it self in 'fixed' mode
  36180. * @prop {Boolean} positionFixed=false
  36181. */
  36182. positionFixed: false,
  36183. /**
  36184. * Whether events (resize, scroll) are initially enabled.
  36185. * @prop {Boolean} eventsEnabled=true
  36186. */
  36187. eventsEnabled: true,
  36188. /**
  36189. * Set to true if you want to automatically remove the popper when
  36190. * you call the `destroy` method.
  36191. * @prop {Boolean} removeOnDestroy=false
  36192. */
  36193. removeOnDestroy: false,
  36194. /**
  36195. * Callback called when the popper is created.<br />
  36196. * By default, it is set to no-op.<br />
  36197. * Access Popper.js instance with `data.instance`.
  36198. * @prop {onCreate}
  36199. */
  36200. onCreate: function onCreate() {},
  36201. /**
  36202. * Callback called when the popper is updated. This callback is not called
  36203. * on the initialization/creation of the popper, but only on subsequent
  36204. * updates.<br />
  36205. * By default, it is set to no-op.<br />
  36206. * Access Popper.js instance with `data.instance`.
  36207. * @prop {onUpdate}
  36208. */
  36209. onUpdate: function onUpdate() {},
  36210. /**
  36211. * List of modifiers used to modify the offsets before they are applied to the popper.
  36212. * They provide most of the functionalities of Popper.js.
  36213. * @prop {modifiers}
  36214. */
  36215. modifiers: modifiers
  36216. };
  36217. /**
  36218. * @callback onCreate
  36219. * @param {dataObject} data
  36220. */
  36221. /**
  36222. * @callback onUpdate
  36223. * @param {dataObject} data
  36224. */
  36225. // Utils
  36226. // Methods
  36227. var Popper = function () {
  36228. /**
  36229. * Creates a new Popper.js instance.
  36230. * @class Popper
  36231. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36232. * @param {Element} popper - The HTML / XML element used as the popper
  36233. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36234. * @return {Object} instance - The generated Popper.js instance
  36235. */
  36236. function Popper(reference, popper) {
  36237. var _this = this;
  36238. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36239. classCallCheck(this, Popper);
  36240. this.scheduleUpdate = function () {
  36241. return requestAnimationFrame(_this.update);
  36242. };
  36243. // make update() debounced, so that it only runs at most once-per-tick
  36244. this.update = debounce(this.update.bind(this));
  36245. // with {} we create a new object with the options inside it
  36246. this.options = _extends({}, Popper.Defaults, options);
  36247. // init state
  36248. this.state = {
  36249. isDestroyed: false,
  36250. isCreated: false,
  36251. scrollParents: []
  36252. };
  36253. // get reference and popper elements (allow jQuery wrappers)
  36254. this.reference = reference && reference.jquery ? reference[0] : reference;
  36255. this.popper = popper && popper.jquery ? popper[0] : popper;
  36256. // Deep merge modifiers options
  36257. this.options.modifiers = {};
  36258. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36259. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36260. });
  36261. // Refactoring modifiers' list (Object => Array)
  36262. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36263. return _extends({
  36264. name: name
  36265. }, _this.options.modifiers[name]);
  36266. })
  36267. // sort the modifiers by order
  36268. .sort(function (a, b) {
  36269. return a.order - b.order;
  36270. });
  36271. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36272. // such code is executed in the same order of its modifier
  36273. // they could add new properties to their options configuration
  36274. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36275. this.modifiers.forEach(function (modifierOptions) {
  36276. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36277. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36278. }
  36279. });
  36280. // fire the first update to position the popper in the right place
  36281. this.update();
  36282. var eventsEnabled = this.options.eventsEnabled;
  36283. if (eventsEnabled) {
  36284. // setup event listeners, they will take care of update the position in specific situations
  36285. this.enableEventListeners();
  36286. }
  36287. this.state.eventsEnabled = eventsEnabled;
  36288. }
  36289. // We can't use class properties because they don't get listed in the
  36290. // class prototype and break stuff like Sinon stubs
  36291. createClass(Popper, [{
  36292. key: 'update',
  36293. value: function update$$1() {
  36294. return update.call(this);
  36295. }
  36296. }, {
  36297. key: 'destroy',
  36298. value: function destroy$$1() {
  36299. return destroy.call(this);
  36300. }
  36301. }, {
  36302. key: 'enableEventListeners',
  36303. value: function enableEventListeners$$1() {
  36304. return enableEventListeners.call(this);
  36305. }
  36306. }, {
  36307. key: 'disableEventListeners',
  36308. value: function disableEventListeners$$1() {
  36309. return disableEventListeners.call(this);
  36310. }
  36311. /**
  36312. * Schedules an update. It will run on the next UI update available.
  36313. * @method scheduleUpdate
  36314. * @memberof Popper
  36315. */
  36316. /**
  36317. * Collection of utilities useful when writing custom modifiers.
  36318. * Starting from version 1.7, this method is available only if you
  36319. * include `popper-utils.js` before `popper.js`.
  36320. *
  36321. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36322. * and will be removed in v2! Use the PopperUtils module directly instead.
  36323. * Due to the high instability of the methods contained in Utils, we can't
  36324. * guarantee them to follow semver. Use them at your own risk!
  36325. * @static
  36326. * @private
  36327. * @type {Object}
  36328. * @deprecated since version 1.8
  36329. * @member Utils
  36330. * @memberof Popper
  36331. */
  36332. }]);
  36333. return Popper;
  36334. }();
  36335. /**
  36336. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36337. * and lets you use it as replacement of a real DOM node.<br />
  36338. * You can use this method to position a popper relatively to a set of coordinates
  36339. * in case you don't have a DOM node to use as reference.
  36340. *
  36341. * ```
  36342. * new Popper(referenceObject, popperNode);
  36343. * ```
  36344. *
  36345. * NB: This feature isn't supported in Internet Explorer 10.
  36346. * @name referenceObject
  36347. * @property {Function} data.getBoundingClientRect
  36348. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36349. * @property {number} data.clientWidth
  36350. * An ES6 getter that will return the width of the virtual reference element.
  36351. * @property {number} data.clientHeight
  36352. * An ES6 getter that will return the height of the virtual reference element.
  36353. */
  36354. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36355. Popper.placements = placements;
  36356. Popper.Defaults = Defaults;
  36357. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36358. //# sourceMappingURL=popper.js.map
  36359. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36360. /***/ }),
  36361. /***/ "./node_modules/process/browser.js":
  36362. /*!*****************************************!*\
  36363. !*** ./node_modules/process/browser.js ***!
  36364. \*****************************************/
  36365. /*! no static exports found */
  36366. /***/ (function(module, exports) {
  36367. // shim for using process in browser
  36368. var process = module.exports = {};
  36369. // cached from whatever global is present so that test runners that stub it
  36370. // don't break things. But we need to wrap it in a try catch in case it is
  36371. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36372. // function because try/catches deoptimize in certain engines.
  36373. var cachedSetTimeout;
  36374. var cachedClearTimeout;
  36375. function defaultSetTimout() {
  36376. throw new Error('setTimeout has not been defined');
  36377. }
  36378. function defaultClearTimeout () {
  36379. throw new Error('clearTimeout has not been defined');
  36380. }
  36381. (function () {
  36382. try {
  36383. if (typeof setTimeout === 'function') {
  36384. cachedSetTimeout = setTimeout;
  36385. } else {
  36386. cachedSetTimeout = defaultSetTimout;
  36387. }
  36388. } catch (e) {
  36389. cachedSetTimeout = defaultSetTimout;
  36390. }
  36391. try {
  36392. if (typeof clearTimeout === 'function') {
  36393. cachedClearTimeout = clearTimeout;
  36394. } else {
  36395. cachedClearTimeout = defaultClearTimeout;
  36396. }
  36397. } catch (e) {
  36398. cachedClearTimeout = defaultClearTimeout;
  36399. }
  36400. } ())
  36401. function runTimeout(fun) {
  36402. if (cachedSetTimeout === setTimeout) {
  36403. //normal enviroments in sane situations
  36404. return setTimeout(fun, 0);
  36405. }
  36406. // if setTimeout wasn't available but was latter defined
  36407. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36408. cachedSetTimeout = setTimeout;
  36409. return setTimeout(fun, 0);
  36410. }
  36411. try {
  36412. // when when somebody has screwed with setTimeout but no I.E. maddness
  36413. return cachedSetTimeout(fun, 0);
  36414. } catch(e){
  36415. try {
  36416. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36417. return cachedSetTimeout.call(null, fun, 0);
  36418. } catch(e){
  36419. // 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
  36420. return cachedSetTimeout.call(this, fun, 0);
  36421. }
  36422. }
  36423. }
  36424. function runClearTimeout(marker) {
  36425. if (cachedClearTimeout === clearTimeout) {
  36426. //normal enviroments in sane situations
  36427. return clearTimeout(marker);
  36428. }
  36429. // if clearTimeout wasn't available but was latter defined
  36430. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36431. cachedClearTimeout = clearTimeout;
  36432. return clearTimeout(marker);
  36433. }
  36434. try {
  36435. // when when somebody has screwed with setTimeout but no I.E. maddness
  36436. return cachedClearTimeout(marker);
  36437. } catch (e){
  36438. try {
  36439. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36440. return cachedClearTimeout.call(null, marker);
  36441. } catch (e){
  36442. // 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.
  36443. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36444. return cachedClearTimeout.call(this, marker);
  36445. }
  36446. }
  36447. }
  36448. var queue = [];
  36449. var draining = false;
  36450. var currentQueue;
  36451. var queueIndex = -1;
  36452. function cleanUpNextTick() {
  36453. if (!draining || !currentQueue) {
  36454. return;
  36455. }
  36456. draining = false;
  36457. if (currentQueue.length) {
  36458. queue = currentQueue.concat(queue);
  36459. } else {
  36460. queueIndex = -1;
  36461. }
  36462. if (queue.length) {
  36463. drainQueue();
  36464. }
  36465. }
  36466. function drainQueue() {
  36467. if (draining) {
  36468. return;
  36469. }
  36470. var timeout = runTimeout(cleanUpNextTick);
  36471. draining = true;
  36472. var len = queue.length;
  36473. while(len) {
  36474. currentQueue = queue;
  36475. queue = [];
  36476. while (++queueIndex < len) {
  36477. if (currentQueue) {
  36478. currentQueue[queueIndex].run();
  36479. }
  36480. }
  36481. queueIndex = -1;
  36482. len = queue.length;
  36483. }
  36484. currentQueue = null;
  36485. draining = false;
  36486. runClearTimeout(timeout);
  36487. }
  36488. process.nextTick = function (fun) {
  36489. var args = new Array(arguments.length - 1);
  36490. if (arguments.length > 1) {
  36491. for (var i = 1; i < arguments.length; i++) {
  36492. args[i - 1] = arguments[i];
  36493. }
  36494. }
  36495. queue.push(new Item(fun, args));
  36496. if (queue.length === 1 && !draining) {
  36497. runTimeout(drainQueue);
  36498. }
  36499. };
  36500. // v8 likes predictible objects
  36501. function Item(fun, array) {
  36502. this.fun = fun;
  36503. this.array = array;
  36504. }
  36505. Item.prototype.run = function () {
  36506. this.fun.apply(null, this.array);
  36507. };
  36508. process.title = 'browser';
  36509. process.browser = true;
  36510. process.env = {};
  36511. process.argv = [];
  36512. process.version = ''; // empty string to avoid regexp issues
  36513. process.versions = {};
  36514. function noop() {}
  36515. process.on = noop;
  36516. process.addListener = noop;
  36517. process.once = noop;
  36518. process.off = noop;
  36519. process.removeListener = noop;
  36520. process.removeAllListeners = noop;
  36521. process.emit = noop;
  36522. process.prependListener = noop;
  36523. process.prependOnceListener = noop;
  36524. process.listeners = function (name) { return [] }
  36525. process.binding = function (name) {
  36526. throw new Error('process.binding is not supported');
  36527. };
  36528. process.cwd = function () { return '/' };
  36529. process.chdir = function (dir) {
  36530. throw new Error('process.chdir is not supported');
  36531. };
  36532. process.umask = function() { return 0; };
  36533. /***/ }),
  36534. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36535. /*!***************************************************!*\
  36536. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36537. \***************************************************/
  36538. /*! no static exports found */
  36539. /***/ (function(module, exports, __webpack_require__) {
  36540. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36541. * Pusher JavaScript Library v5.0.3
  36542. * https://pusher.com/
  36543. *
  36544. * Copyright 2017, Pusher
  36545. * Released under the MIT licence.
  36546. */
  36547. (function webpackUniversalModuleDefinition(root, factory) {
  36548. if(true)
  36549. module.exports = factory();
  36550. else {}
  36551. })(window, function() {
  36552. return /******/ (function(modules) { // webpackBootstrap
  36553. /******/ // The module cache
  36554. /******/ var installedModules = {};
  36555. /******/
  36556. /******/ // The require function
  36557. /******/ function __webpack_require__(moduleId) {
  36558. /******/
  36559. /******/ // Check if module is in cache
  36560. /******/ if(installedModules[moduleId]) {
  36561. /******/ return installedModules[moduleId].exports;
  36562. /******/ }
  36563. /******/ // Create a new module (and put it into the cache)
  36564. /******/ var module = installedModules[moduleId] = {
  36565. /******/ i: moduleId,
  36566. /******/ l: false,
  36567. /******/ exports: {}
  36568. /******/ };
  36569. /******/
  36570. /******/ // Execute the module function
  36571. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36572. /******/
  36573. /******/ // Flag the module as loaded
  36574. /******/ module.l = true;
  36575. /******/
  36576. /******/ // Return the exports of the module
  36577. /******/ return module.exports;
  36578. /******/ }
  36579. /******/
  36580. /******/
  36581. /******/ // expose the modules object (__webpack_modules__)
  36582. /******/ __webpack_require__.m = modules;
  36583. /******/
  36584. /******/ // expose the module cache
  36585. /******/ __webpack_require__.c = installedModules;
  36586. /******/
  36587. /******/ // define getter function for harmony exports
  36588. /******/ __webpack_require__.d = function(exports, name, getter) {
  36589. /******/ if(!__webpack_require__.o(exports, name)) {
  36590. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36591. /******/ }
  36592. /******/ };
  36593. /******/
  36594. /******/ // define __esModule on exports
  36595. /******/ __webpack_require__.r = function(exports) {
  36596. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36597. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36598. /******/ }
  36599. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36600. /******/ };
  36601. /******/
  36602. /******/ // create a fake namespace object
  36603. /******/ // mode & 1: value is a module id, require it
  36604. /******/ // mode & 2: merge all properties of value into the ns
  36605. /******/ // mode & 4: return value when already ns object
  36606. /******/ // mode & 8|1: behave like require
  36607. /******/ __webpack_require__.t = function(value, mode) {
  36608. /******/ if(mode & 1) value = __webpack_require__(value);
  36609. /******/ if(mode & 8) return value;
  36610. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36611. /******/ var ns = Object.create(null);
  36612. /******/ __webpack_require__.r(ns);
  36613. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36614. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36615. /******/ return ns;
  36616. /******/ };
  36617. /******/
  36618. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36619. /******/ __webpack_require__.n = function(module) {
  36620. /******/ var getter = module && module.__esModule ?
  36621. /******/ function getDefault() { return module['default']; } :
  36622. /******/ function getModuleExports() { return module; };
  36623. /******/ __webpack_require__.d(getter, 'a', getter);
  36624. /******/ return getter;
  36625. /******/ };
  36626. /******/
  36627. /******/ // Object.prototype.hasOwnProperty.call
  36628. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36629. /******/
  36630. /******/ // __webpack_public_path__
  36631. /******/ __webpack_require__.p = "";
  36632. /******/
  36633. /******/
  36634. /******/ // Load entry module and return exports
  36635. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36636. /******/ })
  36637. /************************************************************************/
  36638. /******/ ([
  36639. /* 0 */
  36640. /***/ (function(module, exports, __webpack_require__) {
  36641. (function(nacl) {
  36642. 'use strict';
  36643. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36644. // Public domain.
  36645. //
  36646. // Implementation derived from TweetNaCl version 20140427.
  36647. // See for details: http://tweetnacl.cr.yp.to/
  36648. var gf = function(init) {
  36649. var i, r = new Float64Array(16);
  36650. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36651. return r;
  36652. };
  36653. // Pluggable, initialized in high-level API below.
  36654. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36655. var _0 = new Uint8Array(16);
  36656. var _9 = new Uint8Array(32); _9[0] = 9;
  36657. var gf0 = gf(),
  36658. gf1 = gf([1]),
  36659. _121665 = gf([0xdb41, 1]),
  36660. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36661. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36662. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36663. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36664. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36665. function ts64(x, i, h, l) {
  36666. x[i] = (h >> 24) & 0xff;
  36667. x[i+1] = (h >> 16) & 0xff;
  36668. x[i+2] = (h >> 8) & 0xff;
  36669. x[i+3] = h & 0xff;
  36670. x[i+4] = (l >> 24) & 0xff;
  36671. x[i+5] = (l >> 16) & 0xff;
  36672. x[i+6] = (l >> 8) & 0xff;
  36673. x[i+7] = l & 0xff;
  36674. }
  36675. function vn(x, xi, y, yi, n) {
  36676. var i,d = 0;
  36677. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36678. return (1 & ((d - 1) >>> 8)) - 1;
  36679. }
  36680. function crypto_verify_16(x, xi, y, yi) {
  36681. return vn(x,xi,y,yi,16);
  36682. }
  36683. function crypto_verify_32(x, xi, y, yi) {
  36684. return vn(x,xi,y,yi,32);
  36685. }
  36686. function core_salsa20(o, p, k, c) {
  36687. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36688. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36689. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36690. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36691. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36692. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36693. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36694. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36695. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36696. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36697. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36698. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36699. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36700. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36701. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36702. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36703. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36704. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36705. x15 = j15, u;
  36706. for (var i = 0; i < 20; i += 2) {
  36707. u = x0 + x12 | 0;
  36708. x4 ^= u<<7 | u>>>(32-7);
  36709. u = x4 + x0 | 0;
  36710. x8 ^= u<<9 | u>>>(32-9);
  36711. u = x8 + x4 | 0;
  36712. x12 ^= u<<13 | u>>>(32-13);
  36713. u = x12 + x8 | 0;
  36714. x0 ^= u<<18 | u>>>(32-18);
  36715. u = x5 + x1 | 0;
  36716. x9 ^= u<<7 | u>>>(32-7);
  36717. u = x9 + x5 | 0;
  36718. x13 ^= u<<9 | u>>>(32-9);
  36719. u = x13 + x9 | 0;
  36720. x1 ^= u<<13 | u>>>(32-13);
  36721. u = x1 + x13 | 0;
  36722. x5 ^= u<<18 | u>>>(32-18);
  36723. u = x10 + x6 | 0;
  36724. x14 ^= u<<7 | u>>>(32-7);
  36725. u = x14 + x10 | 0;
  36726. x2 ^= u<<9 | u>>>(32-9);
  36727. u = x2 + x14 | 0;
  36728. x6 ^= u<<13 | u>>>(32-13);
  36729. u = x6 + x2 | 0;
  36730. x10 ^= u<<18 | u>>>(32-18);
  36731. u = x15 + x11 | 0;
  36732. x3 ^= u<<7 | u>>>(32-7);
  36733. u = x3 + x15 | 0;
  36734. x7 ^= u<<9 | u>>>(32-9);
  36735. u = x7 + x3 | 0;
  36736. x11 ^= u<<13 | u>>>(32-13);
  36737. u = x11 + x7 | 0;
  36738. x15 ^= u<<18 | u>>>(32-18);
  36739. u = x0 + x3 | 0;
  36740. x1 ^= u<<7 | u>>>(32-7);
  36741. u = x1 + x0 | 0;
  36742. x2 ^= u<<9 | u>>>(32-9);
  36743. u = x2 + x1 | 0;
  36744. x3 ^= u<<13 | u>>>(32-13);
  36745. u = x3 + x2 | 0;
  36746. x0 ^= u<<18 | u>>>(32-18);
  36747. u = x5 + x4 | 0;
  36748. x6 ^= u<<7 | u>>>(32-7);
  36749. u = x6 + x5 | 0;
  36750. x7 ^= u<<9 | u>>>(32-9);
  36751. u = x7 + x6 | 0;
  36752. x4 ^= u<<13 | u>>>(32-13);
  36753. u = x4 + x7 | 0;
  36754. x5 ^= u<<18 | u>>>(32-18);
  36755. u = x10 + x9 | 0;
  36756. x11 ^= u<<7 | u>>>(32-7);
  36757. u = x11 + x10 | 0;
  36758. x8 ^= u<<9 | u>>>(32-9);
  36759. u = x8 + x11 | 0;
  36760. x9 ^= u<<13 | u>>>(32-13);
  36761. u = x9 + x8 | 0;
  36762. x10 ^= u<<18 | u>>>(32-18);
  36763. u = x15 + x14 | 0;
  36764. x12 ^= u<<7 | u>>>(32-7);
  36765. u = x12 + x15 | 0;
  36766. x13 ^= u<<9 | u>>>(32-9);
  36767. u = x13 + x12 | 0;
  36768. x14 ^= u<<13 | u>>>(32-13);
  36769. u = x14 + x13 | 0;
  36770. x15 ^= u<<18 | u>>>(32-18);
  36771. }
  36772. x0 = x0 + j0 | 0;
  36773. x1 = x1 + j1 | 0;
  36774. x2 = x2 + j2 | 0;
  36775. x3 = x3 + j3 | 0;
  36776. x4 = x4 + j4 | 0;
  36777. x5 = x5 + j5 | 0;
  36778. x6 = x6 + j6 | 0;
  36779. x7 = x7 + j7 | 0;
  36780. x8 = x8 + j8 | 0;
  36781. x9 = x9 + j9 | 0;
  36782. x10 = x10 + j10 | 0;
  36783. x11 = x11 + j11 | 0;
  36784. x12 = x12 + j12 | 0;
  36785. x13 = x13 + j13 | 0;
  36786. x14 = x14 + j14 | 0;
  36787. x15 = x15 + j15 | 0;
  36788. o[ 0] = x0 >>> 0 & 0xff;
  36789. o[ 1] = x0 >>> 8 & 0xff;
  36790. o[ 2] = x0 >>> 16 & 0xff;
  36791. o[ 3] = x0 >>> 24 & 0xff;
  36792. o[ 4] = x1 >>> 0 & 0xff;
  36793. o[ 5] = x1 >>> 8 & 0xff;
  36794. o[ 6] = x1 >>> 16 & 0xff;
  36795. o[ 7] = x1 >>> 24 & 0xff;
  36796. o[ 8] = x2 >>> 0 & 0xff;
  36797. o[ 9] = x2 >>> 8 & 0xff;
  36798. o[10] = x2 >>> 16 & 0xff;
  36799. o[11] = x2 >>> 24 & 0xff;
  36800. o[12] = x3 >>> 0 & 0xff;
  36801. o[13] = x3 >>> 8 & 0xff;
  36802. o[14] = x3 >>> 16 & 0xff;
  36803. o[15] = x3 >>> 24 & 0xff;
  36804. o[16] = x4 >>> 0 & 0xff;
  36805. o[17] = x4 >>> 8 & 0xff;
  36806. o[18] = x4 >>> 16 & 0xff;
  36807. o[19] = x4 >>> 24 & 0xff;
  36808. o[20] = x5 >>> 0 & 0xff;
  36809. o[21] = x5 >>> 8 & 0xff;
  36810. o[22] = x5 >>> 16 & 0xff;
  36811. o[23] = x5 >>> 24 & 0xff;
  36812. o[24] = x6 >>> 0 & 0xff;
  36813. o[25] = x6 >>> 8 & 0xff;
  36814. o[26] = x6 >>> 16 & 0xff;
  36815. o[27] = x6 >>> 24 & 0xff;
  36816. o[28] = x7 >>> 0 & 0xff;
  36817. o[29] = x7 >>> 8 & 0xff;
  36818. o[30] = x7 >>> 16 & 0xff;
  36819. o[31] = x7 >>> 24 & 0xff;
  36820. o[32] = x8 >>> 0 & 0xff;
  36821. o[33] = x8 >>> 8 & 0xff;
  36822. o[34] = x8 >>> 16 & 0xff;
  36823. o[35] = x8 >>> 24 & 0xff;
  36824. o[36] = x9 >>> 0 & 0xff;
  36825. o[37] = x9 >>> 8 & 0xff;
  36826. o[38] = x9 >>> 16 & 0xff;
  36827. o[39] = x9 >>> 24 & 0xff;
  36828. o[40] = x10 >>> 0 & 0xff;
  36829. o[41] = x10 >>> 8 & 0xff;
  36830. o[42] = x10 >>> 16 & 0xff;
  36831. o[43] = x10 >>> 24 & 0xff;
  36832. o[44] = x11 >>> 0 & 0xff;
  36833. o[45] = x11 >>> 8 & 0xff;
  36834. o[46] = x11 >>> 16 & 0xff;
  36835. o[47] = x11 >>> 24 & 0xff;
  36836. o[48] = x12 >>> 0 & 0xff;
  36837. o[49] = x12 >>> 8 & 0xff;
  36838. o[50] = x12 >>> 16 & 0xff;
  36839. o[51] = x12 >>> 24 & 0xff;
  36840. o[52] = x13 >>> 0 & 0xff;
  36841. o[53] = x13 >>> 8 & 0xff;
  36842. o[54] = x13 >>> 16 & 0xff;
  36843. o[55] = x13 >>> 24 & 0xff;
  36844. o[56] = x14 >>> 0 & 0xff;
  36845. o[57] = x14 >>> 8 & 0xff;
  36846. o[58] = x14 >>> 16 & 0xff;
  36847. o[59] = x14 >>> 24 & 0xff;
  36848. o[60] = x15 >>> 0 & 0xff;
  36849. o[61] = x15 >>> 8 & 0xff;
  36850. o[62] = x15 >>> 16 & 0xff;
  36851. o[63] = x15 >>> 24 & 0xff;
  36852. }
  36853. function core_hsalsa20(o,p,k,c) {
  36854. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36855. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36856. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36857. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36858. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36859. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36860. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36861. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36862. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36863. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36864. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36865. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36866. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36867. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36868. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36869. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36870. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36871. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36872. x15 = j15, u;
  36873. for (var i = 0; i < 20; i += 2) {
  36874. u = x0 + x12 | 0;
  36875. x4 ^= u<<7 | u>>>(32-7);
  36876. u = x4 + x0 | 0;
  36877. x8 ^= u<<9 | u>>>(32-9);
  36878. u = x8 + x4 | 0;
  36879. x12 ^= u<<13 | u>>>(32-13);
  36880. u = x12 + x8 | 0;
  36881. x0 ^= u<<18 | u>>>(32-18);
  36882. u = x5 + x1 | 0;
  36883. x9 ^= u<<7 | u>>>(32-7);
  36884. u = x9 + x5 | 0;
  36885. x13 ^= u<<9 | u>>>(32-9);
  36886. u = x13 + x9 | 0;
  36887. x1 ^= u<<13 | u>>>(32-13);
  36888. u = x1 + x13 | 0;
  36889. x5 ^= u<<18 | u>>>(32-18);
  36890. u = x10 + x6 | 0;
  36891. x14 ^= u<<7 | u>>>(32-7);
  36892. u = x14 + x10 | 0;
  36893. x2 ^= u<<9 | u>>>(32-9);
  36894. u = x2 + x14 | 0;
  36895. x6 ^= u<<13 | u>>>(32-13);
  36896. u = x6 + x2 | 0;
  36897. x10 ^= u<<18 | u>>>(32-18);
  36898. u = x15 + x11 | 0;
  36899. x3 ^= u<<7 | u>>>(32-7);
  36900. u = x3 + x15 | 0;
  36901. x7 ^= u<<9 | u>>>(32-9);
  36902. u = x7 + x3 | 0;
  36903. x11 ^= u<<13 | u>>>(32-13);
  36904. u = x11 + x7 | 0;
  36905. x15 ^= u<<18 | u>>>(32-18);
  36906. u = x0 + x3 | 0;
  36907. x1 ^= u<<7 | u>>>(32-7);
  36908. u = x1 + x0 | 0;
  36909. x2 ^= u<<9 | u>>>(32-9);
  36910. u = x2 + x1 | 0;
  36911. x3 ^= u<<13 | u>>>(32-13);
  36912. u = x3 + x2 | 0;
  36913. x0 ^= u<<18 | u>>>(32-18);
  36914. u = x5 + x4 | 0;
  36915. x6 ^= u<<7 | u>>>(32-7);
  36916. u = x6 + x5 | 0;
  36917. x7 ^= u<<9 | u>>>(32-9);
  36918. u = x7 + x6 | 0;
  36919. x4 ^= u<<13 | u>>>(32-13);
  36920. u = x4 + x7 | 0;
  36921. x5 ^= u<<18 | u>>>(32-18);
  36922. u = x10 + x9 | 0;
  36923. x11 ^= u<<7 | u>>>(32-7);
  36924. u = x11 + x10 | 0;
  36925. x8 ^= u<<9 | u>>>(32-9);
  36926. u = x8 + x11 | 0;
  36927. x9 ^= u<<13 | u>>>(32-13);
  36928. u = x9 + x8 | 0;
  36929. x10 ^= u<<18 | u>>>(32-18);
  36930. u = x15 + x14 | 0;
  36931. x12 ^= u<<7 | u>>>(32-7);
  36932. u = x12 + x15 | 0;
  36933. x13 ^= u<<9 | u>>>(32-9);
  36934. u = x13 + x12 | 0;
  36935. x14 ^= u<<13 | u>>>(32-13);
  36936. u = x14 + x13 | 0;
  36937. x15 ^= u<<18 | u>>>(32-18);
  36938. }
  36939. o[ 0] = x0 >>> 0 & 0xff;
  36940. o[ 1] = x0 >>> 8 & 0xff;
  36941. o[ 2] = x0 >>> 16 & 0xff;
  36942. o[ 3] = x0 >>> 24 & 0xff;
  36943. o[ 4] = x5 >>> 0 & 0xff;
  36944. o[ 5] = x5 >>> 8 & 0xff;
  36945. o[ 6] = x5 >>> 16 & 0xff;
  36946. o[ 7] = x5 >>> 24 & 0xff;
  36947. o[ 8] = x10 >>> 0 & 0xff;
  36948. o[ 9] = x10 >>> 8 & 0xff;
  36949. o[10] = x10 >>> 16 & 0xff;
  36950. o[11] = x10 >>> 24 & 0xff;
  36951. o[12] = x15 >>> 0 & 0xff;
  36952. o[13] = x15 >>> 8 & 0xff;
  36953. o[14] = x15 >>> 16 & 0xff;
  36954. o[15] = x15 >>> 24 & 0xff;
  36955. o[16] = x6 >>> 0 & 0xff;
  36956. o[17] = x6 >>> 8 & 0xff;
  36957. o[18] = x6 >>> 16 & 0xff;
  36958. o[19] = x6 >>> 24 & 0xff;
  36959. o[20] = x7 >>> 0 & 0xff;
  36960. o[21] = x7 >>> 8 & 0xff;
  36961. o[22] = x7 >>> 16 & 0xff;
  36962. o[23] = x7 >>> 24 & 0xff;
  36963. o[24] = x8 >>> 0 & 0xff;
  36964. o[25] = x8 >>> 8 & 0xff;
  36965. o[26] = x8 >>> 16 & 0xff;
  36966. o[27] = x8 >>> 24 & 0xff;
  36967. o[28] = x9 >>> 0 & 0xff;
  36968. o[29] = x9 >>> 8 & 0xff;
  36969. o[30] = x9 >>> 16 & 0xff;
  36970. o[31] = x9 >>> 24 & 0xff;
  36971. }
  36972. function crypto_core_salsa20(out,inp,k,c) {
  36973. core_salsa20(out,inp,k,c);
  36974. }
  36975. function crypto_core_hsalsa20(out,inp,k,c) {
  36976. core_hsalsa20(out,inp,k,c);
  36977. }
  36978. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  36979. // "expand 32-byte k"
  36980. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  36981. var z = new Uint8Array(16), x = new Uint8Array(64);
  36982. var u, i;
  36983. for (i = 0; i < 16; i++) z[i] = 0;
  36984. for (i = 0; i < 8; i++) z[i] = n[i];
  36985. while (b >= 64) {
  36986. crypto_core_salsa20(x,z,k,sigma);
  36987. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36988. u = 1;
  36989. for (i = 8; i < 16; i++) {
  36990. u = u + (z[i] & 0xff) | 0;
  36991. z[i] = u & 0xff;
  36992. u >>>= 8;
  36993. }
  36994. b -= 64;
  36995. cpos += 64;
  36996. mpos += 64;
  36997. }
  36998. if (b > 0) {
  36999. crypto_core_salsa20(x,z,k,sigma);
  37000. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37001. }
  37002. return 0;
  37003. }
  37004. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37005. var z = new Uint8Array(16), x = new Uint8Array(64);
  37006. var u, i;
  37007. for (i = 0; i < 16; i++) z[i] = 0;
  37008. for (i = 0; i < 8; i++) z[i] = n[i];
  37009. while (b >= 64) {
  37010. crypto_core_salsa20(x,z,k,sigma);
  37011. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37012. u = 1;
  37013. for (i = 8; i < 16; i++) {
  37014. u = u + (z[i] & 0xff) | 0;
  37015. z[i] = u & 0xff;
  37016. u >>>= 8;
  37017. }
  37018. b -= 64;
  37019. cpos += 64;
  37020. }
  37021. if (b > 0) {
  37022. crypto_core_salsa20(x,z,k,sigma);
  37023. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37024. }
  37025. return 0;
  37026. }
  37027. function crypto_stream(c,cpos,d,n,k) {
  37028. var s = new Uint8Array(32);
  37029. crypto_core_hsalsa20(s,n,k,sigma);
  37030. var sn = new Uint8Array(8);
  37031. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37032. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37033. }
  37034. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37035. var s = new Uint8Array(32);
  37036. crypto_core_hsalsa20(s,n,k,sigma);
  37037. var sn = new Uint8Array(8);
  37038. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37039. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37040. }
  37041. /*
  37042. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37043. * https://github.com/floodyberry/poly1305-donna
  37044. */
  37045. var poly1305 = function(key) {
  37046. this.buffer = new Uint8Array(16);
  37047. this.r = new Uint16Array(10);
  37048. this.h = new Uint16Array(10);
  37049. this.pad = new Uint16Array(8);
  37050. this.leftover = 0;
  37051. this.fin = 0;
  37052. var t0, t1, t2, t3, t4, t5, t6, t7;
  37053. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37054. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37055. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37056. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37057. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37058. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37059. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37060. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37061. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37062. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37063. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37064. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37065. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37066. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37067. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37068. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37069. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37070. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37071. };
  37072. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37073. var hibit = this.fin ? 0 : (1 << 11);
  37074. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37075. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37076. var h0 = this.h[0],
  37077. h1 = this.h[1],
  37078. h2 = this.h[2],
  37079. h3 = this.h[3],
  37080. h4 = this.h[4],
  37081. h5 = this.h[5],
  37082. h6 = this.h[6],
  37083. h7 = this.h[7],
  37084. h8 = this.h[8],
  37085. h9 = this.h[9];
  37086. var r0 = this.r[0],
  37087. r1 = this.r[1],
  37088. r2 = this.r[2],
  37089. r3 = this.r[3],
  37090. r4 = this.r[4],
  37091. r5 = this.r[5],
  37092. r6 = this.r[6],
  37093. r7 = this.r[7],
  37094. r8 = this.r[8],
  37095. r9 = this.r[9];
  37096. while (bytes >= 16) {
  37097. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37098. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37099. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37100. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37101. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37102. h5 += ((t4 >>> 1)) & 0x1fff;
  37103. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37104. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37105. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37106. h9 += ((t7 >>> 5)) | hibit;
  37107. c = 0;
  37108. d0 = c;
  37109. d0 += h0 * r0;
  37110. d0 += h1 * (5 * r9);
  37111. d0 += h2 * (5 * r8);
  37112. d0 += h3 * (5 * r7);
  37113. d0 += h4 * (5 * r6);
  37114. c = (d0 >>> 13); d0 &= 0x1fff;
  37115. d0 += h5 * (5 * r5);
  37116. d0 += h6 * (5 * r4);
  37117. d0 += h7 * (5 * r3);
  37118. d0 += h8 * (5 * r2);
  37119. d0 += h9 * (5 * r1);
  37120. c += (d0 >>> 13); d0 &= 0x1fff;
  37121. d1 = c;
  37122. d1 += h0 * r1;
  37123. d1 += h1 * r0;
  37124. d1 += h2 * (5 * r9);
  37125. d1 += h3 * (5 * r8);
  37126. d1 += h4 * (5 * r7);
  37127. c = (d1 >>> 13); d1 &= 0x1fff;
  37128. d1 += h5 * (5 * r6);
  37129. d1 += h6 * (5 * r5);
  37130. d1 += h7 * (5 * r4);
  37131. d1 += h8 * (5 * r3);
  37132. d1 += h9 * (5 * r2);
  37133. c += (d1 >>> 13); d1 &= 0x1fff;
  37134. d2 = c;
  37135. d2 += h0 * r2;
  37136. d2 += h1 * r1;
  37137. d2 += h2 * r0;
  37138. d2 += h3 * (5 * r9);
  37139. d2 += h4 * (5 * r8);
  37140. c = (d2 >>> 13); d2 &= 0x1fff;
  37141. d2 += h5 * (5 * r7);
  37142. d2 += h6 * (5 * r6);
  37143. d2 += h7 * (5 * r5);
  37144. d2 += h8 * (5 * r4);
  37145. d2 += h9 * (5 * r3);
  37146. c += (d2 >>> 13); d2 &= 0x1fff;
  37147. d3 = c;
  37148. d3 += h0 * r3;
  37149. d3 += h1 * r2;
  37150. d3 += h2 * r1;
  37151. d3 += h3 * r0;
  37152. d3 += h4 * (5 * r9);
  37153. c = (d3 >>> 13); d3 &= 0x1fff;
  37154. d3 += h5 * (5 * r8);
  37155. d3 += h6 * (5 * r7);
  37156. d3 += h7 * (5 * r6);
  37157. d3 += h8 * (5 * r5);
  37158. d3 += h9 * (5 * r4);
  37159. c += (d3 >>> 13); d3 &= 0x1fff;
  37160. d4 = c;
  37161. d4 += h0 * r4;
  37162. d4 += h1 * r3;
  37163. d4 += h2 * r2;
  37164. d4 += h3 * r1;
  37165. d4 += h4 * r0;
  37166. c = (d4 >>> 13); d4 &= 0x1fff;
  37167. d4 += h5 * (5 * r9);
  37168. d4 += h6 * (5 * r8);
  37169. d4 += h7 * (5 * r7);
  37170. d4 += h8 * (5 * r6);
  37171. d4 += h9 * (5 * r5);
  37172. c += (d4 >>> 13); d4 &= 0x1fff;
  37173. d5 = c;
  37174. d5 += h0 * r5;
  37175. d5 += h1 * r4;
  37176. d5 += h2 * r3;
  37177. d5 += h3 * r2;
  37178. d5 += h4 * r1;
  37179. c = (d5 >>> 13); d5 &= 0x1fff;
  37180. d5 += h5 * r0;
  37181. d5 += h6 * (5 * r9);
  37182. d5 += h7 * (5 * r8);
  37183. d5 += h8 * (5 * r7);
  37184. d5 += h9 * (5 * r6);
  37185. c += (d5 >>> 13); d5 &= 0x1fff;
  37186. d6 = c;
  37187. d6 += h0 * r6;
  37188. d6 += h1 * r5;
  37189. d6 += h2 * r4;
  37190. d6 += h3 * r3;
  37191. d6 += h4 * r2;
  37192. c = (d6 >>> 13); d6 &= 0x1fff;
  37193. d6 += h5 * r1;
  37194. d6 += h6 * r0;
  37195. d6 += h7 * (5 * r9);
  37196. d6 += h8 * (5 * r8);
  37197. d6 += h9 * (5 * r7);
  37198. c += (d6 >>> 13); d6 &= 0x1fff;
  37199. d7 = c;
  37200. d7 += h0 * r7;
  37201. d7 += h1 * r6;
  37202. d7 += h2 * r5;
  37203. d7 += h3 * r4;
  37204. d7 += h4 * r3;
  37205. c = (d7 >>> 13); d7 &= 0x1fff;
  37206. d7 += h5 * r2;
  37207. d7 += h6 * r1;
  37208. d7 += h7 * r0;
  37209. d7 += h8 * (5 * r9);
  37210. d7 += h9 * (5 * r8);
  37211. c += (d7 >>> 13); d7 &= 0x1fff;
  37212. d8 = c;
  37213. d8 += h0 * r8;
  37214. d8 += h1 * r7;
  37215. d8 += h2 * r6;
  37216. d8 += h3 * r5;
  37217. d8 += h4 * r4;
  37218. c = (d8 >>> 13); d8 &= 0x1fff;
  37219. d8 += h5 * r3;
  37220. d8 += h6 * r2;
  37221. d8 += h7 * r1;
  37222. d8 += h8 * r0;
  37223. d8 += h9 * (5 * r9);
  37224. c += (d8 >>> 13); d8 &= 0x1fff;
  37225. d9 = c;
  37226. d9 += h0 * r9;
  37227. d9 += h1 * r8;
  37228. d9 += h2 * r7;
  37229. d9 += h3 * r6;
  37230. d9 += h4 * r5;
  37231. c = (d9 >>> 13); d9 &= 0x1fff;
  37232. d9 += h5 * r4;
  37233. d9 += h6 * r3;
  37234. d9 += h7 * r2;
  37235. d9 += h8 * r1;
  37236. d9 += h9 * r0;
  37237. c += (d9 >>> 13); d9 &= 0x1fff;
  37238. c = (((c << 2) + c)) | 0;
  37239. c = (c + d0) | 0;
  37240. d0 = c & 0x1fff;
  37241. c = (c >>> 13);
  37242. d1 += c;
  37243. h0 = d0;
  37244. h1 = d1;
  37245. h2 = d2;
  37246. h3 = d3;
  37247. h4 = d4;
  37248. h5 = d5;
  37249. h6 = d6;
  37250. h7 = d7;
  37251. h8 = d8;
  37252. h9 = d9;
  37253. mpos += 16;
  37254. bytes -= 16;
  37255. }
  37256. this.h[0] = h0;
  37257. this.h[1] = h1;
  37258. this.h[2] = h2;
  37259. this.h[3] = h3;
  37260. this.h[4] = h4;
  37261. this.h[5] = h5;
  37262. this.h[6] = h6;
  37263. this.h[7] = h7;
  37264. this.h[8] = h8;
  37265. this.h[9] = h9;
  37266. };
  37267. poly1305.prototype.finish = function(mac, macpos) {
  37268. var g = new Uint16Array(10);
  37269. var c, mask, f, i;
  37270. if (this.leftover) {
  37271. i = this.leftover;
  37272. this.buffer[i++] = 1;
  37273. for (; i < 16; i++) this.buffer[i] = 0;
  37274. this.fin = 1;
  37275. this.blocks(this.buffer, 0, 16);
  37276. }
  37277. c = this.h[1] >>> 13;
  37278. this.h[1] &= 0x1fff;
  37279. for (i = 2; i < 10; i++) {
  37280. this.h[i] += c;
  37281. c = this.h[i] >>> 13;
  37282. this.h[i] &= 0x1fff;
  37283. }
  37284. this.h[0] += (c * 5);
  37285. c = this.h[0] >>> 13;
  37286. this.h[0] &= 0x1fff;
  37287. this.h[1] += c;
  37288. c = this.h[1] >>> 13;
  37289. this.h[1] &= 0x1fff;
  37290. this.h[2] += c;
  37291. g[0] = this.h[0] + 5;
  37292. c = g[0] >>> 13;
  37293. g[0] &= 0x1fff;
  37294. for (i = 1; i < 10; i++) {
  37295. g[i] = this.h[i] + c;
  37296. c = g[i] >>> 13;
  37297. g[i] &= 0x1fff;
  37298. }
  37299. g[9] -= (1 << 13);
  37300. mask = (c ^ 1) - 1;
  37301. for (i = 0; i < 10; i++) g[i] &= mask;
  37302. mask = ~mask;
  37303. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37304. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37305. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37306. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37307. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37308. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37309. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37310. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37311. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37312. f = this.h[0] + this.pad[0];
  37313. this.h[0] = f & 0xffff;
  37314. for (i = 1; i < 8; i++) {
  37315. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37316. this.h[i] = f & 0xffff;
  37317. }
  37318. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37319. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37320. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37321. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37322. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37323. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37324. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37325. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37326. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37327. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37328. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37329. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37330. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37331. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37332. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37333. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37334. };
  37335. poly1305.prototype.update = function(m, mpos, bytes) {
  37336. var i, want;
  37337. if (this.leftover) {
  37338. want = (16 - this.leftover);
  37339. if (want > bytes)
  37340. want = bytes;
  37341. for (i = 0; i < want; i++)
  37342. this.buffer[this.leftover + i] = m[mpos+i];
  37343. bytes -= want;
  37344. mpos += want;
  37345. this.leftover += want;
  37346. if (this.leftover < 16)
  37347. return;
  37348. this.blocks(this.buffer, 0, 16);
  37349. this.leftover = 0;
  37350. }
  37351. if (bytes >= 16) {
  37352. want = bytes - (bytes % 16);
  37353. this.blocks(m, mpos, want);
  37354. mpos += want;
  37355. bytes -= want;
  37356. }
  37357. if (bytes) {
  37358. for (i = 0; i < bytes; i++)
  37359. this.buffer[this.leftover + i] = m[mpos+i];
  37360. this.leftover += bytes;
  37361. }
  37362. };
  37363. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37364. var s = new poly1305(k);
  37365. s.update(m, mpos, n);
  37366. s.finish(out, outpos);
  37367. return 0;
  37368. }
  37369. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37370. var x = new Uint8Array(16);
  37371. crypto_onetimeauth(x,0,m,mpos,n,k);
  37372. return crypto_verify_16(h,hpos,x,0);
  37373. }
  37374. function crypto_secretbox(c,m,d,n,k) {
  37375. var i;
  37376. if (d < 32) return -1;
  37377. crypto_stream_xor(c,0,m,0,d,n,k);
  37378. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37379. for (i = 0; i < 16; i++) c[i] = 0;
  37380. return 0;
  37381. }
  37382. function crypto_secretbox_open(m,c,d,n,k) {
  37383. var i;
  37384. var x = new Uint8Array(32);
  37385. if (d < 32) return -1;
  37386. crypto_stream(x,0,32,n,k);
  37387. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37388. crypto_stream_xor(m,0,c,0,d,n,k);
  37389. for (i = 0; i < 32; i++) m[i] = 0;
  37390. return 0;
  37391. }
  37392. function set25519(r, a) {
  37393. var i;
  37394. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37395. }
  37396. function car25519(o) {
  37397. var i, v, c = 1;
  37398. for (i = 0; i < 16; i++) {
  37399. v = o[i] + c + 65535;
  37400. c = Math.floor(v / 65536);
  37401. o[i] = v - c * 65536;
  37402. }
  37403. o[0] += c-1 + 37 * (c-1);
  37404. }
  37405. function sel25519(p, q, b) {
  37406. var t, c = ~(b-1);
  37407. for (var i = 0; i < 16; i++) {
  37408. t = c & (p[i] ^ q[i]);
  37409. p[i] ^= t;
  37410. q[i] ^= t;
  37411. }
  37412. }
  37413. function pack25519(o, n) {
  37414. var i, j, b;
  37415. var m = gf(), t = gf();
  37416. for (i = 0; i < 16; i++) t[i] = n[i];
  37417. car25519(t);
  37418. car25519(t);
  37419. car25519(t);
  37420. for (j = 0; j < 2; j++) {
  37421. m[0] = t[0] - 0xffed;
  37422. for (i = 1; i < 15; i++) {
  37423. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37424. m[i-1] &= 0xffff;
  37425. }
  37426. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37427. b = (m[15]>>16) & 1;
  37428. m[14] &= 0xffff;
  37429. sel25519(t, m, 1-b);
  37430. }
  37431. for (i = 0; i < 16; i++) {
  37432. o[2*i] = t[i] & 0xff;
  37433. o[2*i+1] = t[i]>>8;
  37434. }
  37435. }
  37436. function neq25519(a, b) {
  37437. var c = new Uint8Array(32), d = new Uint8Array(32);
  37438. pack25519(c, a);
  37439. pack25519(d, b);
  37440. return crypto_verify_32(c, 0, d, 0);
  37441. }
  37442. function par25519(a) {
  37443. var d = new Uint8Array(32);
  37444. pack25519(d, a);
  37445. return d[0] & 1;
  37446. }
  37447. function unpack25519(o, n) {
  37448. var i;
  37449. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37450. o[15] &= 0x7fff;
  37451. }
  37452. function A(o, a, b) {
  37453. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37454. }
  37455. function Z(o, a, b) {
  37456. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37457. }
  37458. function M(o, a, b) {
  37459. var v, c,
  37460. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37461. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37462. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37463. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37464. b0 = b[0],
  37465. b1 = b[1],
  37466. b2 = b[2],
  37467. b3 = b[3],
  37468. b4 = b[4],
  37469. b5 = b[5],
  37470. b6 = b[6],
  37471. b7 = b[7],
  37472. b8 = b[8],
  37473. b9 = b[9],
  37474. b10 = b[10],
  37475. b11 = b[11],
  37476. b12 = b[12],
  37477. b13 = b[13],
  37478. b14 = b[14],
  37479. b15 = b[15];
  37480. v = a[0];
  37481. t0 += v * b0;
  37482. t1 += v * b1;
  37483. t2 += v * b2;
  37484. t3 += v * b3;
  37485. t4 += v * b4;
  37486. t5 += v * b5;
  37487. t6 += v * b6;
  37488. t7 += v * b7;
  37489. t8 += v * b8;
  37490. t9 += v * b9;
  37491. t10 += v * b10;
  37492. t11 += v * b11;
  37493. t12 += v * b12;
  37494. t13 += v * b13;
  37495. t14 += v * b14;
  37496. t15 += v * b15;
  37497. v = a[1];
  37498. t1 += v * b0;
  37499. t2 += v * b1;
  37500. t3 += v * b2;
  37501. t4 += v * b3;
  37502. t5 += v * b4;
  37503. t6 += v * b5;
  37504. t7 += v * b6;
  37505. t8 += v * b7;
  37506. t9 += v * b8;
  37507. t10 += v * b9;
  37508. t11 += v * b10;
  37509. t12 += v * b11;
  37510. t13 += v * b12;
  37511. t14 += v * b13;
  37512. t15 += v * b14;
  37513. t16 += v * b15;
  37514. v = a[2];
  37515. t2 += v * b0;
  37516. t3 += v * b1;
  37517. t4 += v * b2;
  37518. t5 += v * b3;
  37519. t6 += v * b4;
  37520. t7 += v * b5;
  37521. t8 += v * b6;
  37522. t9 += v * b7;
  37523. t10 += v * b8;
  37524. t11 += v * b9;
  37525. t12 += v * b10;
  37526. t13 += v * b11;
  37527. t14 += v * b12;
  37528. t15 += v * b13;
  37529. t16 += v * b14;
  37530. t17 += v * b15;
  37531. v = a[3];
  37532. t3 += v * b0;
  37533. t4 += v * b1;
  37534. t5 += v * b2;
  37535. t6 += v * b3;
  37536. t7 += v * b4;
  37537. t8 += v * b5;
  37538. t9 += v * b6;
  37539. t10 += v * b7;
  37540. t11 += v * b8;
  37541. t12 += v * b9;
  37542. t13 += v * b10;
  37543. t14 += v * b11;
  37544. t15 += v * b12;
  37545. t16 += v * b13;
  37546. t17 += v * b14;
  37547. t18 += v * b15;
  37548. v = a[4];
  37549. t4 += v * b0;
  37550. t5 += v * b1;
  37551. t6 += v * b2;
  37552. t7 += v * b3;
  37553. t8 += v * b4;
  37554. t9 += v * b5;
  37555. t10 += v * b6;
  37556. t11 += v * b7;
  37557. t12 += v * b8;
  37558. t13 += v * b9;
  37559. t14 += v * b10;
  37560. t15 += v * b11;
  37561. t16 += v * b12;
  37562. t17 += v * b13;
  37563. t18 += v * b14;
  37564. t19 += v * b15;
  37565. v = a[5];
  37566. t5 += v * b0;
  37567. t6 += v * b1;
  37568. t7 += v * b2;
  37569. t8 += v * b3;
  37570. t9 += v * b4;
  37571. t10 += v * b5;
  37572. t11 += v * b6;
  37573. t12 += v * b7;
  37574. t13 += v * b8;
  37575. t14 += v * b9;
  37576. t15 += v * b10;
  37577. t16 += v * b11;
  37578. t17 += v * b12;
  37579. t18 += v * b13;
  37580. t19 += v * b14;
  37581. t20 += v * b15;
  37582. v = a[6];
  37583. t6 += v * b0;
  37584. t7 += v * b1;
  37585. t8 += v * b2;
  37586. t9 += v * b3;
  37587. t10 += v * b4;
  37588. t11 += v * b5;
  37589. t12 += v * b6;
  37590. t13 += v * b7;
  37591. t14 += v * b8;
  37592. t15 += v * b9;
  37593. t16 += v * b10;
  37594. t17 += v * b11;
  37595. t18 += v * b12;
  37596. t19 += v * b13;
  37597. t20 += v * b14;
  37598. t21 += v * b15;
  37599. v = a[7];
  37600. t7 += v * b0;
  37601. t8 += v * b1;
  37602. t9 += v * b2;
  37603. t10 += v * b3;
  37604. t11 += v * b4;
  37605. t12 += v * b5;
  37606. t13 += v * b6;
  37607. t14 += v * b7;
  37608. t15 += v * b8;
  37609. t16 += v * b9;
  37610. t17 += v * b10;
  37611. t18 += v * b11;
  37612. t19 += v * b12;
  37613. t20 += v * b13;
  37614. t21 += v * b14;
  37615. t22 += v * b15;
  37616. v = a[8];
  37617. t8 += v * b0;
  37618. t9 += v * b1;
  37619. t10 += v * b2;
  37620. t11 += v * b3;
  37621. t12 += v * b4;
  37622. t13 += v * b5;
  37623. t14 += v * b6;
  37624. t15 += v * b7;
  37625. t16 += v * b8;
  37626. t17 += v * b9;
  37627. t18 += v * b10;
  37628. t19 += v * b11;
  37629. t20 += v * b12;
  37630. t21 += v * b13;
  37631. t22 += v * b14;
  37632. t23 += v * b15;
  37633. v = a[9];
  37634. t9 += v * b0;
  37635. t10 += v * b1;
  37636. t11 += v * b2;
  37637. t12 += v * b3;
  37638. t13 += v * b4;
  37639. t14 += v * b5;
  37640. t15 += v * b6;
  37641. t16 += v * b7;
  37642. t17 += v * b8;
  37643. t18 += v * b9;
  37644. t19 += v * b10;
  37645. t20 += v * b11;
  37646. t21 += v * b12;
  37647. t22 += v * b13;
  37648. t23 += v * b14;
  37649. t24 += v * b15;
  37650. v = a[10];
  37651. t10 += v * b0;
  37652. t11 += v * b1;
  37653. t12 += v * b2;
  37654. t13 += v * b3;
  37655. t14 += v * b4;
  37656. t15 += v * b5;
  37657. t16 += v * b6;
  37658. t17 += v * b7;
  37659. t18 += v * b8;
  37660. t19 += v * b9;
  37661. t20 += v * b10;
  37662. t21 += v * b11;
  37663. t22 += v * b12;
  37664. t23 += v * b13;
  37665. t24 += v * b14;
  37666. t25 += v * b15;
  37667. v = a[11];
  37668. t11 += v * b0;
  37669. t12 += v * b1;
  37670. t13 += v * b2;
  37671. t14 += v * b3;
  37672. t15 += v * b4;
  37673. t16 += v * b5;
  37674. t17 += v * b6;
  37675. t18 += v * b7;
  37676. t19 += v * b8;
  37677. t20 += v * b9;
  37678. t21 += v * b10;
  37679. t22 += v * b11;
  37680. t23 += v * b12;
  37681. t24 += v * b13;
  37682. t25 += v * b14;
  37683. t26 += v * b15;
  37684. v = a[12];
  37685. t12 += v * b0;
  37686. t13 += v * b1;
  37687. t14 += v * b2;
  37688. t15 += v * b3;
  37689. t16 += v * b4;
  37690. t17 += v * b5;
  37691. t18 += v * b6;
  37692. t19 += v * b7;
  37693. t20 += v * b8;
  37694. t21 += v * b9;
  37695. t22 += v * b10;
  37696. t23 += v * b11;
  37697. t24 += v * b12;
  37698. t25 += v * b13;
  37699. t26 += v * b14;
  37700. t27 += v * b15;
  37701. v = a[13];
  37702. t13 += v * b0;
  37703. t14 += v * b1;
  37704. t15 += v * b2;
  37705. t16 += v * b3;
  37706. t17 += v * b4;
  37707. t18 += v * b5;
  37708. t19 += v * b6;
  37709. t20 += v * b7;
  37710. t21 += v * b8;
  37711. t22 += v * b9;
  37712. t23 += v * b10;
  37713. t24 += v * b11;
  37714. t25 += v * b12;
  37715. t26 += v * b13;
  37716. t27 += v * b14;
  37717. t28 += v * b15;
  37718. v = a[14];
  37719. t14 += v * b0;
  37720. t15 += v * b1;
  37721. t16 += v * b2;
  37722. t17 += v * b3;
  37723. t18 += v * b4;
  37724. t19 += v * b5;
  37725. t20 += v * b6;
  37726. t21 += v * b7;
  37727. t22 += v * b8;
  37728. t23 += v * b9;
  37729. t24 += v * b10;
  37730. t25 += v * b11;
  37731. t26 += v * b12;
  37732. t27 += v * b13;
  37733. t28 += v * b14;
  37734. t29 += v * b15;
  37735. v = a[15];
  37736. t15 += v * b0;
  37737. t16 += v * b1;
  37738. t17 += v * b2;
  37739. t18 += v * b3;
  37740. t19 += v * b4;
  37741. t20 += v * b5;
  37742. t21 += v * b6;
  37743. t22 += v * b7;
  37744. t23 += v * b8;
  37745. t24 += v * b9;
  37746. t25 += v * b10;
  37747. t26 += v * b11;
  37748. t27 += v * b12;
  37749. t28 += v * b13;
  37750. t29 += v * b14;
  37751. t30 += v * b15;
  37752. t0 += 38 * t16;
  37753. t1 += 38 * t17;
  37754. t2 += 38 * t18;
  37755. t3 += 38 * t19;
  37756. t4 += 38 * t20;
  37757. t5 += 38 * t21;
  37758. t6 += 38 * t22;
  37759. t7 += 38 * t23;
  37760. t8 += 38 * t24;
  37761. t9 += 38 * t25;
  37762. t10 += 38 * t26;
  37763. t11 += 38 * t27;
  37764. t12 += 38 * t28;
  37765. t13 += 38 * t29;
  37766. t14 += 38 * t30;
  37767. // t15 left as is
  37768. // first car
  37769. c = 1;
  37770. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37771. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37772. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37773. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37774. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37775. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37776. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37777. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37778. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37779. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37780. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37781. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37782. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37783. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37784. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37785. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37786. t0 += c-1 + 37 * (c-1);
  37787. // second car
  37788. c = 1;
  37789. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37790. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37791. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37792. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37793. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37794. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37795. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37796. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37797. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37798. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37799. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37800. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37801. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37802. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37803. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37804. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37805. t0 += c-1 + 37 * (c-1);
  37806. o[ 0] = t0;
  37807. o[ 1] = t1;
  37808. o[ 2] = t2;
  37809. o[ 3] = t3;
  37810. o[ 4] = t4;
  37811. o[ 5] = t5;
  37812. o[ 6] = t6;
  37813. o[ 7] = t7;
  37814. o[ 8] = t8;
  37815. o[ 9] = t9;
  37816. o[10] = t10;
  37817. o[11] = t11;
  37818. o[12] = t12;
  37819. o[13] = t13;
  37820. o[14] = t14;
  37821. o[15] = t15;
  37822. }
  37823. function S(o, a) {
  37824. M(o, a, a);
  37825. }
  37826. function inv25519(o, i) {
  37827. var c = gf();
  37828. var a;
  37829. for (a = 0; a < 16; a++) c[a] = i[a];
  37830. for (a = 253; a >= 0; a--) {
  37831. S(c, c);
  37832. if(a !== 2 && a !== 4) M(c, c, i);
  37833. }
  37834. for (a = 0; a < 16; a++) o[a] = c[a];
  37835. }
  37836. function pow2523(o, i) {
  37837. var c = gf();
  37838. var a;
  37839. for (a = 0; a < 16; a++) c[a] = i[a];
  37840. for (a = 250; a >= 0; a--) {
  37841. S(c, c);
  37842. if(a !== 1) M(c, c, i);
  37843. }
  37844. for (a = 0; a < 16; a++) o[a] = c[a];
  37845. }
  37846. function crypto_scalarmult(q, n, p) {
  37847. var z = new Uint8Array(32);
  37848. var x = new Float64Array(80), r, i;
  37849. var a = gf(), b = gf(), c = gf(),
  37850. d = gf(), e = gf(), f = gf();
  37851. for (i = 0; i < 31; i++) z[i] = n[i];
  37852. z[31]=(n[31]&127)|64;
  37853. z[0]&=248;
  37854. unpack25519(x,p);
  37855. for (i = 0; i < 16; i++) {
  37856. b[i]=x[i];
  37857. d[i]=a[i]=c[i]=0;
  37858. }
  37859. a[0]=d[0]=1;
  37860. for (i=254; i>=0; --i) {
  37861. r=(z[i>>>3]>>>(i&7))&1;
  37862. sel25519(a,b,r);
  37863. sel25519(c,d,r);
  37864. A(e,a,c);
  37865. Z(a,a,c);
  37866. A(c,b,d);
  37867. Z(b,b,d);
  37868. S(d,e);
  37869. S(f,a);
  37870. M(a,c,a);
  37871. M(c,b,e);
  37872. A(e,a,c);
  37873. Z(a,a,c);
  37874. S(b,a);
  37875. Z(c,d,f);
  37876. M(a,c,_121665);
  37877. A(a,a,d);
  37878. M(c,c,a);
  37879. M(a,d,f);
  37880. M(d,b,x);
  37881. S(b,e);
  37882. sel25519(a,b,r);
  37883. sel25519(c,d,r);
  37884. }
  37885. for (i = 0; i < 16; i++) {
  37886. x[i+16]=a[i];
  37887. x[i+32]=c[i];
  37888. x[i+48]=b[i];
  37889. x[i+64]=d[i];
  37890. }
  37891. var x32 = x.subarray(32);
  37892. var x16 = x.subarray(16);
  37893. inv25519(x32,x32);
  37894. M(x16,x16,x32);
  37895. pack25519(q,x16);
  37896. return 0;
  37897. }
  37898. function crypto_scalarmult_base(q, n) {
  37899. return crypto_scalarmult(q, n, _9);
  37900. }
  37901. function crypto_box_keypair(y, x) {
  37902. randombytes(x, 32);
  37903. return crypto_scalarmult_base(y, x);
  37904. }
  37905. function crypto_box_beforenm(k, y, x) {
  37906. var s = new Uint8Array(32);
  37907. crypto_scalarmult(s, x, y);
  37908. return crypto_core_hsalsa20(k, _0, s, sigma);
  37909. }
  37910. var crypto_box_afternm = crypto_secretbox;
  37911. var crypto_box_open_afternm = crypto_secretbox_open;
  37912. function crypto_box(c, m, d, n, y, x) {
  37913. var k = new Uint8Array(32);
  37914. crypto_box_beforenm(k, y, x);
  37915. return crypto_box_afternm(c, m, d, n, k);
  37916. }
  37917. function crypto_box_open(m, c, d, n, y, x) {
  37918. var k = new Uint8Array(32);
  37919. crypto_box_beforenm(k, y, x);
  37920. return crypto_box_open_afternm(m, c, d, n, k);
  37921. }
  37922. var K = [
  37923. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  37924. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  37925. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  37926. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  37927. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  37928. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  37929. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  37930. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  37931. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  37932. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  37933. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  37934. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  37935. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  37936. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  37937. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  37938. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  37939. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  37940. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  37941. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  37942. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  37943. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  37944. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  37945. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  37946. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  37947. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  37948. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  37949. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  37950. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  37951. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  37952. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  37953. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  37954. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  37955. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  37956. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  37957. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  37958. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  37959. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  37960. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  37961. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  37962. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  37963. ];
  37964. function crypto_hashblocks_hl(hh, hl, m, n) {
  37965. var wh = new Int32Array(16), wl = new Int32Array(16),
  37966. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  37967. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  37968. th, tl, i, j, h, l, a, b, c, d;
  37969. var ah0 = hh[0],
  37970. ah1 = hh[1],
  37971. ah2 = hh[2],
  37972. ah3 = hh[3],
  37973. ah4 = hh[4],
  37974. ah5 = hh[5],
  37975. ah6 = hh[6],
  37976. ah7 = hh[7],
  37977. al0 = hl[0],
  37978. al1 = hl[1],
  37979. al2 = hl[2],
  37980. al3 = hl[3],
  37981. al4 = hl[4],
  37982. al5 = hl[5],
  37983. al6 = hl[6],
  37984. al7 = hl[7];
  37985. var pos = 0;
  37986. while (n >= 128) {
  37987. for (i = 0; i < 16; i++) {
  37988. j = 8 * i + pos;
  37989. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  37990. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  37991. }
  37992. for (i = 0; i < 80; i++) {
  37993. bh0 = ah0;
  37994. bh1 = ah1;
  37995. bh2 = ah2;
  37996. bh3 = ah3;
  37997. bh4 = ah4;
  37998. bh5 = ah5;
  37999. bh6 = ah6;
  38000. bh7 = ah7;
  38001. bl0 = al0;
  38002. bl1 = al1;
  38003. bl2 = al2;
  38004. bl3 = al3;
  38005. bl4 = al4;
  38006. bl5 = al5;
  38007. bl6 = al6;
  38008. bl7 = al7;
  38009. // add
  38010. h = ah7;
  38011. l = al7;
  38012. a = l & 0xffff; b = l >>> 16;
  38013. c = h & 0xffff; d = h >>> 16;
  38014. // Sigma1
  38015. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38016. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38017. a += l & 0xffff; b += l >>> 16;
  38018. c += h & 0xffff; d += h >>> 16;
  38019. // Ch
  38020. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38021. l = (al4 & al5) ^ (~al4 & al6);
  38022. a += l & 0xffff; b += l >>> 16;
  38023. c += h & 0xffff; d += h >>> 16;
  38024. // K
  38025. h = K[i*2];
  38026. l = K[i*2+1];
  38027. a += l & 0xffff; b += l >>> 16;
  38028. c += h & 0xffff; d += h >>> 16;
  38029. // w
  38030. h = wh[i%16];
  38031. l = wl[i%16];
  38032. a += l & 0xffff; b += l >>> 16;
  38033. c += h & 0xffff; d += h >>> 16;
  38034. b += a >>> 16;
  38035. c += b >>> 16;
  38036. d += c >>> 16;
  38037. th = c & 0xffff | d << 16;
  38038. tl = a & 0xffff | b << 16;
  38039. // add
  38040. h = th;
  38041. l = tl;
  38042. a = l & 0xffff; b = l >>> 16;
  38043. c = h & 0xffff; d = h >>> 16;
  38044. // Sigma0
  38045. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38046. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38047. a += l & 0xffff; b += l >>> 16;
  38048. c += h & 0xffff; d += h >>> 16;
  38049. // Maj
  38050. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38051. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38052. a += l & 0xffff; b += l >>> 16;
  38053. c += h & 0xffff; d += h >>> 16;
  38054. b += a >>> 16;
  38055. c += b >>> 16;
  38056. d += c >>> 16;
  38057. bh7 = (c & 0xffff) | (d << 16);
  38058. bl7 = (a & 0xffff) | (b << 16);
  38059. // add
  38060. h = bh3;
  38061. l = bl3;
  38062. a = l & 0xffff; b = l >>> 16;
  38063. c = h & 0xffff; d = h >>> 16;
  38064. h = th;
  38065. l = tl;
  38066. a += l & 0xffff; b += l >>> 16;
  38067. c += h & 0xffff; d += h >>> 16;
  38068. b += a >>> 16;
  38069. c += b >>> 16;
  38070. d += c >>> 16;
  38071. bh3 = (c & 0xffff) | (d << 16);
  38072. bl3 = (a & 0xffff) | (b << 16);
  38073. ah1 = bh0;
  38074. ah2 = bh1;
  38075. ah3 = bh2;
  38076. ah4 = bh3;
  38077. ah5 = bh4;
  38078. ah6 = bh5;
  38079. ah7 = bh6;
  38080. ah0 = bh7;
  38081. al1 = bl0;
  38082. al2 = bl1;
  38083. al3 = bl2;
  38084. al4 = bl3;
  38085. al5 = bl4;
  38086. al6 = bl5;
  38087. al7 = bl6;
  38088. al0 = bl7;
  38089. if (i%16 === 15) {
  38090. for (j = 0; j < 16; j++) {
  38091. // add
  38092. h = wh[j];
  38093. l = wl[j];
  38094. a = l & 0xffff; b = l >>> 16;
  38095. c = h & 0xffff; d = h >>> 16;
  38096. h = wh[(j+9)%16];
  38097. l = wl[(j+9)%16];
  38098. a += l & 0xffff; b += l >>> 16;
  38099. c += h & 0xffff; d += h >>> 16;
  38100. // sigma0
  38101. th = wh[(j+1)%16];
  38102. tl = wl[(j+1)%16];
  38103. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38104. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38105. a += l & 0xffff; b += l >>> 16;
  38106. c += h & 0xffff; d += h >>> 16;
  38107. // sigma1
  38108. th = wh[(j+14)%16];
  38109. tl = wl[(j+14)%16];
  38110. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38111. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38112. a += l & 0xffff; b += l >>> 16;
  38113. c += h & 0xffff; d += h >>> 16;
  38114. b += a >>> 16;
  38115. c += b >>> 16;
  38116. d += c >>> 16;
  38117. wh[j] = (c & 0xffff) | (d << 16);
  38118. wl[j] = (a & 0xffff) | (b << 16);
  38119. }
  38120. }
  38121. }
  38122. // add
  38123. h = ah0;
  38124. l = al0;
  38125. a = l & 0xffff; b = l >>> 16;
  38126. c = h & 0xffff; d = h >>> 16;
  38127. h = hh[0];
  38128. l = hl[0];
  38129. a += l & 0xffff; b += l >>> 16;
  38130. c += h & 0xffff; d += h >>> 16;
  38131. b += a >>> 16;
  38132. c += b >>> 16;
  38133. d += c >>> 16;
  38134. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38135. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38136. h = ah1;
  38137. l = al1;
  38138. a = l & 0xffff; b = l >>> 16;
  38139. c = h & 0xffff; d = h >>> 16;
  38140. h = hh[1];
  38141. l = hl[1];
  38142. a += l & 0xffff; b += l >>> 16;
  38143. c += h & 0xffff; d += h >>> 16;
  38144. b += a >>> 16;
  38145. c += b >>> 16;
  38146. d += c >>> 16;
  38147. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38148. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38149. h = ah2;
  38150. l = al2;
  38151. a = l & 0xffff; b = l >>> 16;
  38152. c = h & 0xffff; d = h >>> 16;
  38153. h = hh[2];
  38154. l = hl[2];
  38155. a += l & 0xffff; b += l >>> 16;
  38156. c += h & 0xffff; d += h >>> 16;
  38157. b += a >>> 16;
  38158. c += b >>> 16;
  38159. d += c >>> 16;
  38160. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38161. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38162. h = ah3;
  38163. l = al3;
  38164. a = l & 0xffff; b = l >>> 16;
  38165. c = h & 0xffff; d = h >>> 16;
  38166. h = hh[3];
  38167. l = hl[3];
  38168. a += l & 0xffff; b += l >>> 16;
  38169. c += h & 0xffff; d += h >>> 16;
  38170. b += a >>> 16;
  38171. c += b >>> 16;
  38172. d += c >>> 16;
  38173. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38174. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38175. h = ah4;
  38176. l = al4;
  38177. a = l & 0xffff; b = l >>> 16;
  38178. c = h & 0xffff; d = h >>> 16;
  38179. h = hh[4];
  38180. l = hl[4];
  38181. a += l & 0xffff; b += l >>> 16;
  38182. c += h & 0xffff; d += h >>> 16;
  38183. b += a >>> 16;
  38184. c += b >>> 16;
  38185. d += c >>> 16;
  38186. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38187. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38188. h = ah5;
  38189. l = al5;
  38190. a = l & 0xffff; b = l >>> 16;
  38191. c = h & 0xffff; d = h >>> 16;
  38192. h = hh[5];
  38193. l = hl[5];
  38194. a += l & 0xffff; b += l >>> 16;
  38195. c += h & 0xffff; d += h >>> 16;
  38196. b += a >>> 16;
  38197. c += b >>> 16;
  38198. d += c >>> 16;
  38199. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38200. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38201. h = ah6;
  38202. l = al6;
  38203. a = l & 0xffff; b = l >>> 16;
  38204. c = h & 0xffff; d = h >>> 16;
  38205. h = hh[6];
  38206. l = hl[6];
  38207. a += l & 0xffff; b += l >>> 16;
  38208. c += h & 0xffff; d += h >>> 16;
  38209. b += a >>> 16;
  38210. c += b >>> 16;
  38211. d += c >>> 16;
  38212. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38213. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38214. h = ah7;
  38215. l = al7;
  38216. a = l & 0xffff; b = l >>> 16;
  38217. c = h & 0xffff; d = h >>> 16;
  38218. h = hh[7];
  38219. l = hl[7];
  38220. a += l & 0xffff; b += l >>> 16;
  38221. c += h & 0xffff; d += h >>> 16;
  38222. b += a >>> 16;
  38223. c += b >>> 16;
  38224. d += c >>> 16;
  38225. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38226. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38227. pos += 128;
  38228. n -= 128;
  38229. }
  38230. return n;
  38231. }
  38232. function crypto_hash(out, m, n) {
  38233. var hh = new Int32Array(8),
  38234. hl = new Int32Array(8),
  38235. x = new Uint8Array(256),
  38236. i, b = n;
  38237. hh[0] = 0x6a09e667;
  38238. hh[1] = 0xbb67ae85;
  38239. hh[2] = 0x3c6ef372;
  38240. hh[3] = 0xa54ff53a;
  38241. hh[4] = 0x510e527f;
  38242. hh[5] = 0x9b05688c;
  38243. hh[6] = 0x1f83d9ab;
  38244. hh[7] = 0x5be0cd19;
  38245. hl[0] = 0xf3bcc908;
  38246. hl[1] = 0x84caa73b;
  38247. hl[2] = 0xfe94f82b;
  38248. hl[3] = 0x5f1d36f1;
  38249. hl[4] = 0xade682d1;
  38250. hl[5] = 0x2b3e6c1f;
  38251. hl[6] = 0xfb41bd6b;
  38252. hl[7] = 0x137e2179;
  38253. crypto_hashblocks_hl(hh, hl, m, n);
  38254. n %= 128;
  38255. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38256. x[n] = 128;
  38257. n = 256-128*(n<112?1:0);
  38258. x[n-9] = 0;
  38259. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38260. crypto_hashblocks_hl(hh, hl, x, n);
  38261. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38262. return 0;
  38263. }
  38264. function add(p, q) {
  38265. var a = gf(), b = gf(), c = gf(),
  38266. d = gf(), e = gf(), f = gf(),
  38267. g = gf(), h = gf(), t = gf();
  38268. Z(a, p[1], p[0]);
  38269. Z(t, q[1], q[0]);
  38270. M(a, a, t);
  38271. A(b, p[0], p[1]);
  38272. A(t, q[0], q[1]);
  38273. M(b, b, t);
  38274. M(c, p[3], q[3]);
  38275. M(c, c, D2);
  38276. M(d, p[2], q[2]);
  38277. A(d, d, d);
  38278. Z(e, b, a);
  38279. Z(f, d, c);
  38280. A(g, d, c);
  38281. A(h, b, a);
  38282. M(p[0], e, f);
  38283. M(p[1], h, g);
  38284. M(p[2], g, f);
  38285. M(p[3], e, h);
  38286. }
  38287. function cswap(p, q, b) {
  38288. var i;
  38289. for (i = 0; i < 4; i++) {
  38290. sel25519(p[i], q[i], b);
  38291. }
  38292. }
  38293. function pack(r, p) {
  38294. var tx = gf(), ty = gf(), zi = gf();
  38295. inv25519(zi, p[2]);
  38296. M(tx, p[0], zi);
  38297. M(ty, p[1], zi);
  38298. pack25519(r, ty);
  38299. r[31] ^= par25519(tx) << 7;
  38300. }
  38301. function scalarmult(p, q, s) {
  38302. var b, i;
  38303. set25519(p[0], gf0);
  38304. set25519(p[1], gf1);
  38305. set25519(p[2], gf1);
  38306. set25519(p[3], gf0);
  38307. for (i = 255; i >= 0; --i) {
  38308. b = (s[(i/8)|0] >> (i&7)) & 1;
  38309. cswap(p, q, b);
  38310. add(q, p);
  38311. add(p, p);
  38312. cswap(p, q, b);
  38313. }
  38314. }
  38315. function scalarbase(p, s) {
  38316. var q = [gf(), gf(), gf(), gf()];
  38317. set25519(q[0], X);
  38318. set25519(q[1], Y);
  38319. set25519(q[2], gf1);
  38320. M(q[3], X, Y);
  38321. scalarmult(p, q, s);
  38322. }
  38323. function crypto_sign_keypair(pk, sk, seeded) {
  38324. var d = new Uint8Array(64);
  38325. var p = [gf(), gf(), gf(), gf()];
  38326. var i;
  38327. if (!seeded) randombytes(sk, 32);
  38328. crypto_hash(d, sk, 32);
  38329. d[0] &= 248;
  38330. d[31] &= 127;
  38331. d[31] |= 64;
  38332. scalarbase(p, d);
  38333. pack(pk, p);
  38334. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38335. return 0;
  38336. }
  38337. 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]);
  38338. function modL(r, x) {
  38339. var carry, i, j, k;
  38340. for (i = 63; i >= 32; --i) {
  38341. carry = 0;
  38342. for (j = i - 32, k = i - 12; j < k; ++j) {
  38343. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38344. carry = (x[j] + 128) >> 8;
  38345. x[j] -= carry * 256;
  38346. }
  38347. x[j] += carry;
  38348. x[i] = 0;
  38349. }
  38350. carry = 0;
  38351. for (j = 0; j < 32; j++) {
  38352. x[j] += carry - (x[31] >> 4) * L[j];
  38353. carry = x[j] >> 8;
  38354. x[j] &= 255;
  38355. }
  38356. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38357. for (i = 0; i < 32; i++) {
  38358. x[i+1] += x[i] >> 8;
  38359. r[i] = x[i] & 255;
  38360. }
  38361. }
  38362. function reduce(r) {
  38363. var x = new Float64Array(64), i;
  38364. for (i = 0; i < 64; i++) x[i] = r[i];
  38365. for (i = 0; i < 64; i++) r[i] = 0;
  38366. modL(r, x);
  38367. }
  38368. // Note: difference from C - smlen returned, not passed as argument.
  38369. function crypto_sign(sm, m, n, sk) {
  38370. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38371. var i, j, x = new Float64Array(64);
  38372. var p = [gf(), gf(), gf(), gf()];
  38373. crypto_hash(d, sk, 32);
  38374. d[0] &= 248;
  38375. d[31] &= 127;
  38376. d[31] |= 64;
  38377. var smlen = n + 64;
  38378. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38379. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38380. crypto_hash(r, sm.subarray(32), n+32);
  38381. reduce(r);
  38382. scalarbase(p, r);
  38383. pack(sm, p);
  38384. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38385. crypto_hash(h, sm, n + 64);
  38386. reduce(h);
  38387. for (i = 0; i < 64; i++) x[i] = 0;
  38388. for (i = 0; i < 32; i++) x[i] = r[i];
  38389. for (i = 0; i < 32; i++) {
  38390. for (j = 0; j < 32; j++) {
  38391. x[i+j] += h[i] * d[j];
  38392. }
  38393. }
  38394. modL(sm.subarray(32), x);
  38395. return smlen;
  38396. }
  38397. function unpackneg(r, p) {
  38398. var t = gf(), chk = gf(), num = gf(),
  38399. den = gf(), den2 = gf(), den4 = gf(),
  38400. den6 = gf();
  38401. set25519(r[2], gf1);
  38402. unpack25519(r[1], p);
  38403. S(num, r[1]);
  38404. M(den, num, D);
  38405. Z(num, num, r[2]);
  38406. A(den, r[2], den);
  38407. S(den2, den);
  38408. S(den4, den2);
  38409. M(den6, den4, den2);
  38410. M(t, den6, num);
  38411. M(t, t, den);
  38412. pow2523(t, t);
  38413. M(t, t, num);
  38414. M(t, t, den);
  38415. M(t, t, den);
  38416. M(r[0], t, den);
  38417. S(chk, r[0]);
  38418. M(chk, chk, den);
  38419. if (neq25519(chk, num)) M(r[0], r[0], I);
  38420. S(chk, r[0]);
  38421. M(chk, chk, den);
  38422. if (neq25519(chk, num)) return -1;
  38423. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38424. M(r[3], r[0], r[1]);
  38425. return 0;
  38426. }
  38427. function crypto_sign_open(m, sm, n, pk) {
  38428. var i, mlen;
  38429. var t = new Uint8Array(32), h = new Uint8Array(64);
  38430. var p = [gf(), gf(), gf(), gf()],
  38431. q = [gf(), gf(), gf(), gf()];
  38432. mlen = -1;
  38433. if (n < 64) return -1;
  38434. if (unpackneg(q, pk)) return -1;
  38435. for (i = 0; i < n; i++) m[i] = sm[i];
  38436. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38437. crypto_hash(h, m, n);
  38438. reduce(h);
  38439. scalarmult(p, q, h);
  38440. scalarbase(q, sm.subarray(32));
  38441. add(p, q);
  38442. pack(t, p);
  38443. n -= 64;
  38444. if (crypto_verify_32(sm, 0, t, 0)) {
  38445. for (i = 0; i < n; i++) m[i] = 0;
  38446. return -1;
  38447. }
  38448. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38449. mlen = n;
  38450. return mlen;
  38451. }
  38452. var crypto_secretbox_KEYBYTES = 32,
  38453. crypto_secretbox_NONCEBYTES = 24,
  38454. crypto_secretbox_ZEROBYTES = 32,
  38455. crypto_secretbox_BOXZEROBYTES = 16,
  38456. crypto_scalarmult_BYTES = 32,
  38457. crypto_scalarmult_SCALARBYTES = 32,
  38458. crypto_box_PUBLICKEYBYTES = 32,
  38459. crypto_box_SECRETKEYBYTES = 32,
  38460. crypto_box_BEFORENMBYTES = 32,
  38461. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38462. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38463. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38464. crypto_sign_BYTES = 64,
  38465. crypto_sign_PUBLICKEYBYTES = 32,
  38466. crypto_sign_SECRETKEYBYTES = 64,
  38467. crypto_sign_SEEDBYTES = 32,
  38468. crypto_hash_BYTES = 64;
  38469. nacl.lowlevel = {
  38470. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38471. crypto_stream_xor: crypto_stream_xor,
  38472. crypto_stream: crypto_stream,
  38473. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38474. crypto_stream_salsa20: crypto_stream_salsa20,
  38475. crypto_onetimeauth: crypto_onetimeauth,
  38476. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38477. crypto_verify_16: crypto_verify_16,
  38478. crypto_verify_32: crypto_verify_32,
  38479. crypto_secretbox: crypto_secretbox,
  38480. crypto_secretbox_open: crypto_secretbox_open,
  38481. crypto_scalarmult: crypto_scalarmult,
  38482. crypto_scalarmult_base: crypto_scalarmult_base,
  38483. crypto_box_beforenm: crypto_box_beforenm,
  38484. crypto_box_afternm: crypto_box_afternm,
  38485. crypto_box: crypto_box,
  38486. crypto_box_open: crypto_box_open,
  38487. crypto_box_keypair: crypto_box_keypair,
  38488. crypto_hash: crypto_hash,
  38489. crypto_sign: crypto_sign,
  38490. crypto_sign_keypair: crypto_sign_keypair,
  38491. crypto_sign_open: crypto_sign_open,
  38492. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38493. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38494. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38495. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38496. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38497. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38498. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38499. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38500. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38501. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38502. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38503. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38504. crypto_sign_BYTES: crypto_sign_BYTES,
  38505. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38506. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38507. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38508. crypto_hash_BYTES: crypto_hash_BYTES
  38509. };
  38510. /* High-level API */
  38511. function checkLengths(k, n) {
  38512. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38513. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38514. }
  38515. function checkBoxLengths(pk, sk) {
  38516. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38517. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38518. }
  38519. function checkArrayTypes() {
  38520. for (var i = 0; i < arguments.length; i++) {
  38521. if (!(arguments[i] instanceof Uint8Array))
  38522. throw new TypeError('unexpected type, use Uint8Array');
  38523. }
  38524. }
  38525. function cleanup(arr) {
  38526. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38527. }
  38528. nacl.randomBytes = function(n) {
  38529. var b = new Uint8Array(n);
  38530. randombytes(b, n);
  38531. return b;
  38532. };
  38533. nacl.secretbox = function(msg, nonce, key) {
  38534. checkArrayTypes(msg, nonce, key);
  38535. checkLengths(key, nonce);
  38536. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38537. var c = new Uint8Array(m.length);
  38538. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38539. crypto_secretbox(c, m, m.length, nonce, key);
  38540. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38541. };
  38542. nacl.secretbox.open = function(box, nonce, key) {
  38543. checkArrayTypes(box, nonce, key);
  38544. checkLengths(key, nonce);
  38545. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38546. var m = new Uint8Array(c.length);
  38547. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38548. if (c.length < 32) return null;
  38549. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38550. return m.subarray(crypto_secretbox_ZEROBYTES);
  38551. };
  38552. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38553. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38554. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38555. nacl.scalarMult = function(n, p) {
  38556. checkArrayTypes(n, p);
  38557. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38558. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38559. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38560. crypto_scalarmult(q, n, p);
  38561. return q;
  38562. };
  38563. nacl.scalarMult.base = function(n) {
  38564. checkArrayTypes(n);
  38565. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38566. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38567. crypto_scalarmult_base(q, n);
  38568. return q;
  38569. };
  38570. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38571. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38572. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38573. var k = nacl.box.before(publicKey, secretKey);
  38574. return nacl.secretbox(msg, nonce, k);
  38575. };
  38576. nacl.box.before = function(publicKey, secretKey) {
  38577. checkArrayTypes(publicKey, secretKey);
  38578. checkBoxLengths(publicKey, secretKey);
  38579. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38580. crypto_box_beforenm(k, publicKey, secretKey);
  38581. return k;
  38582. };
  38583. nacl.box.after = nacl.secretbox;
  38584. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38585. var k = nacl.box.before(publicKey, secretKey);
  38586. return nacl.secretbox.open(msg, nonce, k);
  38587. };
  38588. nacl.box.open.after = nacl.secretbox.open;
  38589. nacl.box.keyPair = function() {
  38590. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38591. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38592. crypto_box_keypair(pk, sk);
  38593. return {publicKey: pk, secretKey: sk};
  38594. };
  38595. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38596. checkArrayTypes(secretKey);
  38597. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38598. throw new Error('bad secret key size');
  38599. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38600. crypto_scalarmult_base(pk, secretKey);
  38601. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38602. };
  38603. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38604. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38605. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38606. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38607. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38608. nacl.sign = function(msg, secretKey) {
  38609. checkArrayTypes(msg, secretKey);
  38610. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38611. throw new Error('bad secret key size');
  38612. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38613. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38614. return signedMsg;
  38615. };
  38616. nacl.sign.open = function(signedMsg, publicKey) {
  38617. checkArrayTypes(signedMsg, publicKey);
  38618. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38619. throw new Error('bad public key size');
  38620. var tmp = new Uint8Array(signedMsg.length);
  38621. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38622. if (mlen < 0) return null;
  38623. var m = new Uint8Array(mlen);
  38624. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38625. return m;
  38626. };
  38627. nacl.sign.detached = function(msg, secretKey) {
  38628. var signedMsg = nacl.sign(msg, secretKey);
  38629. var sig = new Uint8Array(crypto_sign_BYTES);
  38630. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38631. return sig;
  38632. };
  38633. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38634. checkArrayTypes(msg, sig, publicKey);
  38635. if (sig.length !== crypto_sign_BYTES)
  38636. throw new Error('bad signature size');
  38637. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38638. throw new Error('bad public key size');
  38639. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38640. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38641. var i;
  38642. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38643. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38644. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38645. };
  38646. nacl.sign.keyPair = function() {
  38647. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38648. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38649. crypto_sign_keypair(pk, sk);
  38650. return {publicKey: pk, secretKey: sk};
  38651. };
  38652. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38653. checkArrayTypes(secretKey);
  38654. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38655. throw new Error('bad secret key size');
  38656. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38657. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38658. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38659. };
  38660. nacl.sign.keyPair.fromSeed = function(seed) {
  38661. checkArrayTypes(seed);
  38662. if (seed.length !== crypto_sign_SEEDBYTES)
  38663. throw new Error('bad seed size');
  38664. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38665. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38666. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38667. crypto_sign_keypair(pk, sk, true);
  38668. return {publicKey: pk, secretKey: sk};
  38669. };
  38670. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38671. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38672. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38673. nacl.sign.signatureLength = crypto_sign_BYTES;
  38674. nacl.hash = function(msg) {
  38675. checkArrayTypes(msg);
  38676. var h = new Uint8Array(crypto_hash_BYTES);
  38677. crypto_hash(h, msg, msg.length);
  38678. return h;
  38679. };
  38680. nacl.hash.hashLength = crypto_hash_BYTES;
  38681. nacl.verify = function(x, y) {
  38682. checkArrayTypes(x, y);
  38683. // Zero length arguments are considered not equal.
  38684. if (x.length === 0 || y.length === 0) return false;
  38685. if (x.length !== y.length) return false;
  38686. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38687. };
  38688. nacl.setPRNG = function(fn) {
  38689. randombytes = fn;
  38690. };
  38691. (function() {
  38692. // Initialize PRNG if environment provides CSPRNG.
  38693. // If not, methods calling randombytes will throw.
  38694. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38695. if (crypto && crypto.getRandomValues) {
  38696. // Browsers.
  38697. var QUOTA = 65536;
  38698. nacl.setPRNG(function(x, n) {
  38699. var i, v = new Uint8Array(n);
  38700. for (i = 0; i < n; i += QUOTA) {
  38701. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38702. }
  38703. for (i = 0; i < n; i++) x[i] = v[i];
  38704. cleanup(v);
  38705. });
  38706. } else if (true) {
  38707. // Node.js.
  38708. crypto = __webpack_require__(3);
  38709. if (crypto && crypto.randomBytes) {
  38710. nacl.setPRNG(function(x, n) {
  38711. var i, v = crypto.randomBytes(n);
  38712. for (i = 0; i < n; i++) x[i] = v[i];
  38713. cleanup(v);
  38714. });
  38715. }
  38716. }
  38717. })();
  38718. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38719. /***/ }),
  38720. /* 1 */
  38721. /***/ (function(module, exports, __webpack_require__) {
  38722. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38723. // Public domain.
  38724. (function(root, f) {
  38725. 'use strict';
  38726. if ( true && module.exports) module.exports = f();
  38727. else if (root.nacl) root.nacl.util = f();
  38728. else {
  38729. root.nacl = {};
  38730. root.nacl.util = f();
  38731. }
  38732. }(this, function() {
  38733. 'use strict';
  38734. var util = {};
  38735. function validateBase64(s) {
  38736. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  38737. throw new TypeError('invalid encoding');
  38738. }
  38739. }
  38740. util.decodeUTF8 = function(s) {
  38741. if (typeof s !== 'string') throw new TypeError('expected string');
  38742. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  38743. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38744. return b;
  38745. };
  38746. util.encodeUTF8 = function(arr) {
  38747. var i, s = [];
  38748. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  38749. return decodeURIComponent(escape(s.join('')));
  38750. };
  38751. if (typeof atob === 'undefined') {
  38752. // Node.js
  38753. if (typeof Buffer.from !== 'undefined') {
  38754. // Node v6 and later
  38755. util.encodeBase64 = function (arr) { // v6 and later
  38756. return Buffer.from(arr).toString('base64');
  38757. };
  38758. util.decodeBase64 = function (s) {
  38759. validateBase64(s);
  38760. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  38761. };
  38762. } else {
  38763. // Node earlier than v6
  38764. util.encodeBase64 = function (arr) { // v6 and later
  38765. return (new Buffer(arr)).toString('base64');
  38766. };
  38767. util.decodeBase64 = function(s) {
  38768. validateBase64(s);
  38769. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  38770. };
  38771. }
  38772. } else {
  38773. // Browsers
  38774. util.encodeBase64 = function(arr) {
  38775. var i, s = [], len = arr.length;
  38776. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  38777. return btoa(s.join(''));
  38778. };
  38779. util.decodeBase64 = function(s) {
  38780. validateBase64(s);
  38781. var i, d = atob(s), b = new Uint8Array(d.length);
  38782. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38783. return b;
  38784. };
  38785. }
  38786. return util;
  38787. }));
  38788. /***/ }),
  38789. /* 2 */
  38790. /***/ (function(module, exports, __webpack_require__) {
  38791. // required so we don't have to do require('pusher').default etc.
  38792. module.exports = __webpack_require__(4).default;
  38793. /***/ }),
  38794. /* 3 */
  38795. /***/ (function(module, exports) {
  38796. /* (ignored) */
  38797. /***/ }),
  38798. /* 4 */
  38799. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38800. "use strict";
  38801. __webpack_require__.r(__webpack_exports__);
  38802. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  38803. var ScriptReceiverFactory = (function () {
  38804. function ScriptReceiverFactory(prefix, name) {
  38805. this.lastId = 0;
  38806. this.prefix = prefix;
  38807. this.name = name;
  38808. }
  38809. ScriptReceiverFactory.prototype.create = function (callback) {
  38810. this.lastId++;
  38811. var number = this.lastId;
  38812. var id = this.prefix + number;
  38813. var name = this.name + "[" + number + "]";
  38814. var called = false;
  38815. var callbackWrapper = function () {
  38816. if (!called) {
  38817. callback.apply(null, arguments);
  38818. called = true;
  38819. }
  38820. };
  38821. this[number] = callbackWrapper;
  38822. return { number: number, id: id, name: name, callback: callbackWrapper };
  38823. };
  38824. ScriptReceiverFactory.prototype.remove = function (receiver) {
  38825. delete this[receiver.number];
  38826. };
  38827. return ScriptReceiverFactory;
  38828. }());
  38829. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  38830. // CONCATENATED MODULE: ./src/core/defaults.ts
  38831. var Defaults = {
  38832. VERSION: "5.0.3",
  38833. PROTOCOL: 7,
  38834. host: 'ws.pusherapp.com',
  38835. ws_port: 80,
  38836. wss_port: 443,
  38837. ws_path: '',
  38838. sockjs_host: 'sockjs.pusher.com',
  38839. sockjs_http_port: 80,
  38840. sockjs_https_port: 443,
  38841. sockjs_path: '/pusher',
  38842. stats_host: 'stats.pusher.com',
  38843. channel_auth_endpoint: '/pusher/auth',
  38844. channel_auth_transport: 'ajax',
  38845. activity_timeout: 120000,
  38846. pong_timeout: 30000,
  38847. unavailable_timeout: 10000,
  38848. cdn_http: "http://js.pusher.com",
  38849. cdn_https: "https://js.pusher.com",
  38850. dependency_suffix: ""
  38851. };
  38852. /* harmony default export */ var defaults = (Defaults);
  38853. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  38854. var dependency_loader_DependencyLoader = (function () {
  38855. function DependencyLoader(options) {
  38856. this.options = options;
  38857. this.receivers = options.receivers || ScriptReceivers;
  38858. this.loading = {};
  38859. }
  38860. DependencyLoader.prototype.load = function (name, options, callback) {
  38861. var self = this;
  38862. if (self.loading[name] && self.loading[name].length > 0) {
  38863. self.loading[name].push(callback);
  38864. }
  38865. else {
  38866. self.loading[name] = [callback];
  38867. var request = runtime.createScriptRequest(self.getPath(name, options));
  38868. var receiver = self.receivers.create(function (error) {
  38869. self.receivers.remove(receiver);
  38870. if (self.loading[name]) {
  38871. var callbacks = self.loading[name];
  38872. delete self.loading[name];
  38873. var successCallback = function (wasSuccessful) {
  38874. if (!wasSuccessful) {
  38875. request.cleanup();
  38876. }
  38877. };
  38878. for (var i = 0; i < callbacks.length; i++) {
  38879. callbacks[i](error, successCallback);
  38880. }
  38881. }
  38882. });
  38883. request.send(receiver);
  38884. }
  38885. };
  38886. DependencyLoader.prototype.getRoot = function (options) {
  38887. var cdn;
  38888. var protocol = runtime.getDocument().location.protocol;
  38889. if ((options && options.useTLS) || protocol === "https:") {
  38890. cdn = this.options.cdn_https;
  38891. }
  38892. else {
  38893. cdn = this.options.cdn_http;
  38894. }
  38895. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  38896. };
  38897. DependencyLoader.prototype.getPath = function (name, options) {
  38898. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  38899. };
  38900. ;
  38901. return DependencyLoader;
  38902. }());
  38903. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  38904. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  38905. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  38906. var Dependencies = new dependency_loader({
  38907. cdn_http: defaults.cdn_http,
  38908. cdn_https: defaults.cdn_https,
  38909. version: defaults.VERSION,
  38910. suffix: defaults.dependency_suffix,
  38911. receivers: DependenciesReceivers
  38912. });
  38913. // CONCATENATED MODULE: ./src/core/base64.ts
  38914. function encode(s) {
  38915. return btoa(utob(s));
  38916. }
  38917. var fromCharCode = String.fromCharCode;
  38918. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  38919. var b64tab = {};
  38920. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  38921. b64tab[b64chars.charAt(base64_i)] = base64_i;
  38922. }
  38923. var cb_utob = function (c) {
  38924. var cc = c.charCodeAt(0);
  38925. return cc < 0x80
  38926. ? c
  38927. : cc < 0x800
  38928. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  38929. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  38930. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  38931. fromCharCode(0x80 | (cc & 0x3f));
  38932. };
  38933. var utob = function (u) {
  38934. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  38935. };
  38936. var cb_encode = function (ccc) {
  38937. var padlen = [0, 2, 1][ccc.length % 3];
  38938. var ord = (ccc.charCodeAt(0) << 16) |
  38939. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  38940. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  38941. var chars = [
  38942. b64chars.charAt(ord >>> 18),
  38943. b64chars.charAt((ord >>> 12) & 63),
  38944. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  38945. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  38946. ];
  38947. return chars.join('');
  38948. };
  38949. var btoa = window.btoa ||
  38950. function (b) {
  38951. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  38952. };
  38953. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  38954. var Timer = (function () {
  38955. function Timer(set, clear, delay, callback) {
  38956. var _this = this;
  38957. this.clear = clear;
  38958. this.timer = set(function () {
  38959. if (_this.timer) {
  38960. _this.timer = callback(_this.timer);
  38961. }
  38962. }, delay);
  38963. }
  38964. Timer.prototype.isRunning = function () {
  38965. return this.timer !== null;
  38966. };
  38967. Timer.prototype.ensureAborted = function () {
  38968. if (this.timer) {
  38969. this.clear(this.timer);
  38970. this.timer = null;
  38971. }
  38972. };
  38973. return Timer;
  38974. }());
  38975. /* harmony default export */ var abstract_timer = (Timer);
  38976. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  38977. var __extends = (undefined && undefined.__extends) || (function () {
  38978. var extendStatics = function (d, b) {
  38979. extendStatics = Object.setPrototypeOf ||
  38980. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  38981. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  38982. return extendStatics(d, b);
  38983. };
  38984. return function (d, b) {
  38985. extendStatics(d, b);
  38986. function __() { this.constructor = d; }
  38987. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  38988. };
  38989. })();
  38990. function timers_clearTimeout(timer) {
  38991. window.clearTimeout(timer);
  38992. }
  38993. function timers_clearInterval(timer) {
  38994. window.clearInterval(timer);
  38995. }
  38996. var OneOffTimer = (function (_super) {
  38997. __extends(OneOffTimer, _super);
  38998. function OneOffTimer(delay, callback) {
  38999. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39000. callback();
  39001. return null;
  39002. }) || this;
  39003. }
  39004. return OneOffTimer;
  39005. }(abstract_timer));
  39006. var PeriodicTimer = (function (_super) {
  39007. __extends(PeriodicTimer, _super);
  39008. function PeriodicTimer(delay, callback) {
  39009. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39010. callback();
  39011. return timer;
  39012. }) || this;
  39013. }
  39014. return PeriodicTimer;
  39015. }(abstract_timer));
  39016. // CONCATENATED MODULE: ./src/core/util.ts
  39017. var Util = {
  39018. now: function () {
  39019. if (Date.now) {
  39020. return Date.now();
  39021. }
  39022. else {
  39023. return new Date().valueOf();
  39024. }
  39025. },
  39026. defer: function (callback) {
  39027. return new OneOffTimer(0, callback);
  39028. },
  39029. method: function (name) {
  39030. var args = [];
  39031. for (var _i = 1; _i < arguments.length; _i++) {
  39032. args[_i - 1] = arguments[_i];
  39033. }
  39034. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39035. return function (object) {
  39036. return object[name].apply(object, boundArguments.concat(arguments));
  39037. };
  39038. }
  39039. };
  39040. /* harmony default export */ var util = (Util);
  39041. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39042. function extend(target) {
  39043. var sources = [];
  39044. for (var _i = 1; _i < arguments.length; _i++) {
  39045. sources[_i - 1] = arguments[_i];
  39046. }
  39047. for (var i = 0; i < sources.length; i++) {
  39048. var extensions = sources[i];
  39049. for (var property in extensions) {
  39050. if (extensions[property] && extensions[property].constructor &&
  39051. extensions[property].constructor === Object) {
  39052. target[property] = extend(target[property] || {}, extensions[property]);
  39053. }
  39054. else {
  39055. target[property] = extensions[property];
  39056. }
  39057. }
  39058. }
  39059. return target;
  39060. }
  39061. function stringify() {
  39062. var m = ["Pusher"];
  39063. for (var i = 0; i < arguments.length; i++) {
  39064. if (typeof arguments[i] === "string") {
  39065. m.push(arguments[i]);
  39066. }
  39067. else {
  39068. m.push(safeJSONStringify(arguments[i]));
  39069. }
  39070. }
  39071. return m.join(" : ");
  39072. }
  39073. function arrayIndexOf(array, item) {
  39074. var nativeIndexOf = Array.prototype.indexOf;
  39075. if (array === null) {
  39076. return -1;
  39077. }
  39078. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39079. return array.indexOf(item);
  39080. }
  39081. for (var i = 0, l = array.length; i < l; i++) {
  39082. if (array[i] === item) {
  39083. return i;
  39084. }
  39085. }
  39086. return -1;
  39087. }
  39088. function objectApply(object, f) {
  39089. for (var key in object) {
  39090. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39091. f(object[key], key, object);
  39092. }
  39093. }
  39094. }
  39095. function keys(object) {
  39096. var keys = [];
  39097. objectApply(object, function (_, key) {
  39098. keys.push(key);
  39099. });
  39100. return keys;
  39101. }
  39102. function values(object) {
  39103. var values = [];
  39104. objectApply(object, function (value) {
  39105. values.push(value);
  39106. });
  39107. return values;
  39108. }
  39109. function apply(array, f, context) {
  39110. for (var i = 0; i < array.length; i++) {
  39111. f.call(context || window, array[i], i, array);
  39112. }
  39113. }
  39114. function map(array, f) {
  39115. var result = [];
  39116. for (var i = 0; i < array.length; i++) {
  39117. result.push(f(array[i], i, array, result));
  39118. }
  39119. return result;
  39120. }
  39121. function mapObject(object, f) {
  39122. var result = {};
  39123. objectApply(object, function (value, key) {
  39124. result[key] = f(value);
  39125. });
  39126. return result;
  39127. }
  39128. function filter(array, test) {
  39129. test = test || function (value) { return !!value; };
  39130. var result = [];
  39131. for (var i = 0; i < array.length; i++) {
  39132. if (test(array[i], i, array, result)) {
  39133. result.push(array[i]);
  39134. }
  39135. }
  39136. return result;
  39137. }
  39138. function filterObject(object, test) {
  39139. var result = {};
  39140. objectApply(object, function (value, key) {
  39141. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39142. result[key] = value;
  39143. }
  39144. });
  39145. return result;
  39146. }
  39147. function flatten(object) {
  39148. var result = [];
  39149. objectApply(object, function (value, key) {
  39150. result.push([key, value]);
  39151. });
  39152. return result;
  39153. }
  39154. function any(array, test) {
  39155. for (var i = 0; i < array.length; i++) {
  39156. if (test(array[i], i, array)) {
  39157. return true;
  39158. }
  39159. }
  39160. return false;
  39161. }
  39162. function collections_all(array, test) {
  39163. for (var i = 0; i < array.length; i++) {
  39164. if (!test(array[i], i, array)) {
  39165. return false;
  39166. }
  39167. }
  39168. return true;
  39169. }
  39170. function encodeParamsObject(data) {
  39171. return mapObject(data, function (value) {
  39172. if (typeof value === "object") {
  39173. value = safeJSONStringify(value);
  39174. }
  39175. return encodeURIComponent(encode(value.toString()));
  39176. });
  39177. }
  39178. function buildQueryString(data) {
  39179. var params = filterObject(data, function (value) {
  39180. return value !== undefined;
  39181. });
  39182. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39183. return query;
  39184. }
  39185. function decycleObject(object) {
  39186. var objects = [], paths = [];
  39187. return (function derez(value, path) {
  39188. var i, name, nu;
  39189. switch (typeof value) {
  39190. case 'object':
  39191. if (!value) {
  39192. return null;
  39193. }
  39194. for (i = 0; i < objects.length; i += 1) {
  39195. if (objects[i] === value) {
  39196. return { $ref: paths[i] };
  39197. }
  39198. }
  39199. objects.push(value);
  39200. paths.push(path);
  39201. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39202. nu = [];
  39203. for (i = 0; i < value.length; i += 1) {
  39204. nu[i] = derez(value[i], path + '[' + i + ']');
  39205. }
  39206. }
  39207. else {
  39208. nu = {};
  39209. for (name in value) {
  39210. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39211. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39212. }
  39213. }
  39214. }
  39215. return nu;
  39216. case 'number':
  39217. case 'string':
  39218. case 'boolean':
  39219. return value;
  39220. }
  39221. }(object, '$'));
  39222. }
  39223. function safeJSONStringify(source) {
  39224. try {
  39225. return JSON.stringify(source);
  39226. }
  39227. catch (e) {
  39228. return JSON.stringify(decycleObject(source));
  39229. }
  39230. }
  39231. // CONCATENATED MODULE: ./src/core/logger.ts
  39232. var logger_Logger = (function () {
  39233. function Logger() {
  39234. this.globalLog = function (message) {
  39235. if (window.console && window.console.log) {
  39236. window.console.log(message);
  39237. }
  39238. };
  39239. }
  39240. Logger.prototype.debug = function () {
  39241. var args = [];
  39242. for (var _i = 0; _i < arguments.length; _i++) {
  39243. args[_i] = arguments[_i];
  39244. }
  39245. this.log(this.globalLog, args);
  39246. };
  39247. Logger.prototype.warn = function () {
  39248. var args = [];
  39249. for (var _i = 0; _i < arguments.length; _i++) {
  39250. args[_i] = arguments[_i];
  39251. }
  39252. this.log(this.globalLogWarn, args);
  39253. };
  39254. Logger.prototype.error = function () {
  39255. var args = [];
  39256. for (var _i = 0; _i < arguments.length; _i++) {
  39257. args[_i] = arguments[_i];
  39258. }
  39259. this.log(this.globalLogError, args);
  39260. };
  39261. Logger.prototype.globalLogWarn = function (message) {
  39262. if (window.console && window.console.warn) {
  39263. window.console.warn(message);
  39264. }
  39265. else {
  39266. this.globalLog(message);
  39267. }
  39268. };
  39269. Logger.prototype.globalLogError = function (message) {
  39270. if (window.console && window.console.error) {
  39271. window.console.error(message);
  39272. }
  39273. else {
  39274. this.globalLogWarn(message);
  39275. }
  39276. };
  39277. Logger.prototype.log = function (defaultLoggingFunction) {
  39278. var args = [];
  39279. for (var _i = 1; _i < arguments.length; _i++) {
  39280. args[_i - 1] = arguments[_i];
  39281. }
  39282. var message = stringify.apply(this, arguments);
  39283. if (core_pusher.log) {
  39284. core_pusher.log(message);
  39285. }
  39286. else if (core_pusher.logToConsole) {
  39287. var log = defaultLoggingFunction.bind(this);
  39288. log(message);
  39289. }
  39290. };
  39291. return Logger;
  39292. }());
  39293. /* harmony default export */ var logger = (new logger_Logger());
  39294. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39295. var urlStore = {
  39296. baseUrl: "https://pusher.com",
  39297. urls: {
  39298. authenticationEndpoint: {
  39299. path: "/docs/authenticating_users",
  39300. },
  39301. javascriptQuickStart: {
  39302. path: "/docs/javascript_quick_start"
  39303. },
  39304. triggeringClientEvents: {
  39305. path: "/docs/client_api_guide/client_events#trigger-events"
  39306. }
  39307. }
  39308. };
  39309. var buildLogSuffix = function (key) {
  39310. var urlPrefix = "See:";
  39311. var urlObj = urlStore.urls[key];
  39312. if (!urlObj)
  39313. return "";
  39314. var url;
  39315. if (urlObj.fullUrl) {
  39316. url = urlObj.fullUrl;
  39317. }
  39318. else if (urlObj.path) {
  39319. url = urlStore.baseUrl + urlObj.path;
  39320. }
  39321. if (!url)
  39322. return "";
  39323. return urlPrefix + " " + url;
  39324. };
  39325. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39326. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39327. var ajax = function (context, socketId, callback) {
  39328. var self = this, xhr;
  39329. xhr = runtime.createXHR();
  39330. xhr.open("POST", self.options.authEndpoint, true);
  39331. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39332. for (var headerName in this.authOptions.headers) {
  39333. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39334. }
  39335. xhr.onreadystatechange = function () {
  39336. if (xhr.readyState === 4) {
  39337. if (xhr.status === 200) {
  39338. var data, parsed = false;
  39339. try {
  39340. data = JSON.parse(xhr.responseText);
  39341. parsed = true;
  39342. }
  39343. catch (e) {
  39344. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39345. }
  39346. if (parsed) {
  39347. callback(false, data);
  39348. }
  39349. }
  39350. else {
  39351. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39352. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39353. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39354. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39355. callback(true, xhr.status);
  39356. }
  39357. }
  39358. };
  39359. xhr.send(this.composeQuery(socketId));
  39360. return xhr;
  39361. };
  39362. /* harmony default export */ var xhr_auth = (ajax);
  39363. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39364. var jsonp = function (context, socketId, callback) {
  39365. if (this.authOptions.headers !== undefined) {
  39366. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39367. }
  39368. var callbackName = context.nextAuthCallbackID.toString();
  39369. context.nextAuthCallbackID++;
  39370. var document = context.getDocument();
  39371. var script = document.createElement("script");
  39372. context.auth_callbacks[callbackName] = function (data) {
  39373. callback(false, data);
  39374. };
  39375. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39376. script.src = this.options.authEndpoint +
  39377. '?callback=' +
  39378. encodeURIComponent(callback_name) +
  39379. '&' +
  39380. this.composeQuery(socketId);
  39381. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39382. head.insertBefore(script, head.firstChild);
  39383. };
  39384. /* harmony default export */ var jsonp_auth = (jsonp);
  39385. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39386. var ScriptRequest = (function () {
  39387. function ScriptRequest(src) {
  39388. this.src = src;
  39389. }
  39390. ScriptRequest.prototype.send = function (receiver) {
  39391. var self = this;
  39392. var errorString = "Error loading " + self.src;
  39393. self.script = document.createElement("script");
  39394. self.script.id = receiver.id;
  39395. self.script.src = self.src;
  39396. self.script.type = "text/javascript";
  39397. self.script.charset = "UTF-8";
  39398. if (self.script.addEventListener) {
  39399. self.script.onerror = function () {
  39400. receiver.callback(errorString);
  39401. };
  39402. self.script.onload = function () {
  39403. receiver.callback(null);
  39404. };
  39405. }
  39406. else {
  39407. self.script.onreadystatechange = function () {
  39408. if (self.script.readyState === 'loaded' ||
  39409. self.script.readyState === 'complete') {
  39410. receiver.callback(null);
  39411. }
  39412. };
  39413. }
  39414. if (self.script.async === undefined && document.attachEvent &&
  39415. /opera/i.test(navigator.userAgent)) {
  39416. self.errorScript = document.createElement("script");
  39417. self.errorScript.id = receiver.id + "_error";
  39418. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39419. self.script.async = self.errorScript.async = false;
  39420. }
  39421. else {
  39422. self.script.async = true;
  39423. }
  39424. var head = document.getElementsByTagName('head')[0];
  39425. head.insertBefore(self.script, head.firstChild);
  39426. if (self.errorScript) {
  39427. head.insertBefore(self.errorScript, self.script.nextSibling);
  39428. }
  39429. };
  39430. ScriptRequest.prototype.cleanup = function () {
  39431. if (this.script) {
  39432. this.script.onload = this.script.onerror = null;
  39433. this.script.onreadystatechange = null;
  39434. }
  39435. if (this.script && this.script.parentNode) {
  39436. this.script.parentNode.removeChild(this.script);
  39437. }
  39438. if (this.errorScript && this.errorScript.parentNode) {
  39439. this.errorScript.parentNode.removeChild(this.errorScript);
  39440. }
  39441. this.script = null;
  39442. this.errorScript = null;
  39443. };
  39444. return ScriptRequest;
  39445. }());
  39446. /* harmony default export */ var script_request = (ScriptRequest);
  39447. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39448. var jsonp_request_JSONPRequest = (function () {
  39449. function JSONPRequest(url, data) {
  39450. this.url = url;
  39451. this.data = data;
  39452. }
  39453. JSONPRequest.prototype.send = function (receiver) {
  39454. if (this.request) {
  39455. return;
  39456. }
  39457. var query = buildQueryString(this.data);
  39458. var url = this.url + "/" + receiver.number + "?" + query;
  39459. this.request = runtime.createScriptRequest(url);
  39460. this.request.send(receiver);
  39461. };
  39462. JSONPRequest.prototype.cleanup = function () {
  39463. if (this.request) {
  39464. this.request.cleanup();
  39465. }
  39466. };
  39467. return JSONPRequest;
  39468. }());
  39469. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39470. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39471. var getAgent = function (sender, useTLS) {
  39472. return function (data, callback) {
  39473. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39474. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39475. var request = runtime.createJSONPRequest(url, data);
  39476. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39477. ScriptReceivers.remove(receiver);
  39478. request.cleanup();
  39479. if (result && result.host) {
  39480. sender.host = result.host;
  39481. }
  39482. if (callback) {
  39483. callback(error, result);
  39484. }
  39485. });
  39486. request.send(receiver);
  39487. };
  39488. };
  39489. var jsonp_timeline_jsonp = {
  39490. name: 'jsonp',
  39491. getAgent: getAgent
  39492. };
  39493. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39494. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39495. function getGenericURL(baseScheme, params, path) {
  39496. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39497. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39498. return scheme + "://" + host + path;
  39499. }
  39500. function getGenericPath(key, queryString) {
  39501. var path = "/app/" + key;
  39502. var query = "?protocol=" + defaults.PROTOCOL +
  39503. "&client=js" +
  39504. "&version=" + defaults.VERSION +
  39505. (queryString ? ("&" + queryString) : "");
  39506. return path + query;
  39507. }
  39508. var ws = {
  39509. getInitial: function (key, params) {
  39510. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39511. return getGenericURL("ws", params, path);
  39512. }
  39513. };
  39514. var http = {
  39515. getInitial: function (key, params) {
  39516. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39517. return getGenericURL("http", params, path);
  39518. }
  39519. };
  39520. var sockjs = {
  39521. getInitial: function (key, params) {
  39522. return getGenericURL("http", params, params.httpPath || "/pusher");
  39523. },
  39524. getPath: function (key, params) {
  39525. return getGenericPath(key);
  39526. }
  39527. };
  39528. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39529. var callback_registry_CallbackRegistry = (function () {
  39530. function CallbackRegistry() {
  39531. this._callbacks = {};
  39532. }
  39533. CallbackRegistry.prototype.get = function (name) {
  39534. return this._callbacks[prefix(name)];
  39535. };
  39536. CallbackRegistry.prototype.add = function (name, callback, context) {
  39537. var prefixedEventName = prefix(name);
  39538. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39539. this._callbacks[prefixedEventName].push({
  39540. fn: callback,
  39541. context: context
  39542. });
  39543. };
  39544. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39545. if (!name && !callback && !context) {
  39546. this._callbacks = {};
  39547. return;
  39548. }
  39549. var names = name ? [prefix(name)] : keys(this._callbacks);
  39550. if (callback || context) {
  39551. this.removeCallback(names, callback, context);
  39552. }
  39553. else {
  39554. this.removeAllCallbacks(names);
  39555. }
  39556. };
  39557. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39558. apply(names, function (name) {
  39559. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39560. return (callback && callback !== binding.fn) ||
  39561. (context && context !== binding.context);
  39562. });
  39563. if (this._callbacks[name].length === 0) {
  39564. delete this._callbacks[name];
  39565. }
  39566. }, this);
  39567. };
  39568. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39569. apply(names, function (name) {
  39570. delete this._callbacks[name];
  39571. }, this);
  39572. };
  39573. return CallbackRegistry;
  39574. }());
  39575. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39576. function prefix(name) {
  39577. return "_" + name;
  39578. }
  39579. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39580. var dispatcher_Dispatcher = (function () {
  39581. function Dispatcher(failThrough) {
  39582. this.callbacks = new callback_registry();
  39583. this.global_callbacks = [];
  39584. this.failThrough = failThrough;
  39585. }
  39586. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39587. this.callbacks.add(eventName, callback, context);
  39588. return this;
  39589. };
  39590. Dispatcher.prototype.bind_global = function (callback) {
  39591. this.global_callbacks.push(callback);
  39592. return this;
  39593. };
  39594. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39595. this.callbacks.remove(eventName, callback, context);
  39596. return this;
  39597. };
  39598. Dispatcher.prototype.unbind_global = function (callback) {
  39599. if (!callback) {
  39600. this.global_callbacks = [];
  39601. return this;
  39602. }
  39603. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39604. return this;
  39605. };
  39606. Dispatcher.prototype.unbind_all = function () {
  39607. this.unbind();
  39608. this.unbind_global();
  39609. return this;
  39610. };
  39611. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39612. for (var i = 0; i < this.global_callbacks.length; i++) {
  39613. this.global_callbacks[i](eventName, data);
  39614. }
  39615. var callbacks = this.callbacks.get(eventName);
  39616. var args = [];
  39617. if (metadata) {
  39618. args.push(data, metadata);
  39619. }
  39620. else if (data) {
  39621. args.push(data);
  39622. }
  39623. if (callbacks && callbacks.length > 0) {
  39624. for (var i = 0; i < callbacks.length; i++) {
  39625. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39626. }
  39627. }
  39628. else if (this.failThrough) {
  39629. this.failThrough(eventName, data);
  39630. }
  39631. return this;
  39632. };
  39633. return Dispatcher;
  39634. }());
  39635. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39636. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39637. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39638. var extendStatics = function (d, b) {
  39639. extendStatics = Object.setPrototypeOf ||
  39640. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39641. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39642. return extendStatics(d, b);
  39643. };
  39644. return function (d, b) {
  39645. extendStatics(d, b);
  39646. function __() { this.constructor = d; }
  39647. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39648. };
  39649. })();
  39650. var transport_connection_TransportConnection = (function (_super) {
  39651. transport_connection_extends(TransportConnection, _super);
  39652. function TransportConnection(hooks, name, priority, key, options) {
  39653. var _this = _super.call(this) || this;
  39654. _this.initialize = runtime.transportConnectionInitializer;
  39655. _this.hooks = hooks;
  39656. _this.name = name;
  39657. _this.priority = priority;
  39658. _this.key = key;
  39659. _this.options = options;
  39660. _this.state = "new";
  39661. _this.timeline = options.timeline;
  39662. _this.activityTimeout = options.activityTimeout;
  39663. _this.id = _this.timeline.generateUniqueID();
  39664. return _this;
  39665. }
  39666. TransportConnection.prototype.handlesActivityChecks = function () {
  39667. return Boolean(this.hooks.handlesActivityChecks);
  39668. };
  39669. TransportConnection.prototype.supportsPing = function () {
  39670. return Boolean(this.hooks.supportsPing);
  39671. };
  39672. TransportConnection.prototype.connect = function () {
  39673. var _this = this;
  39674. if (this.socket || this.state !== "initialized") {
  39675. return false;
  39676. }
  39677. var url = this.hooks.urls.getInitial(this.key, this.options);
  39678. try {
  39679. this.socket = this.hooks.getSocket(url, this.options);
  39680. }
  39681. catch (e) {
  39682. util.defer(function () {
  39683. _this.onError(e);
  39684. _this.changeState("closed");
  39685. });
  39686. return false;
  39687. }
  39688. this.bindListeners();
  39689. logger.debug("Connecting", { transport: this.name, url: url });
  39690. this.changeState("connecting");
  39691. return true;
  39692. };
  39693. TransportConnection.prototype.close = function () {
  39694. if (this.socket) {
  39695. this.socket.close();
  39696. return true;
  39697. }
  39698. else {
  39699. return false;
  39700. }
  39701. };
  39702. TransportConnection.prototype.send = function (data) {
  39703. var _this = this;
  39704. if (this.state === "open") {
  39705. util.defer(function () {
  39706. if (_this.socket) {
  39707. _this.socket.send(data);
  39708. }
  39709. });
  39710. return true;
  39711. }
  39712. else {
  39713. return false;
  39714. }
  39715. };
  39716. TransportConnection.prototype.ping = function () {
  39717. if (this.state === "open" && this.supportsPing()) {
  39718. this.socket.ping();
  39719. }
  39720. };
  39721. TransportConnection.prototype.onOpen = function () {
  39722. if (this.hooks.beforeOpen) {
  39723. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39724. }
  39725. this.changeState("open");
  39726. this.socket.onopen = undefined;
  39727. };
  39728. TransportConnection.prototype.onError = function (error) {
  39729. this.emit("error", { type: 'WebSocketError', error: error });
  39730. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39731. };
  39732. TransportConnection.prototype.onClose = function (closeEvent) {
  39733. if (closeEvent) {
  39734. this.changeState("closed", {
  39735. code: closeEvent.code,
  39736. reason: closeEvent.reason,
  39737. wasClean: closeEvent.wasClean
  39738. });
  39739. }
  39740. else {
  39741. this.changeState("closed");
  39742. }
  39743. this.unbindListeners();
  39744. this.socket = undefined;
  39745. };
  39746. TransportConnection.prototype.onMessage = function (message) {
  39747. this.emit("message", message);
  39748. };
  39749. TransportConnection.prototype.onActivity = function () {
  39750. this.emit("activity");
  39751. };
  39752. TransportConnection.prototype.bindListeners = function () {
  39753. var _this = this;
  39754. this.socket.onopen = function () {
  39755. _this.onOpen();
  39756. };
  39757. this.socket.onerror = function (error) {
  39758. _this.onError(error);
  39759. };
  39760. this.socket.onclose = function (closeEvent) {
  39761. _this.onClose(closeEvent);
  39762. };
  39763. this.socket.onmessage = function (message) {
  39764. _this.onMessage(message);
  39765. };
  39766. if (this.supportsPing()) {
  39767. this.socket.onactivity = function () { _this.onActivity(); };
  39768. }
  39769. };
  39770. TransportConnection.prototype.unbindListeners = function () {
  39771. if (this.socket) {
  39772. this.socket.onopen = undefined;
  39773. this.socket.onerror = undefined;
  39774. this.socket.onclose = undefined;
  39775. this.socket.onmessage = undefined;
  39776. if (this.supportsPing()) {
  39777. this.socket.onactivity = undefined;
  39778. }
  39779. }
  39780. };
  39781. TransportConnection.prototype.changeState = function (state, params) {
  39782. this.state = state;
  39783. this.timeline.info(this.buildTimelineMessage({
  39784. state: state,
  39785. params: params
  39786. }));
  39787. this.emit(state, params);
  39788. };
  39789. TransportConnection.prototype.buildTimelineMessage = function (message) {
  39790. return extend({ cid: this.id }, message);
  39791. };
  39792. return TransportConnection;
  39793. }(dispatcher));
  39794. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  39795. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  39796. var transport_Transport = (function () {
  39797. function Transport(hooks) {
  39798. this.hooks = hooks;
  39799. }
  39800. Transport.prototype.isSupported = function (environment) {
  39801. return this.hooks.isSupported(environment);
  39802. };
  39803. Transport.prototype.createConnection = function (name, priority, key, options) {
  39804. return new transport_connection(this.hooks, name, priority, key, options);
  39805. };
  39806. return Transport;
  39807. }());
  39808. /* harmony default export */ var transports_transport = (transport_Transport);
  39809. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  39810. var WSTransport = new transports_transport({
  39811. urls: ws,
  39812. handlesActivityChecks: false,
  39813. supportsPing: false,
  39814. isInitialized: function () {
  39815. return Boolean(runtime.getWebSocketAPI());
  39816. },
  39817. isSupported: function () {
  39818. return Boolean(runtime.getWebSocketAPI());
  39819. },
  39820. getSocket: function (url) {
  39821. return runtime.createWebSocket(url);
  39822. }
  39823. });
  39824. var httpConfiguration = {
  39825. urls: http,
  39826. handlesActivityChecks: false,
  39827. supportsPing: true,
  39828. isInitialized: function () {
  39829. return true;
  39830. }
  39831. };
  39832. var streamingConfiguration = extend({ getSocket: function (url) {
  39833. return runtime.HTTPFactory.createStreamingSocket(url);
  39834. }
  39835. }, httpConfiguration);
  39836. var pollingConfiguration = extend({ getSocket: function (url) {
  39837. return runtime.HTTPFactory.createPollingSocket(url);
  39838. }
  39839. }, httpConfiguration);
  39840. var xhrConfiguration = {
  39841. isSupported: function () {
  39842. return runtime.isXHRSupported();
  39843. }
  39844. };
  39845. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  39846. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  39847. var Transports = {
  39848. ws: WSTransport,
  39849. xhr_streaming: XHRStreamingTransport,
  39850. xhr_polling: XHRPollingTransport
  39851. };
  39852. /* harmony default export */ var transports = (Transports);
  39853. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  39854. var SockJSTransport = new transports_transport({
  39855. file: "sockjs",
  39856. urls: sockjs,
  39857. handlesActivityChecks: true,
  39858. supportsPing: false,
  39859. isSupported: function () {
  39860. return true;
  39861. },
  39862. isInitialized: function () {
  39863. return window.SockJS !== undefined;
  39864. },
  39865. getSocket: function (url, options) {
  39866. return new window.SockJS(url, null, {
  39867. js_path: Dependencies.getPath("sockjs", {
  39868. useTLS: options.useTLS
  39869. }),
  39870. ignore_null_origin: options.ignoreNullOrigin
  39871. });
  39872. },
  39873. beforeOpen: function (socket, path) {
  39874. socket.send(JSON.stringify({
  39875. path: path
  39876. }));
  39877. }
  39878. });
  39879. var xdrConfiguration = {
  39880. isSupported: function (environment) {
  39881. var yes = runtime.isXDRSupported(environment.useTLS);
  39882. return yes;
  39883. }
  39884. };
  39885. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  39886. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  39887. transports.xdr_streaming = XDRStreamingTransport;
  39888. transports.xdr_polling = XDRPollingTransport;
  39889. transports.sockjs = SockJSTransport;
  39890. /* harmony default export */ var transports_transports = (transports);
  39891. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  39892. var net_info_extends = (undefined && undefined.__extends) || (function () {
  39893. var extendStatics = function (d, b) {
  39894. extendStatics = Object.setPrototypeOf ||
  39895. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39896. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39897. return extendStatics(d, b);
  39898. };
  39899. return function (d, b) {
  39900. extendStatics(d, b);
  39901. function __() { this.constructor = d; }
  39902. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39903. };
  39904. })();
  39905. var NetInfo = (function (_super) {
  39906. net_info_extends(NetInfo, _super);
  39907. function NetInfo() {
  39908. var _this = _super.call(this) || this;
  39909. var self = _this;
  39910. if (window.addEventListener !== undefined) {
  39911. window.addEventListener("online", function () {
  39912. self.emit('online');
  39913. }, false);
  39914. window.addEventListener("offline", function () {
  39915. self.emit('offline');
  39916. }, false);
  39917. }
  39918. return _this;
  39919. }
  39920. NetInfo.prototype.isOnline = function () {
  39921. if (window.navigator.onLine === undefined) {
  39922. return true;
  39923. }
  39924. else {
  39925. return window.navigator.onLine;
  39926. }
  39927. };
  39928. return NetInfo;
  39929. }(dispatcher));
  39930. var net_info_Network = new NetInfo();
  39931. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  39932. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  39933. function AssistantToTheTransportManager(manager, transport, options) {
  39934. this.manager = manager;
  39935. this.transport = transport;
  39936. this.minPingDelay = options.minPingDelay;
  39937. this.maxPingDelay = options.maxPingDelay;
  39938. this.pingDelay = undefined;
  39939. }
  39940. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  39941. var _this = this;
  39942. options = extend({}, options, {
  39943. activityTimeout: this.pingDelay
  39944. });
  39945. var connection = this.transport.createConnection(name, priority, key, options);
  39946. var openTimestamp = null;
  39947. var onOpen = function () {
  39948. connection.unbind("open", onOpen);
  39949. connection.bind("closed", onClosed);
  39950. openTimestamp = util.now();
  39951. };
  39952. var onClosed = function (closeEvent) {
  39953. connection.unbind("closed", onClosed);
  39954. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  39955. _this.manager.reportDeath();
  39956. }
  39957. else if (!closeEvent.wasClean && openTimestamp) {
  39958. var lifespan = util.now() - openTimestamp;
  39959. if (lifespan < 2 * _this.maxPingDelay) {
  39960. _this.manager.reportDeath();
  39961. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  39962. }
  39963. }
  39964. };
  39965. connection.bind("open", onOpen);
  39966. return connection;
  39967. };
  39968. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  39969. return this.manager.isAlive() && this.transport.isSupported(environment);
  39970. };
  39971. return AssistantToTheTransportManager;
  39972. }());
  39973. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  39974. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  39975. var Protocol = {
  39976. decodeMessage: function (messageEvent) {
  39977. try {
  39978. var messageData = JSON.parse(messageEvent.data);
  39979. var pusherEventData = messageData.data;
  39980. if (typeof pusherEventData === 'string') {
  39981. try {
  39982. pusherEventData = JSON.parse(messageData.data);
  39983. }
  39984. catch (e) { }
  39985. }
  39986. var pusherEvent = {
  39987. event: messageData.event,
  39988. channel: messageData.channel,
  39989. data: pusherEventData,
  39990. };
  39991. if (messageData.user_id) {
  39992. pusherEvent.user_id = messageData.user_id;
  39993. }
  39994. return pusherEvent;
  39995. }
  39996. catch (e) {
  39997. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  39998. }
  39999. },
  40000. encodeMessage: function (event) {
  40001. return JSON.stringify(event);
  40002. },
  40003. processHandshake: function (messageEvent) {
  40004. var message = Protocol.decodeMessage(messageEvent);
  40005. if (message.event === "pusher:connection_established") {
  40006. if (!message.data.activity_timeout) {
  40007. throw "No activity timeout specified in handshake";
  40008. }
  40009. return {
  40010. action: "connected",
  40011. id: message.data.socket_id,
  40012. activityTimeout: message.data.activity_timeout * 1000
  40013. };
  40014. }
  40015. else if (message.event === "pusher:error") {
  40016. return {
  40017. action: this.getCloseAction(message.data),
  40018. error: this.getCloseError(message.data)
  40019. };
  40020. }
  40021. else {
  40022. throw "Invalid handshake";
  40023. }
  40024. },
  40025. getCloseAction: function (closeEvent) {
  40026. if (closeEvent.code < 4000) {
  40027. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40028. return "backoff";
  40029. }
  40030. else {
  40031. return null;
  40032. }
  40033. }
  40034. else if (closeEvent.code === 4000) {
  40035. return "tls_only";
  40036. }
  40037. else if (closeEvent.code < 4100) {
  40038. return "refused";
  40039. }
  40040. else if (closeEvent.code < 4200) {
  40041. return "backoff";
  40042. }
  40043. else if (closeEvent.code < 4300) {
  40044. return "retry";
  40045. }
  40046. else {
  40047. return "refused";
  40048. }
  40049. },
  40050. getCloseError: function (closeEvent) {
  40051. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40052. return {
  40053. type: 'PusherError',
  40054. data: {
  40055. code: closeEvent.code,
  40056. message: closeEvent.reason || closeEvent.message
  40057. }
  40058. };
  40059. }
  40060. else {
  40061. return null;
  40062. }
  40063. }
  40064. };
  40065. /* harmony default export */ var protocol_protocol = (Protocol);
  40066. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40067. var connection_extends = (undefined && undefined.__extends) || (function () {
  40068. var extendStatics = function (d, b) {
  40069. extendStatics = Object.setPrototypeOf ||
  40070. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40071. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40072. return extendStatics(d, b);
  40073. };
  40074. return function (d, b) {
  40075. extendStatics(d, b);
  40076. function __() { this.constructor = d; }
  40077. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40078. };
  40079. })();
  40080. var connection_Connection = (function (_super) {
  40081. connection_extends(Connection, _super);
  40082. function Connection(id, transport) {
  40083. var _this = _super.call(this) || this;
  40084. _this.id = id;
  40085. _this.transport = transport;
  40086. _this.activityTimeout = transport.activityTimeout;
  40087. _this.bindListeners();
  40088. return _this;
  40089. }
  40090. Connection.prototype.handlesActivityChecks = function () {
  40091. return this.transport.handlesActivityChecks();
  40092. };
  40093. Connection.prototype.send = function (data) {
  40094. return this.transport.send(data);
  40095. };
  40096. Connection.prototype.send_event = function (name, data, channel) {
  40097. var event = { event: name, data: data };
  40098. if (channel) {
  40099. event.channel = channel;
  40100. }
  40101. logger.debug('Event sent', event);
  40102. return this.send(protocol_protocol.encodeMessage(event));
  40103. };
  40104. Connection.prototype.ping = function () {
  40105. if (this.transport.supportsPing()) {
  40106. this.transport.ping();
  40107. }
  40108. else {
  40109. this.send_event('pusher:ping', {});
  40110. }
  40111. };
  40112. Connection.prototype.close = function () {
  40113. this.transport.close();
  40114. };
  40115. Connection.prototype.bindListeners = function () {
  40116. var _this = this;
  40117. var listeners = {
  40118. message: function (messageEvent) {
  40119. var pusherEvent;
  40120. try {
  40121. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40122. }
  40123. catch (e) {
  40124. _this.emit('error', {
  40125. type: 'MessageParseError',
  40126. error: e,
  40127. data: messageEvent.data
  40128. });
  40129. }
  40130. if (pusherEvent !== undefined) {
  40131. logger.debug('Event recd', pusherEvent);
  40132. switch (pusherEvent.event) {
  40133. case 'pusher:error':
  40134. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40135. break;
  40136. case 'pusher:ping':
  40137. _this.emit("ping");
  40138. break;
  40139. case 'pusher:pong':
  40140. _this.emit("pong");
  40141. break;
  40142. }
  40143. _this.emit('message', pusherEvent);
  40144. }
  40145. },
  40146. activity: function () {
  40147. _this.emit("activity");
  40148. },
  40149. error: function (error) {
  40150. _this.emit("error", { type: "WebSocketError", error: error });
  40151. },
  40152. closed: function (closeEvent) {
  40153. unbindListeners();
  40154. if (closeEvent && closeEvent.code) {
  40155. _this.handleCloseEvent(closeEvent);
  40156. }
  40157. _this.transport = null;
  40158. _this.emit("closed");
  40159. }
  40160. };
  40161. var unbindListeners = function () {
  40162. objectApply(listeners, function (listener, event) {
  40163. _this.transport.unbind(event, listener);
  40164. });
  40165. };
  40166. objectApply(listeners, function (listener, event) {
  40167. _this.transport.bind(event, listener);
  40168. });
  40169. };
  40170. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40171. var action = protocol_protocol.getCloseAction(closeEvent);
  40172. var error = protocol_protocol.getCloseError(closeEvent);
  40173. if (error) {
  40174. this.emit('error', error);
  40175. }
  40176. if (action) {
  40177. this.emit(action, { action: action, error: error });
  40178. }
  40179. };
  40180. return Connection;
  40181. }(dispatcher));
  40182. /* harmony default export */ var connection_connection = (connection_Connection);
  40183. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40184. var handshake_Handshake = (function () {
  40185. function Handshake(transport, callback) {
  40186. this.transport = transport;
  40187. this.callback = callback;
  40188. this.bindListeners();
  40189. }
  40190. Handshake.prototype.close = function () {
  40191. this.unbindListeners();
  40192. this.transport.close();
  40193. };
  40194. Handshake.prototype.bindListeners = function () {
  40195. var _this = this;
  40196. this.onMessage = function (m) {
  40197. _this.unbindListeners();
  40198. var result;
  40199. try {
  40200. result = protocol_protocol.processHandshake(m);
  40201. }
  40202. catch (e) {
  40203. _this.finish("error", { error: e });
  40204. _this.transport.close();
  40205. return;
  40206. }
  40207. if (result.action === "connected") {
  40208. _this.finish("connected", {
  40209. connection: new connection_connection(result.id, _this.transport),
  40210. activityTimeout: result.activityTimeout
  40211. });
  40212. }
  40213. else {
  40214. _this.finish(result.action, { error: result.error });
  40215. _this.transport.close();
  40216. }
  40217. };
  40218. this.onClosed = function (closeEvent) {
  40219. _this.unbindListeners();
  40220. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40221. var error = protocol_protocol.getCloseError(closeEvent);
  40222. _this.finish(action, { error: error });
  40223. };
  40224. this.transport.bind("message", this.onMessage);
  40225. this.transport.bind("closed", this.onClosed);
  40226. };
  40227. Handshake.prototype.unbindListeners = function () {
  40228. this.transport.unbind("message", this.onMessage);
  40229. this.transport.unbind("closed", this.onClosed);
  40230. };
  40231. Handshake.prototype.finish = function (action, params) {
  40232. this.callback(extend({ transport: this.transport, action: action }, params));
  40233. };
  40234. return Handshake;
  40235. }());
  40236. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40237. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40238. var pusher_authorizer_PusherAuthorizer = (function () {
  40239. function PusherAuthorizer(channel, options) {
  40240. this.channel = channel;
  40241. var authTransport = options.authTransport;
  40242. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40243. throw "'" + authTransport + "' is not a recognized auth transport";
  40244. }
  40245. this.type = authTransport;
  40246. this.options = options;
  40247. this.authOptions = (options || {}).auth || {};
  40248. }
  40249. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40250. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40251. '&channel_name=' + encodeURIComponent(this.channel.name);
  40252. for (var i in this.authOptions.params) {
  40253. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40254. }
  40255. return query;
  40256. };
  40257. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40258. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40259. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40260. };
  40261. return PusherAuthorizer;
  40262. }());
  40263. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40264. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40265. var timeline_sender_TimelineSender = (function () {
  40266. function TimelineSender(timeline, options) {
  40267. this.timeline = timeline;
  40268. this.options = options || {};
  40269. }
  40270. TimelineSender.prototype.send = function (useTLS, callback) {
  40271. if (this.timeline.isEmpty()) {
  40272. return;
  40273. }
  40274. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40275. };
  40276. return TimelineSender;
  40277. }());
  40278. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40279. // CONCATENATED MODULE: ./src/core/errors.ts
  40280. var errors_extends = (undefined && undefined.__extends) || (function () {
  40281. var extendStatics = function (d, b) {
  40282. extendStatics = Object.setPrototypeOf ||
  40283. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40284. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40285. return extendStatics(d, b);
  40286. };
  40287. return function (d, b) {
  40288. extendStatics(d, b);
  40289. function __() { this.constructor = d; }
  40290. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40291. };
  40292. })();
  40293. var BadEventName = (function (_super) {
  40294. errors_extends(BadEventName, _super);
  40295. function BadEventName(msg) {
  40296. var _newTarget = this.constructor;
  40297. var _this = _super.call(this, msg) || this;
  40298. Object.setPrototypeOf(_this, _newTarget.prototype);
  40299. return _this;
  40300. }
  40301. return BadEventName;
  40302. }(Error));
  40303. var RequestTimedOut = (function (_super) {
  40304. errors_extends(RequestTimedOut, _super);
  40305. function RequestTimedOut(msg) {
  40306. var _newTarget = this.constructor;
  40307. var _this = _super.call(this, msg) || this;
  40308. Object.setPrototypeOf(_this, _newTarget.prototype);
  40309. return _this;
  40310. }
  40311. return RequestTimedOut;
  40312. }(Error));
  40313. var TransportPriorityTooLow = (function (_super) {
  40314. errors_extends(TransportPriorityTooLow, _super);
  40315. function TransportPriorityTooLow(msg) {
  40316. var _newTarget = this.constructor;
  40317. var _this = _super.call(this, msg) || this;
  40318. Object.setPrototypeOf(_this, _newTarget.prototype);
  40319. return _this;
  40320. }
  40321. return TransportPriorityTooLow;
  40322. }(Error));
  40323. var TransportClosed = (function (_super) {
  40324. errors_extends(TransportClosed, _super);
  40325. function TransportClosed(msg) {
  40326. var _newTarget = this.constructor;
  40327. var _this = _super.call(this, msg) || this;
  40328. Object.setPrototypeOf(_this, _newTarget.prototype);
  40329. return _this;
  40330. }
  40331. return TransportClosed;
  40332. }(Error));
  40333. var UnsupportedFeature = (function (_super) {
  40334. errors_extends(UnsupportedFeature, _super);
  40335. function UnsupportedFeature(msg) {
  40336. var _newTarget = this.constructor;
  40337. var _this = _super.call(this, msg) || this;
  40338. Object.setPrototypeOf(_this, _newTarget.prototype);
  40339. return _this;
  40340. }
  40341. return UnsupportedFeature;
  40342. }(Error));
  40343. var UnsupportedTransport = (function (_super) {
  40344. errors_extends(UnsupportedTransport, _super);
  40345. function UnsupportedTransport(msg) {
  40346. var _newTarget = this.constructor;
  40347. var _this = _super.call(this, msg) || this;
  40348. Object.setPrototypeOf(_this, _newTarget.prototype);
  40349. return _this;
  40350. }
  40351. return UnsupportedTransport;
  40352. }(Error));
  40353. var UnsupportedStrategy = (function (_super) {
  40354. errors_extends(UnsupportedStrategy, _super);
  40355. function UnsupportedStrategy(msg) {
  40356. var _newTarget = this.constructor;
  40357. var _this = _super.call(this, msg) || this;
  40358. Object.setPrototypeOf(_this, _newTarget.prototype);
  40359. return _this;
  40360. }
  40361. return UnsupportedStrategy;
  40362. }(Error));
  40363. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40364. var channel_extends = (undefined && undefined.__extends) || (function () {
  40365. var extendStatics = function (d, b) {
  40366. extendStatics = Object.setPrototypeOf ||
  40367. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40368. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40369. return extendStatics(d, b);
  40370. };
  40371. return function (d, b) {
  40372. extendStatics(d, b);
  40373. function __() { this.constructor = d; }
  40374. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40375. };
  40376. })();
  40377. var channel_Channel = (function (_super) {
  40378. channel_extends(Channel, _super);
  40379. function Channel(name, pusher) {
  40380. var _this = _super.call(this, function (event, data) {
  40381. logger.debug('No callbacks on ' + name + ' for ' + event);
  40382. }) || this;
  40383. _this.name = name;
  40384. _this.pusher = pusher;
  40385. _this.subscribed = false;
  40386. _this.subscriptionPending = false;
  40387. _this.subscriptionCancelled = false;
  40388. return _this;
  40389. }
  40390. Channel.prototype.authorize = function (socketId, callback) {
  40391. return callback(false, {});
  40392. };
  40393. Channel.prototype.trigger = function (event, data) {
  40394. if (event.indexOf("client-") !== 0) {
  40395. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40396. }
  40397. if (!this.subscribed) {
  40398. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40399. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40400. }
  40401. return this.pusher.send_event(event, data, this.name);
  40402. };
  40403. Channel.prototype.disconnect = function () {
  40404. this.subscribed = false;
  40405. this.subscriptionPending = false;
  40406. };
  40407. Channel.prototype.handleEvent = function (event) {
  40408. var eventName = event.event;
  40409. var data = event.data;
  40410. if (eventName === "pusher_internal:subscription_succeeded") {
  40411. this.handleSubscriptionSucceededEvent(event);
  40412. }
  40413. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40414. var metadata = {};
  40415. this.emit(eventName, data, metadata);
  40416. }
  40417. };
  40418. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40419. this.subscriptionPending = false;
  40420. this.subscribed = true;
  40421. if (this.subscriptionCancelled) {
  40422. this.pusher.unsubscribe(this.name);
  40423. }
  40424. else {
  40425. this.emit("pusher:subscription_succeeded", event.data);
  40426. }
  40427. };
  40428. Channel.prototype.subscribe = function () {
  40429. var _this = this;
  40430. if (this.subscribed) {
  40431. return;
  40432. }
  40433. this.subscriptionPending = true;
  40434. this.subscriptionCancelled = false;
  40435. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40436. if (error) {
  40437. logger.error(data);
  40438. _this.emit('pusher:subscription_error', data);
  40439. }
  40440. else {
  40441. _this.pusher.send_event('pusher:subscribe', {
  40442. auth: data.auth,
  40443. channel_data: data.channel_data,
  40444. channel: _this.name
  40445. });
  40446. }
  40447. });
  40448. };
  40449. Channel.prototype.unsubscribe = function () {
  40450. this.subscribed = false;
  40451. this.pusher.send_event('pusher:unsubscribe', {
  40452. channel: this.name
  40453. });
  40454. };
  40455. Channel.prototype.cancelSubscription = function () {
  40456. this.subscriptionCancelled = true;
  40457. };
  40458. Channel.prototype.reinstateSubscription = function () {
  40459. this.subscriptionCancelled = false;
  40460. };
  40461. return Channel;
  40462. }(dispatcher));
  40463. /* harmony default export */ var channels_channel = (channel_Channel);
  40464. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40465. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40466. var extendStatics = function (d, b) {
  40467. extendStatics = Object.setPrototypeOf ||
  40468. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40469. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40470. return extendStatics(d, b);
  40471. };
  40472. return function (d, b) {
  40473. extendStatics(d, b);
  40474. function __() { this.constructor = d; }
  40475. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40476. };
  40477. })();
  40478. var private_channel_PrivateChannel = (function (_super) {
  40479. private_channel_extends(PrivateChannel, _super);
  40480. function PrivateChannel() {
  40481. return _super !== null && _super.apply(this, arguments) || this;
  40482. }
  40483. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40484. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40485. return authorizer.authorize(socketId, callback);
  40486. };
  40487. return PrivateChannel;
  40488. }(channels_channel));
  40489. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40490. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40491. var members_Members = (function () {
  40492. function Members() {
  40493. this.reset();
  40494. }
  40495. Members.prototype.get = function (id) {
  40496. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40497. return {
  40498. id: id,
  40499. info: this.members[id]
  40500. };
  40501. }
  40502. else {
  40503. return null;
  40504. }
  40505. };
  40506. Members.prototype.each = function (callback) {
  40507. var _this = this;
  40508. objectApply(this.members, function (member, id) {
  40509. callback(_this.get(id));
  40510. });
  40511. };
  40512. Members.prototype.setMyID = function (id) {
  40513. this.myID = id;
  40514. };
  40515. Members.prototype.onSubscription = function (subscriptionData) {
  40516. this.members = subscriptionData.presence.hash;
  40517. this.count = subscriptionData.presence.count;
  40518. this.me = this.get(this.myID);
  40519. };
  40520. Members.prototype.addMember = function (memberData) {
  40521. if (this.get(memberData.user_id) === null) {
  40522. this.count++;
  40523. }
  40524. this.members[memberData.user_id] = memberData.user_info;
  40525. return this.get(memberData.user_id);
  40526. };
  40527. Members.prototype.removeMember = function (memberData) {
  40528. var member = this.get(memberData.user_id);
  40529. if (member) {
  40530. delete this.members[memberData.user_id];
  40531. this.count--;
  40532. }
  40533. return member;
  40534. };
  40535. Members.prototype.reset = function () {
  40536. this.members = {};
  40537. this.count = 0;
  40538. this.myID = null;
  40539. this.me = null;
  40540. };
  40541. return Members;
  40542. }());
  40543. /* harmony default export */ var members = (members_Members);
  40544. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40545. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40546. var extendStatics = function (d, b) {
  40547. extendStatics = Object.setPrototypeOf ||
  40548. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40549. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40550. return extendStatics(d, b);
  40551. };
  40552. return function (d, b) {
  40553. extendStatics(d, b);
  40554. function __() { this.constructor = d; }
  40555. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40556. };
  40557. })();
  40558. var presence_channel_PresenceChannel = (function (_super) {
  40559. presence_channel_extends(PresenceChannel, _super);
  40560. function PresenceChannel(name, pusher) {
  40561. var _this = _super.call(this, name, pusher) || this;
  40562. _this.members = new members();
  40563. return _this;
  40564. }
  40565. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40566. var _this = this;
  40567. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40568. if (!error) {
  40569. if (authData.channel_data === undefined) {
  40570. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40571. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40572. ("expected 'channel_data' field. " + suffix));
  40573. callback("Invalid auth response");
  40574. return;
  40575. }
  40576. var channelData = JSON.parse(authData.channel_data);
  40577. _this.members.setMyID(channelData.user_id);
  40578. }
  40579. callback(error, authData);
  40580. });
  40581. };
  40582. PresenceChannel.prototype.handleEvent = function (event) {
  40583. var eventName = event.event;
  40584. if (eventName.indexOf("pusher_internal:") === 0) {
  40585. this.handleInternalEvent(event);
  40586. }
  40587. else {
  40588. var data = event.data;
  40589. var metadata = {};
  40590. if (event.user_id) {
  40591. metadata.user_id = event.user_id;
  40592. }
  40593. this.emit(eventName, data, metadata);
  40594. }
  40595. };
  40596. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40597. var eventName = event.event;
  40598. var data = event.data;
  40599. switch (eventName) {
  40600. case "pusher_internal:subscription_succeeded":
  40601. this.handleSubscriptionSucceededEvent(event);
  40602. break;
  40603. case "pusher_internal:member_added":
  40604. var addedMember = this.members.addMember(data);
  40605. this.emit('pusher:member_added', addedMember);
  40606. break;
  40607. case "pusher_internal:member_removed":
  40608. var removedMember = this.members.removeMember(data);
  40609. if (removedMember) {
  40610. this.emit('pusher:member_removed', removedMember);
  40611. }
  40612. break;
  40613. }
  40614. };
  40615. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40616. this.subscriptionPending = false;
  40617. this.subscribed = true;
  40618. if (this.subscriptionCancelled) {
  40619. this.pusher.unsubscribe(this.name);
  40620. }
  40621. else {
  40622. this.members.onSubscription(event.data);
  40623. this.emit("pusher:subscription_succeeded", this.members);
  40624. }
  40625. };
  40626. PresenceChannel.prototype.disconnect = function () {
  40627. this.members.reset();
  40628. _super.prototype.disconnect.call(this);
  40629. };
  40630. return PresenceChannel;
  40631. }(private_channel));
  40632. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40633. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40634. var nacl_fast = __webpack_require__(0);
  40635. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40636. var nacl_util = __webpack_require__(1);
  40637. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40638. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40639. var extendStatics = function (d, b) {
  40640. extendStatics = Object.setPrototypeOf ||
  40641. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40642. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40643. return extendStatics(d, b);
  40644. };
  40645. return function (d, b) {
  40646. extendStatics(d, b);
  40647. function __() { this.constructor = d; }
  40648. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40649. };
  40650. })();
  40651. var encrypted_channel_EncryptedChannel = (function (_super) {
  40652. encrypted_channel_extends(EncryptedChannel, _super);
  40653. function EncryptedChannel() {
  40654. var _this = _super !== null && _super.apply(this, arguments) || this;
  40655. _this.key = null;
  40656. return _this;
  40657. }
  40658. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40659. var _this = this;
  40660. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40661. if (error) {
  40662. callback(true, authData);
  40663. return;
  40664. }
  40665. var sharedSecret = authData["shared_secret"];
  40666. if (!sharedSecret) {
  40667. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40668. callback(true, errorMsg);
  40669. return;
  40670. }
  40671. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40672. delete authData["shared_secret"];
  40673. callback(false, authData);
  40674. });
  40675. };
  40676. EncryptedChannel.prototype.trigger = function (event, data) {
  40677. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40678. };
  40679. EncryptedChannel.prototype.handleEvent = function (event) {
  40680. var eventName = event.event;
  40681. var data = event.data;
  40682. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40683. _super.prototype.handleEvent.call(this, event);
  40684. return;
  40685. }
  40686. this.handleEncryptedEvent(eventName, data);
  40687. };
  40688. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40689. var _this = this;
  40690. if (!this.key) {
  40691. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40692. return;
  40693. }
  40694. if (!data.ciphertext || !data.nonce) {
  40695. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40696. return;
  40697. }
  40698. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40699. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40700. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40701. return;
  40702. }
  40703. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40704. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40705. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40706. return;
  40707. }
  40708. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40709. if (bytes === null) {
  40710. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40711. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40712. if (error) {
  40713. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40714. return;
  40715. }
  40716. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40717. if (bytes === null) {
  40718. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40719. return;
  40720. }
  40721. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40722. return;
  40723. });
  40724. return;
  40725. }
  40726. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40727. };
  40728. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40729. try {
  40730. this.emit(eventName, JSON.parse(data));
  40731. }
  40732. catch (e) {
  40733. this.emit(eventName, data);
  40734. }
  40735. return this;
  40736. };
  40737. return EncryptedChannel;
  40738. }(private_channel));
  40739. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  40740. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  40741. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  40742. var extendStatics = function (d, b) {
  40743. extendStatics = Object.setPrototypeOf ||
  40744. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40745. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40746. return extendStatics(d, b);
  40747. };
  40748. return function (d, b) {
  40749. extendStatics(d, b);
  40750. function __() { this.constructor = d; }
  40751. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40752. };
  40753. })();
  40754. var connection_manager_ConnectionManager = (function (_super) {
  40755. connection_manager_extends(ConnectionManager, _super);
  40756. function ConnectionManager(key, options) {
  40757. var _this = _super.call(this) || this;
  40758. _this.key = key;
  40759. _this.options = options || {};
  40760. _this.state = "initialized";
  40761. _this.connection = null;
  40762. _this.usingTLS = !!options.useTLS;
  40763. _this.timeline = _this.options.timeline;
  40764. _this.errorCallbacks = _this.buildErrorCallbacks();
  40765. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  40766. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  40767. var Network = runtime.getNetwork();
  40768. Network.bind("online", function () {
  40769. _this.timeline.info({ netinfo: "online" });
  40770. if (_this.state === "connecting" || _this.state === "unavailable") {
  40771. _this.retryIn(0);
  40772. }
  40773. });
  40774. Network.bind("offline", function () {
  40775. _this.timeline.info({ netinfo: "offline" });
  40776. if (_this.connection) {
  40777. _this.sendActivityCheck();
  40778. }
  40779. });
  40780. _this.updateStrategy();
  40781. return _this;
  40782. }
  40783. ConnectionManager.prototype.connect = function () {
  40784. if (this.connection || this.runner) {
  40785. return;
  40786. }
  40787. if (!this.strategy.isSupported()) {
  40788. this.updateState("failed");
  40789. return;
  40790. }
  40791. this.updateState("connecting");
  40792. this.startConnecting();
  40793. this.setUnavailableTimer();
  40794. };
  40795. ;
  40796. ConnectionManager.prototype.send = function (data) {
  40797. if (this.connection) {
  40798. return this.connection.send(data);
  40799. }
  40800. else {
  40801. return false;
  40802. }
  40803. };
  40804. ;
  40805. ConnectionManager.prototype.send_event = function (name, data, channel) {
  40806. if (this.connection) {
  40807. return this.connection.send_event(name, data, channel);
  40808. }
  40809. else {
  40810. return false;
  40811. }
  40812. };
  40813. ;
  40814. ConnectionManager.prototype.disconnect = function () {
  40815. this.disconnectInternally();
  40816. this.updateState("disconnected");
  40817. };
  40818. ;
  40819. ConnectionManager.prototype.isUsingTLS = function () {
  40820. return this.usingTLS;
  40821. };
  40822. ;
  40823. ConnectionManager.prototype.startConnecting = function () {
  40824. var _this = this;
  40825. var callback = function (error, handshake) {
  40826. if (error) {
  40827. _this.runner = _this.strategy.connect(0, callback);
  40828. }
  40829. else {
  40830. if (handshake.action === "error") {
  40831. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  40832. _this.timeline.error({ handshakeError: handshake.error });
  40833. }
  40834. else {
  40835. _this.abortConnecting();
  40836. _this.handshakeCallbacks[handshake.action](handshake);
  40837. }
  40838. }
  40839. };
  40840. this.runner = this.strategy.connect(0, callback);
  40841. };
  40842. ;
  40843. ConnectionManager.prototype.abortConnecting = function () {
  40844. if (this.runner) {
  40845. this.runner.abort();
  40846. this.runner = null;
  40847. }
  40848. };
  40849. ;
  40850. ConnectionManager.prototype.disconnectInternally = function () {
  40851. this.abortConnecting();
  40852. this.clearRetryTimer();
  40853. this.clearUnavailableTimer();
  40854. if (this.connection) {
  40855. var connection = this.abandonConnection();
  40856. connection.close();
  40857. }
  40858. };
  40859. ;
  40860. ConnectionManager.prototype.updateStrategy = function () {
  40861. this.strategy = this.options.getStrategy({
  40862. key: this.key,
  40863. timeline: this.timeline,
  40864. useTLS: this.usingTLS
  40865. });
  40866. };
  40867. ;
  40868. ConnectionManager.prototype.retryIn = function (delay) {
  40869. var _this = this;
  40870. this.timeline.info({ action: "retry", delay: delay });
  40871. if (delay > 0) {
  40872. this.emit("connecting_in", Math.round(delay / 1000));
  40873. }
  40874. this.retryTimer = new OneOffTimer(delay || 0, function () {
  40875. _this.disconnectInternally();
  40876. _this.connect();
  40877. });
  40878. };
  40879. ;
  40880. ConnectionManager.prototype.clearRetryTimer = function () {
  40881. if (this.retryTimer) {
  40882. this.retryTimer.ensureAborted();
  40883. this.retryTimer = null;
  40884. }
  40885. };
  40886. ;
  40887. ConnectionManager.prototype.setUnavailableTimer = function () {
  40888. var _this = this;
  40889. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  40890. _this.updateState("unavailable");
  40891. });
  40892. };
  40893. ;
  40894. ConnectionManager.prototype.clearUnavailableTimer = function () {
  40895. if (this.unavailableTimer) {
  40896. this.unavailableTimer.ensureAborted();
  40897. }
  40898. };
  40899. ;
  40900. ConnectionManager.prototype.sendActivityCheck = function () {
  40901. var _this = this;
  40902. this.stopActivityCheck();
  40903. this.connection.ping();
  40904. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  40905. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  40906. _this.retryIn(0);
  40907. });
  40908. };
  40909. ;
  40910. ConnectionManager.prototype.resetActivityCheck = function () {
  40911. var _this = this;
  40912. this.stopActivityCheck();
  40913. if (this.connection && !this.connection.handlesActivityChecks()) {
  40914. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  40915. _this.sendActivityCheck();
  40916. });
  40917. }
  40918. };
  40919. ;
  40920. ConnectionManager.prototype.stopActivityCheck = function () {
  40921. if (this.activityTimer) {
  40922. this.activityTimer.ensureAborted();
  40923. }
  40924. };
  40925. ;
  40926. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  40927. var _this = this;
  40928. return extend({}, errorCallbacks, {
  40929. message: function (message) {
  40930. _this.resetActivityCheck();
  40931. _this.emit('message', message);
  40932. },
  40933. ping: function () {
  40934. _this.send_event('pusher:pong', {});
  40935. },
  40936. activity: function () {
  40937. _this.resetActivityCheck();
  40938. },
  40939. error: function (error) {
  40940. _this.emit("error", { type: "WebSocketError", error: error });
  40941. },
  40942. closed: function () {
  40943. _this.abandonConnection();
  40944. if (_this.shouldRetry()) {
  40945. _this.retryIn(1000);
  40946. }
  40947. }
  40948. });
  40949. };
  40950. ;
  40951. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  40952. var _this = this;
  40953. return extend({}, errorCallbacks, {
  40954. connected: function (handshake) {
  40955. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  40956. _this.clearUnavailableTimer();
  40957. _this.setConnection(handshake.connection);
  40958. _this.socket_id = _this.connection.id;
  40959. _this.updateState("connected", { socket_id: _this.socket_id });
  40960. }
  40961. });
  40962. };
  40963. ;
  40964. ConnectionManager.prototype.buildErrorCallbacks = function () {
  40965. var _this = this;
  40966. var withErrorEmitted = function (callback) {
  40967. return function (result) {
  40968. if (result.error) {
  40969. _this.emit("error", { type: "WebSocketError", error: result.error });
  40970. }
  40971. callback(result);
  40972. };
  40973. };
  40974. return {
  40975. tls_only: withErrorEmitted(function () {
  40976. _this.usingTLS = true;
  40977. _this.updateStrategy();
  40978. _this.retryIn(0);
  40979. }),
  40980. refused: withErrorEmitted(function () {
  40981. _this.disconnect();
  40982. }),
  40983. backoff: withErrorEmitted(function () {
  40984. _this.retryIn(1000);
  40985. }),
  40986. retry: withErrorEmitted(function () {
  40987. _this.retryIn(0);
  40988. })
  40989. };
  40990. };
  40991. ;
  40992. ConnectionManager.prototype.setConnection = function (connection) {
  40993. this.connection = connection;
  40994. for (var event in this.connectionCallbacks) {
  40995. this.connection.bind(event, this.connectionCallbacks[event]);
  40996. }
  40997. this.resetActivityCheck();
  40998. };
  40999. ;
  41000. ConnectionManager.prototype.abandonConnection = function () {
  41001. if (!this.connection) {
  41002. return;
  41003. }
  41004. this.stopActivityCheck();
  41005. for (var event in this.connectionCallbacks) {
  41006. this.connection.unbind(event, this.connectionCallbacks[event]);
  41007. }
  41008. var connection = this.connection;
  41009. this.connection = null;
  41010. return connection;
  41011. };
  41012. ConnectionManager.prototype.updateState = function (newState, data) {
  41013. var previousState = this.state;
  41014. this.state = newState;
  41015. if (previousState !== newState) {
  41016. var newStateDescription = newState;
  41017. if (newStateDescription === "connected") {
  41018. newStateDescription += " with new socket ID " + data.socket_id;
  41019. }
  41020. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41021. this.timeline.info({ state: newState, params: data });
  41022. this.emit('state_change', { previous: previousState, current: newState });
  41023. this.emit(newState, data);
  41024. }
  41025. };
  41026. ConnectionManager.prototype.shouldRetry = function () {
  41027. return this.state === "connecting" || this.state === "connected";
  41028. };
  41029. return ConnectionManager;
  41030. }(dispatcher));
  41031. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41032. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41033. var channels_Channels = (function () {
  41034. function Channels() {
  41035. this.channels = {};
  41036. }
  41037. Channels.prototype.add = function (name, pusher) {
  41038. if (!this.channels[name]) {
  41039. this.channels[name] = createChannel(name, pusher);
  41040. }
  41041. return this.channels[name];
  41042. };
  41043. Channels.prototype.all = function () {
  41044. return values(this.channels);
  41045. };
  41046. Channels.prototype.find = function (name) {
  41047. return this.channels[name];
  41048. };
  41049. Channels.prototype.remove = function (name) {
  41050. var channel = this.channels[name];
  41051. delete this.channels[name];
  41052. return channel;
  41053. };
  41054. Channels.prototype.disconnect = function () {
  41055. objectApply(this.channels, function (channel) {
  41056. channel.disconnect();
  41057. });
  41058. };
  41059. return Channels;
  41060. }());
  41061. /* harmony default export */ var channels = (channels_Channels);
  41062. function createChannel(name, pusher) {
  41063. if (name.indexOf('private-encrypted-') === 0) {
  41064. if (false) { var errorMsg; }
  41065. return factory.createEncryptedChannel(name, pusher);
  41066. }
  41067. else if (name.indexOf('private-') === 0) {
  41068. return factory.createPrivateChannel(name, pusher);
  41069. }
  41070. else if (name.indexOf('presence-') === 0) {
  41071. return factory.createPresenceChannel(name, pusher);
  41072. }
  41073. else {
  41074. return factory.createChannel(name, pusher);
  41075. }
  41076. }
  41077. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41078. var Factory = {
  41079. createChannels: function () {
  41080. return new channels();
  41081. },
  41082. createConnectionManager: function (key, options) {
  41083. return new connection_manager(key, options);
  41084. },
  41085. createChannel: function (name, pusher) {
  41086. return new channels_channel(name, pusher);
  41087. },
  41088. createPrivateChannel: function (name, pusher) {
  41089. return new private_channel(name, pusher);
  41090. },
  41091. createPresenceChannel: function (name, pusher) {
  41092. return new presence_channel(name, pusher);
  41093. },
  41094. createEncryptedChannel: function (name, pusher) {
  41095. return new encrypted_channel(name, pusher);
  41096. },
  41097. createTimelineSender: function (timeline, options) {
  41098. return new timeline_sender(timeline, options);
  41099. },
  41100. createAuthorizer: function (channel, options) {
  41101. if (options.authorizer) {
  41102. return options.authorizer(channel, options);
  41103. }
  41104. return new pusher_authorizer(channel, options);
  41105. },
  41106. createHandshake: function (transport, callback) {
  41107. return new connection_handshake(transport, callback);
  41108. },
  41109. createAssistantToTheTransportManager: function (manager, transport, options) {
  41110. return new assistant_to_the_transport_manager(manager, transport, options);
  41111. }
  41112. };
  41113. /* harmony default export */ var factory = (Factory);
  41114. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41115. var transport_manager_TransportManager = (function () {
  41116. function TransportManager(options) {
  41117. this.options = options || {};
  41118. this.livesLeft = this.options.lives || Infinity;
  41119. }
  41120. TransportManager.prototype.getAssistant = function (transport) {
  41121. return factory.createAssistantToTheTransportManager(this, transport, {
  41122. minPingDelay: this.options.minPingDelay,
  41123. maxPingDelay: this.options.maxPingDelay
  41124. });
  41125. };
  41126. TransportManager.prototype.isAlive = function () {
  41127. return this.livesLeft > 0;
  41128. };
  41129. TransportManager.prototype.reportDeath = function () {
  41130. this.livesLeft -= 1;
  41131. };
  41132. return TransportManager;
  41133. }());
  41134. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41135. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41136. var sequential_strategy_SequentialStrategy = (function () {
  41137. function SequentialStrategy(strategies, options) {
  41138. this.strategies = strategies;
  41139. this.loop = Boolean(options.loop);
  41140. this.failFast = Boolean(options.failFast);
  41141. this.timeout = options.timeout;
  41142. this.timeoutLimit = options.timeoutLimit;
  41143. }
  41144. SequentialStrategy.prototype.isSupported = function () {
  41145. return any(this.strategies, util.method("isSupported"));
  41146. };
  41147. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41148. var _this = this;
  41149. var strategies = this.strategies;
  41150. var current = 0;
  41151. var timeout = this.timeout;
  41152. var runner = null;
  41153. var tryNextStrategy = function (error, handshake) {
  41154. if (handshake) {
  41155. callback(null, handshake);
  41156. }
  41157. else {
  41158. current = current + 1;
  41159. if (_this.loop) {
  41160. current = current % strategies.length;
  41161. }
  41162. if (current < strategies.length) {
  41163. if (timeout) {
  41164. timeout = timeout * 2;
  41165. if (_this.timeoutLimit) {
  41166. timeout = Math.min(timeout, _this.timeoutLimit);
  41167. }
  41168. }
  41169. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41170. }
  41171. else {
  41172. callback(true);
  41173. }
  41174. }
  41175. };
  41176. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41177. return {
  41178. abort: function () {
  41179. runner.abort();
  41180. },
  41181. forceMinPriority: function (p) {
  41182. minPriority = p;
  41183. if (runner) {
  41184. runner.forceMinPriority(p);
  41185. }
  41186. }
  41187. };
  41188. };
  41189. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41190. var timer = null;
  41191. var runner = null;
  41192. if (options.timeout > 0) {
  41193. timer = new OneOffTimer(options.timeout, function () {
  41194. runner.abort();
  41195. callback(true);
  41196. });
  41197. }
  41198. runner = strategy.connect(minPriority, function (error, handshake) {
  41199. if (error && timer && timer.isRunning() && !options.failFast) {
  41200. return;
  41201. }
  41202. if (timer) {
  41203. timer.ensureAborted();
  41204. }
  41205. callback(error, handshake);
  41206. });
  41207. return {
  41208. abort: function () {
  41209. if (timer) {
  41210. timer.ensureAborted();
  41211. }
  41212. runner.abort();
  41213. },
  41214. forceMinPriority: function (p) {
  41215. runner.forceMinPriority(p);
  41216. }
  41217. };
  41218. };
  41219. return SequentialStrategy;
  41220. }());
  41221. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41222. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41223. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41224. function BestConnectedEverStrategy(strategies) {
  41225. this.strategies = strategies;
  41226. }
  41227. BestConnectedEverStrategy.prototype.isSupported = function () {
  41228. return any(this.strategies, util.method("isSupported"));
  41229. };
  41230. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41231. return connect(this.strategies, minPriority, function (i, runners) {
  41232. return function (error, handshake) {
  41233. runners[i].error = error;
  41234. if (error) {
  41235. if (allRunnersFailed(runners)) {
  41236. callback(true);
  41237. }
  41238. return;
  41239. }
  41240. apply(runners, function (runner) {
  41241. runner.forceMinPriority(handshake.transport.priority);
  41242. });
  41243. callback(null, handshake);
  41244. };
  41245. });
  41246. };
  41247. return BestConnectedEverStrategy;
  41248. }());
  41249. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41250. function connect(strategies, minPriority, callbackBuilder) {
  41251. var runners = map(strategies, function (strategy, i, _, rs) {
  41252. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41253. });
  41254. return {
  41255. abort: function () {
  41256. apply(runners, abortRunner);
  41257. },
  41258. forceMinPriority: function (p) {
  41259. apply(runners, function (runner) {
  41260. runner.forceMinPriority(p);
  41261. });
  41262. }
  41263. };
  41264. }
  41265. function allRunnersFailed(runners) {
  41266. return collections_all(runners, function (runner) {
  41267. return Boolean(runner.error);
  41268. });
  41269. }
  41270. function abortRunner(runner) {
  41271. if (!runner.error && !runner.aborted) {
  41272. runner.abort();
  41273. runner.aborted = true;
  41274. }
  41275. }
  41276. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41277. var cached_strategy_CachedStrategy = (function () {
  41278. function CachedStrategy(strategy, transports, options) {
  41279. this.strategy = strategy;
  41280. this.transports = transports;
  41281. this.ttl = options.ttl || 1800 * 1000;
  41282. this.usingTLS = options.useTLS;
  41283. this.timeline = options.timeline;
  41284. }
  41285. CachedStrategy.prototype.isSupported = function () {
  41286. return this.strategy.isSupported();
  41287. };
  41288. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41289. var usingTLS = this.usingTLS;
  41290. var info = fetchTransportCache(usingTLS);
  41291. var strategies = [this.strategy];
  41292. if (info && info.timestamp + this.ttl >= util.now()) {
  41293. var transport = this.transports[info.transport];
  41294. if (transport) {
  41295. this.timeline.info({
  41296. cached: true,
  41297. transport: info.transport,
  41298. latency: info.latency
  41299. });
  41300. strategies.push(new sequential_strategy([transport], {
  41301. timeout: info.latency * 2 + 1000,
  41302. failFast: true
  41303. }));
  41304. }
  41305. }
  41306. var startTimestamp = util.now();
  41307. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41308. if (error) {
  41309. flushTransportCache(usingTLS);
  41310. if (strategies.length > 0) {
  41311. startTimestamp = util.now();
  41312. runner = strategies.pop().connect(minPriority, cb);
  41313. }
  41314. else {
  41315. callback(error);
  41316. }
  41317. }
  41318. else {
  41319. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41320. callback(null, handshake);
  41321. }
  41322. });
  41323. return {
  41324. abort: function () {
  41325. runner.abort();
  41326. },
  41327. forceMinPriority: function (p) {
  41328. minPriority = p;
  41329. if (runner) {
  41330. runner.forceMinPriority(p);
  41331. }
  41332. }
  41333. };
  41334. };
  41335. return CachedStrategy;
  41336. }());
  41337. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41338. function getTransportCacheKey(usingTLS) {
  41339. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41340. }
  41341. function fetchTransportCache(usingTLS) {
  41342. var storage = runtime.getLocalStorage();
  41343. if (storage) {
  41344. try {
  41345. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41346. if (serializedCache) {
  41347. return JSON.parse(serializedCache);
  41348. }
  41349. }
  41350. catch (e) {
  41351. flushTransportCache(usingTLS);
  41352. }
  41353. }
  41354. return null;
  41355. }
  41356. function storeTransportCache(usingTLS, transport, latency) {
  41357. var storage = runtime.getLocalStorage();
  41358. if (storage) {
  41359. try {
  41360. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41361. timestamp: util.now(),
  41362. transport: transport,
  41363. latency: latency
  41364. });
  41365. }
  41366. catch (e) {
  41367. }
  41368. }
  41369. }
  41370. function flushTransportCache(usingTLS) {
  41371. var storage = runtime.getLocalStorage();
  41372. if (storage) {
  41373. try {
  41374. delete storage[getTransportCacheKey(usingTLS)];
  41375. }
  41376. catch (e) {
  41377. }
  41378. }
  41379. }
  41380. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41381. var delayed_strategy_DelayedStrategy = (function () {
  41382. function DelayedStrategy(strategy, _a) {
  41383. var number = _a.delay;
  41384. this.strategy = strategy;
  41385. this.options = { delay: number };
  41386. }
  41387. DelayedStrategy.prototype.isSupported = function () {
  41388. return this.strategy.isSupported();
  41389. };
  41390. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41391. var strategy = this.strategy;
  41392. var runner;
  41393. var timer = new OneOffTimer(this.options.delay, function () {
  41394. runner = strategy.connect(minPriority, callback);
  41395. });
  41396. return {
  41397. abort: function () {
  41398. timer.ensureAborted();
  41399. if (runner) {
  41400. runner.abort();
  41401. }
  41402. },
  41403. forceMinPriority: function (p) {
  41404. minPriority = p;
  41405. if (runner) {
  41406. runner.forceMinPriority(p);
  41407. }
  41408. }
  41409. };
  41410. };
  41411. return DelayedStrategy;
  41412. }());
  41413. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41414. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41415. var IfStrategy = (function () {
  41416. function IfStrategy(test, trueBranch, falseBranch) {
  41417. this.test = test;
  41418. this.trueBranch = trueBranch;
  41419. this.falseBranch = falseBranch;
  41420. }
  41421. IfStrategy.prototype.isSupported = function () {
  41422. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41423. return branch.isSupported();
  41424. };
  41425. IfStrategy.prototype.connect = function (minPriority, callback) {
  41426. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41427. return branch.connect(minPriority, callback);
  41428. };
  41429. return IfStrategy;
  41430. }());
  41431. /* harmony default export */ var if_strategy = (IfStrategy);
  41432. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41433. var FirstConnectedStrategy = (function () {
  41434. function FirstConnectedStrategy(strategy) {
  41435. this.strategy = strategy;
  41436. }
  41437. FirstConnectedStrategy.prototype.isSupported = function () {
  41438. return this.strategy.isSupported();
  41439. };
  41440. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41441. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41442. if (handshake) {
  41443. runner.abort();
  41444. }
  41445. callback(error, handshake);
  41446. });
  41447. return runner;
  41448. };
  41449. return FirstConnectedStrategy;
  41450. }());
  41451. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41452. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41453. function testSupportsStrategy(strategy) {
  41454. return function () {
  41455. return strategy.isSupported();
  41456. };
  41457. }
  41458. var getDefaultStrategy = function (config, defineTransport) {
  41459. var definedTransports = {};
  41460. function defineTransportStrategy(name, type, priority, options, manager) {
  41461. var transport = defineTransport(config, name, type, priority, options, manager);
  41462. definedTransports[name] = transport;
  41463. return transport;
  41464. }
  41465. var ws_options = {
  41466. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41467. hostTLS: config.wsHost + ":" + config.wssPort,
  41468. httpPath: config.wsPath
  41469. };
  41470. var wss_options = extend({}, ws_options, {
  41471. useTLS: true
  41472. });
  41473. var sockjs_options = {
  41474. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41475. hostTLS: config.httpHost + ":" + config.httpsPort,
  41476. httpPath: config.httpPath
  41477. };
  41478. var timeouts = {
  41479. loop: true,
  41480. timeout: 15000,
  41481. timeoutLimit: 60000
  41482. };
  41483. var ws_manager = new transport_manager({
  41484. lives: 2,
  41485. minPingDelay: 10000,
  41486. maxPingDelay: config.activity_timeout
  41487. });
  41488. var streaming_manager = new transport_manager({
  41489. lives: 2,
  41490. minPingDelay: 10000,
  41491. maxPingDelay: config.activity_timeout
  41492. });
  41493. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41494. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41495. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41496. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41497. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41498. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41499. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41500. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41501. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41502. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41503. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41504. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41505. 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);
  41506. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41507. var wsStrategy;
  41508. if (config.useTLS) {
  41509. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41510. }
  41511. else {
  41512. wsStrategy = new best_connected_ever_strategy([
  41513. ws_loop,
  41514. new delayed_strategy(wss_loop, { delay: 2000 }),
  41515. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41516. ]);
  41517. }
  41518. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41519. ttl: 1800000,
  41520. timeline: config.timeline,
  41521. useTLS: config.useTLS
  41522. });
  41523. };
  41524. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41525. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41526. /* harmony default export */ var transport_connection_initializer = (function () {
  41527. var self = this;
  41528. self.timeline.info(self.buildTimelineMessage({
  41529. transport: self.name + (self.options.useTLS ? "s" : "")
  41530. }));
  41531. if (self.hooks.isInitialized()) {
  41532. self.changeState("initialized");
  41533. }
  41534. else if (self.hooks.file) {
  41535. self.changeState("initializing");
  41536. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41537. if (self.hooks.isInitialized()) {
  41538. self.changeState("initialized");
  41539. callback(true);
  41540. }
  41541. else {
  41542. if (error) {
  41543. self.onError(error);
  41544. }
  41545. self.onClose();
  41546. callback(false);
  41547. }
  41548. });
  41549. }
  41550. else {
  41551. self.onClose();
  41552. }
  41553. });
  41554. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41555. var http_xdomain_request_hooks = {
  41556. getRequest: function (socket) {
  41557. var xdr = new window.XDomainRequest();
  41558. xdr.ontimeout = function () {
  41559. socket.emit("error", new RequestTimedOut());
  41560. socket.close();
  41561. };
  41562. xdr.onerror = function (e) {
  41563. socket.emit("error", e);
  41564. socket.close();
  41565. };
  41566. xdr.onprogress = function () {
  41567. if (xdr.responseText && xdr.responseText.length > 0) {
  41568. socket.onChunk(200, xdr.responseText);
  41569. }
  41570. };
  41571. xdr.onload = function () {
  41572. if (xdr.responseText && xdr.responseText.length > 0) {
  41573. socket.onChunk(200, xdr.responseText);
  41574. }
  41575. socket.emit("finished", 200);
  41576. socket.close();
  41577. };
  41578. return xdr;
  41579. },
  41580. abortRequest: function (xdr) {
  41581. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41582. xdr.abort();
  41583. }
  41584. };
  41585. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41586. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41587. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41588. var extendStatics = function (d, b) {
  41589. extendStatics = Object.setPrototypeOf ||
  41590. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41591. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41592. return extendStatics(d, b);
  41593. };
  41594. return function (d, b) {
  41595. extendStatics(d, b);
  41596. function __() { this.constructor = d; }
  41597. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41598. };
  41599. })();
  41600. var MAX_BUFFER_LENGTH = 256 * 1024;
  41601. var http_request_HTTPRequest = (function (_super) {
  41602. http_request_extends(HTTPRequest, _super);
  41603. function HTTPRequest(hooks, method, url) {
  41604. var _this = _super.call(this) || this;
  41605. _this.hooks = hooks;
  41606. _this.method = method;
  41607. _this.url = url;
  41608. return _this;
  41609. }
  41610. HTTPRequest.prototype.start = function (payload) {
  41611. var _this = this;
  41612. this.position = 0;
  41613. this.xhr = this.hooks.getRequest(this);
  41614. this.unloader = function () {
  41615. _this.close();
  41616. };
  41617. runtime.addUnloadListener(this.unloader);
  41618. this.xhr.open(this.method, this.url, true);
  41619. if (this.xhr.setRequestHeader) {
  41620. this.xhr.setRequestHeader("Content-Type", "application/json");
  41621. }
  41622. this.xhr.send(payload);
  41623. };
  41624. HTTPRequest.prototype.close = function () {
  41625. if (this.unloader) {
  41626. runtime.removeUnloadListener(this.unloader);
  41627. this.unloader = null;
  41628. }
  41629. if (this.xhr) {
  41630. this.hooks.abortRequest(this.xhr);
  41631. this.xhr = null;
  41632. }
  41633. };
  41634. HTTPRequest.prototype.onChunk = function (status, data) {
  41635. while (true) {
  41636. var chunk = this.advanceBuffer(data);
  41637. if (chunk) {
  41638. this.emit("chunk", { status: status, data: chunk });
  41639. }
  41640. else {
  41641. break;
  41642. }
  41643. }
  41644. if (this.isBufferTooLong(data)) {
  41645. this.emit("buffer_too_long");
  41646. }
  41647. };
  41648. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41649. var unreadData = buffer.slice(this.position);
  41650. var endOfLinePosition = unreadData.indexOf("\n");
  41651. if (endOfLinePosition !== -1) {
  41652. this.position += endOfLinePosition + 1;
  41653. return unreadData.slice(0, endOfLinePosition);
  41654. }
  41655. else {
  41656. return null;
  41657. }
  41658. };
  41659. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41660. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41661. };
  41662. return HTTPRequest;
  41663. }(dispatcher));
  41664. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41665. // CONCATENATED MODULE: ./src/core/http/state.ts
  41666. var State;
  41667. (function (State) {
  41668. State[State["CONNECTING"] = 0] = "CONNECTING";
  41669. State[State["OPEN"] = 1] = "OPEN";
  41670. State[State["CLOSED"] = 3] = "CLOSED";
  41671. })(State || (State = {}));
  41672. /* harmony default export */ var state = (State);
  41673. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41674. var autoIncrement = 1;
  41675. var http_socket_HTTPSocket = (function () {
  41676. function HTTPSocket(hooks, url) {
  41677. this.hooks = hooks;
  41678. this.session = randomNumber(1000) + "/" + randomString(8);
  41679. this.location = getLocation(url);
  41680. this.readyState = state.CONNECTING;
  41681. this.openStream();
  41682. }
  41683. HTTPSocket.prototype.send = function (payload) {
  41684. return this.sendRaw(JSON.stringify([payload]));
  41685. };
  41686. HTTPSocket.prototype.ping = function () {
  41687. this.hooks.sendHeartbeat(this);
  41688. };
  41689. HTTPSocket.prototype.close = function (code, reason) {
  41690. this.onClose(code, reason, true);
  41691. };
  41692. HTTPSocket.prototype.sendRaw = function (payload) {
  41693. if (this.readyState === state.OPEN) {
  41694. try {
  41695. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41696. return true;
  41697. }
  41698. catch (e) {
  41699. return false;
  41700. }
  41701. }
  41702. else {
  41703. return false;
  41704. }
  41705. };
  41706. HTTPSocket.prototype.reconnect = function () {
  41707. this.closeStream();
  41708. this.openStream();
  41709. };
  41710. ;
  41711. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41712. this.closeStream();
  41713. this.readyState = state.CLOSED;
  41714. if (this.onclose) {
  41715. this.onclose({
  41716. code: code,
  41717. reason: reason,
  41718. wasClean: wasClean
  41719. });
  41720. }
  41721. };
  41722. HTTPSocket.prototype.onChunk = function (chunk) {
  41723. if (chunk.status !== 200) {
  41724. return;
  41725. }
  41726. if (this.readyState === state.OPEN) {
  41727. this.onActivity();
  41728. }
  41729. var payload;
  41730. var type = chunk.data.slice(0, 1);
  41731. switch (type) {
  41732. case 'o':
  41733. payload = JSON.parse(chunk.data.slice(1) || '{}');
  41734. this.onOpen(payload);
  41735. break;
  41736. case 'a':
  41737. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41738. for (var i = 0; i < payload.length; i++) {
  41739. this.onEvent(payload[i]);
  41740. }
  41741. break;
  41742. case 'm':
  41743. payload = JSON.parse(chunk.data.slice(1) || 'null');
  41744. this.onEvent(payload);
  41745. break;
  41746. case 'h':
  41747. this.hooks.onHeartbeat(this);
  41748. break;
  41749. case 'c':
  41750. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41751. this.onClose(payload[0], payload[1], true);
  41752. break;
  41753. }
  41754. };
  41755. HTTPSocket.prototype.onOpen = function (options) {
  41756. if (this.readyState === state.CONNECTING) {
  41757. if (options && options.hostname) {
  41758. this.location.base = replaceHost(this.location.base, options.hostname);
  41759. }
  41760. this.readyState = state.OPEN;
  41761. if (this.onopen) {
  41762. this.onopen();
  41763. }
  41764. }
  41765. else {
  41766. this.onClose(1006, "Server lost session", true);
  41767. }
  41768. };
  41769. HTTPSocket.prototype.onEvent = function (event) {
  41770. if (this.readyState === state.OPEN && this.onmessage) {
  41771. this.onmessage({ data: event });
  41772. }
  41773. };
  41774. HTTPSocket.prototype.onActivity = function () {
  41775. if (this.onactivity) {
  41776. this.onactivity();
  41777. }
  41778. };
  41779. HTTPSocket.prototype.onError = function (error) {
  41780. if (this.onerror) {
  41781. this.onerror(error);
  41782. }
  41783. };
  41784. HTTPSocket.prototype.openStream = function () {
  41785. var _this = this;
  41786. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  41787. this.stream.bind("chunk", function (chunk) {
  41788. _this.onChunk(chunk);
  41789. });
  41790. this.stream.bind("finished", function (status) {
  41791. _this.hooks.onFinished(_this, status);
  41792. });
  41793. this.stream.bind("buffer_too_long", function () {
  41794. _this.reconnect();
  41795. });
  41796. try {
  41797. this.stream.start();
  41798. }
  41799. catch (error) {
  41800. util.defer(function () {
  41801. _this.onError(error);
  41802. _this.onClose(1006, "Could not start streaming", false);
  41803. });
  41804. }
  41805. };
  41806. HTTPSocket.prototype.closeStream = function () {
  41807. if (this.stream) {
  41808. this.stream.unbind_all();
  41809. this.stream.close();
  41810. this.stream = null;
  41811. }
  41812. };
  41813. return HTTPSocket;
  41814. }());
  41815. function getLocation(url) {
  41816. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  41817. return {
  41818. base: parts[1],
  41819. queryString: parts[2]
  41820. };
  41821. }
  41822. function getSendURL(url, session) {
  41823. return url.base + "/" + session + "/xhr_send";
  41824. }
  41825. function getUniqueURL(url) {
  41826. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  41827. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  41828. }
  41829. function replaceHost(url, hostname) {
  41830. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  41831. return urlParts[1] + hostname + urlParts[3];
  41832. }
  41833. function randomNumber(max) {
  41834. return Math.floor(Math.random() * max);
  41835. }
  41836. function randomString(length) {
  41837. var result = [];
  41838. for (var i = 0; i < length; i++) {
  41839. result.push(randomNumber(32).toString(32));
  41840. }
  41841. return result.join('');
  41842. }
  41843. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  41844. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  41845. var http_streaming_socket_hooks = {
  41846. getReceiveURL: function (url, session) {
  41847. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  41848. },
  41849. onHeartbeat: function (socket) {
  41850. socket.sendRaw("[]");
  41851. },
  41852. sendHeartbeat: function (socket) {
  41853. socket.sendRaw("[]");
  41854. },
  41855. onFinished: function (socket, status) {
  41856. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41857. }
  41858. };
  41859. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  41860. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  41861. var http_polling_socket_hooks = {
  41862. getReceiveURL: function (url, session) {
  41863. return url.base + "/" + session + "/xhr" + url.queryString;
  41864. },
  41865. onHeartbeat: function () {
  41866. },
  41867. sendHeartbeat: function (socket) {
  41868. socket.sendRaw("[]");
  41869. },
  41870. onFinished: function (socket, status) {
  41871. if (status === 200) {
  41872. socket.reconnect();
  41873. }
  41874. else {
  41875. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41876. }
  41877. }
  41878. };
  41879. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  41880. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  41881. var http_xhr_request_hooks = {
  41882. getRequest: function (socket) {
  41883. var Constructor = runtime.getXHRAPI();
  41884. var xhr = new Constructor();
  41885. xhr.onreadystatechange = xhr.onprogress = function () {
  41886. switch (xhr.readyState) {
  41887. case 3:
  41888. if (xhr.responseText && xhr.responseText.length > 0) {
  41889. socket.onChunk(xhr.status, xhr.responseText);
  41890. }
  41891. break;
  41892. case 4:
  41893. if (xhr.responseText && xhr.responseText.length > 0) {
  41894. socket.onChunk(xhr.status, xhr.responseText);
  41895. }
  41896. socket.emit("finished", xhr.status);
  41897. socket.close();
  41898. break;
  41899. }
  41900. };
  41901. return xhr;
  41902. },
  41903. abortRequest: function (xhr) {
  41904. xhr.onreadystatechange = null;
  41905. xhr.abort();
  41906. }
  41907. };
  41908. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  41909. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  41910. var HTTP = {
  41911. createStreamingSocket: function (url) {
  41912. return this.createSocket(http_streaming_socket, url);
  41913. },
  41914. createPollingSocket: function (url) {
  41915. return this.createSocket(http_polling_socket, url);
  41916. },
  41917. createSocket: function (hooks, url) {
  41918. return new http_socket(hooks, url);
  41919. },
  41920. createXHR: function (method, url) {
  41921. return this.createRequest(http_xhr_request, method, url);
  41922. },
  41923. createRequest: function (hooks, method, url) {
  41924. return new http_request(hooks, method, url);
  41925. }
  41926. };
  41927. /* harmony default export */ var http_http = (HTTP);
  41928. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  41929. http_http.createXDR = function (method, url) {
  41930. return this.createRequest(http_xdomain_request, method, url);
  41931. };
  41932. /* harmony default export */ var web_http_http = (http_http);
  41933. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  41934. var Runtime = {
  41935. nextAuthCallbackID: 1,
  41936. auth_callbacks: {},
  41937. ScriptReceivers: ScriptReceivers,
  41938. DependenciesReceivers: DependenciesReceivers,
  41939. getDefaultStrategy: default_strategy,
  41940. Transports: transports_transports,
  41941. transportConnectionInitializer: transport_connection_initializer,
  41942. HTTPFactory: web_http_http,
  41943. TimelineTransport: jsonp_timeline,
  41944. getXHRAPI: function () {
  41945. return window.XMLHttpRequest;
  41946. },
  41947. getWebSocketAPI: function () {
  41948. return window.WebSocket || window.MozWebSocket;
  41949. },
  41950. setup: function (PusherClass) {
  41951. var _this = this;
  41952. window.Pusher = PusherClass;
  41953. var initializeOnDocumentBody = function () {
  41954. _this.onDocumentBody(PusherClass.ready);
  41955. };
  41956. if (!window.JSON) {
  41957. Dependencies.load("json2", {}, initializeOnDocumentBody);
  41958. }
  41959. else {
  41960. initializeOnDocumentBody();
  41961. }
  41962. },
  41963. getDocument: function () {
  41964. return document;
  41965. },
  41966. getProtocol: function () {
  41967. return this.getDocument().location.protocol;
  41968. },
  41969. getAuthorizers: function () {
  41970. return { ajax: xhr_auth, jsonp: jsonp_auth };
  41971. },
  41972. onDocumentBody: function (callback) {
  41973. var _this = this;
  41974. if (document.body) {
  41975. callback();
  41976. }
  41977. else {
  41978. setTimeout(function () {
  41979. _this.onDocumentBody(callback);
  41980. }, 0);
  41981. }
  41982. },
  41983. createJSONPRequest: function (url, data) {
  41984. return new jsonp_request(url, data);
  41985. },
  41986. createScriptRequest: function (src) {
  41987. return new script_request(src);
  41988. },
  41989. getLocalStorage: function () {
  41990. try {
  41991. return window.localStorage;
  41992. }
  41993. catch (e) {
  41994. return undefined;
  41995. }
  41996. },
  41997. createXHR: function () {
  41998. if (this.getXHRAPI()) {
  41999. return this.createXMLHttpRequest();
  42000. }
  42001. else {
  42002. return this.createMicrosoftXHR();
  42003. }
  42004. },
  42005. createXMLHttpRequest: function () {
  42006. var Constructor = this.getXHRAPI();
  42007. return new Constructor();
  42008. },
  42009. createMicrosoftXHR: function () {
  42010. return new ActiveXObject("Microsoft.XMLHTTP");
  42011. },
  42012. getNetwork: function () {
  42013. return net_info_Network;
  42014. },
  42015. createWebSocket: function (url) {
  42016. var Constructor = this.getWebSocketAPI();
  42017. return new Constructor(url);
  42018. },
  42019. createSocketRequest: function (method, url) {
  42020. if (this.isXHRSupported()) {
  42021. return this.HTTPFactory.createXHR(method, url);
  42022. }
  42023. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42024. return this.HTTPFactory.createXDR(method, url);
  42025. }
  42026. else {
  42027. throw "Cross-origin HTTP requests are not supported";
  42028. }
  42029. },
  42030. isXHRSupported: function () {
  42031. var Constructor = this.getXHRAPI();
  42032. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42033. },
  42034. isXDRSupported: function (useTLS) {
  42035. var protocol = useTLS ? "https:" : "http:";
  42036. var documentProtocol = this.getProtocol();
  42037. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42038. },
  42039. addUnloadListener: function (listener) {
  42040. if (window.addEventListener !== undefined) {
  42041. window.addEventListener("unload", listener, false);
  42042. }
  42043. else if (window.attachEvent !== undefined) {
  42044. window.attachEvent("onunload", listener);
  42045. }
  42046. },
  42047. removeUnloadListener: function (listener) {
  42048. if (window.addEventListener !== undefined) {
  42049. window.removeEventListener("unload", listener, false);
  42050. }
  42051. else if (window.detachEvent !== undefined) {
  42052. window.detachEvent("onunload", listener);
  42053. }
  42054. }
  42055. };
  42056. /* harmony default export */ var runtime = (Runtime);
  42057. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42058. var TimelineLevel;
  42059. (function (TimelineLevel) {
  42060. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42061. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42062. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42063. })(TimelineLevel || (TimelineLevel = {}));
  42064. /* harmony default export */ var timeline_level = (TimelineLevel);
  42065. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42066. var timeline_Timeline = (function () {
  42067. function Timeline(key, session, options) {
  42068. this.key = key;
  42069. this.session = session;
  42070. this.events = [];
  42071. this.options = options || {};
  42072. this.sent = 0;
  42073. this.uniqueID = 0;
  42074. }
  42075. Timeline.prototype.log = function (level, event) {
  42076. if (level <= this.options.level) {
  42077. this.events.push(extend({}, event, { timestamp: util.now() }));
  42078. if (this.options.limit && this.events.length > this.options.limit) {
  42079. this.events.shift();
  42080. }
  42081. }
  42082. };
  42083. Timeline.prototype.error = function (event) {
  42084. this.log(timeline_level.ERROR, event);
  42085. };
  42086. Timeline.prototype.info = function (event) {
  42087. this.log(timeline_level.INFO, event);
  42088. };
  42089. Timeline.prototype.debug = function (event) {
  42090. this.log(timeline_level.DEBUG, event);
  42091. };
  42092. Timeline.prototype.isEmpty = function () {
  42093. return this.events.length === 0;
  42094. };
  42095. Timeline.prototype.send = function (sendfn, callback) {
  42096. var _this = this;
  42097. var data = extend({
  42098. session: this.session,
  42099. bundle: this.sent + 1,
  42100. key: this.key,
  42101. lib: "js",
  42102. version: this.options.version,
  42103. cluster: this.options.cluster,
  42104. features: this.options.features,
  42105. timeline: this.events
  42106. }, this.options.params);
  42107. this.events = [];
  42108. sendfn(data, function (error, result) {
  42109. if (!error) {
  42110. _this.sent++;
  42111. }
  42112. if (callback) {
  42113. callback(error, result);
  42114. }
  42115. });
  42116. return true;
  42117. };
  42118. Timeline.prototype.generateUniqueID = function () {
  42119. this.uniqueID++;
  42120. return this.uniqueID;
  42121. };
  42122. return Timeline;
  42123. }());
  42124. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42125. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42126. var transport_strategy_TransportStrategy = (function () {
  42127. function TransportStrategy(name, priority, transport, options) {
  42128. this.name = name;
  42129. this.priority = priority;
  42130. this.transport = transport;
  42131. this.options = options || {};
  42132. }
  42133. TransportStrategy.prototype.isSupported = function () {
  42134. return this.transport.isSupported({
  42135. useTLS: this.options.useTLS
  42136. });
  42137. };
  42138. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42139. var _this = this;
  42140. if (!this.isSupported()) {
  42141. return failAttempt(new UnsupportedStrategy(), callback);
  42142. }
  42143. else if (this.priority < minPriority) {
  42144. return failAttempt(new TransportPriorityTooLow(), callback);
  42145. }
  42146. var connected = false;
  42147. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42148. var handshake = null;
  42149. var onInitialized = function () {
  42150. transport.unbind("initialized", onInitialized);
  42151. transport.connect();
  42152. };
  42153. var onOpen = function () {
  42154. handshake = factory.createHandshake(transport, function (result) {
  42155. connected = true;
  42156. unbindListeners();
  42157. callback(null, result);
  42158. });
  42159. };
  42160. var onError = function (error) {
  42161. unbindListeners();
  42162. callback(error);
  42163. };
  42164. var onClosed = function () {
  42165. unbindListeners();
  42166. var serializedTransport;
  42167. serializedTransport = safeJSONStringify(transport);
  42168. callback(new TransportClosed(serializedTransport));
  42169. };
  42170. var unbindListeners = function () {
  42171. transport.unbind("initialized", onInitialized);
  42172. transport.unbind("open", onOpen);
  42173. transport.unbind("error", onError);
  42174. transport.unbind("closed", onClosed);
  42175. };
  42176. transport.bind("initialized", onInitialized);
  42177. transport.bind("open", onOpen);
  42178. transport.bind("error", onError);
  42179. transport.bind("closed", onClosed);
  42180. transport.initialize();
  42181. return {
  42182. abort: function () {
  42183. if (connected) {
  42184. return;
  42185. }
  42186. unbindListeners();
  42187. if (handshake) {
  42188. handshake.close();
  42189. }
  42190. else {
  42191. transport.close();
  42192. }
  42193. },
  42194. forceMinPriority: function (p) {
  42195. if (connected) {
  42196. return;
  42197. }
  42198. if (_this.priority < p) {
  42199. if (handshake) {
  42200. handshake.close();
  42201. }
  42202. else {
  42203. transport.close();
  42204. }
  42205. }
  42206. }
  42207. };
  42208. };
  42209. return TransportStrategy;
  42210. }());
  42211. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42212. function failAttempt(error, callback) {
  42213. util.defer(function () {
  42214. callback(error);
  42215. });
  42216. return {
  42217. abort: function () { },
  42218. forceMinPriority: function () { }
  42219. };
  42220. }
  42221. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42222. var strategy_builder_Transports = runtime.Transports;
  42223. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42224. var transportClass = strategy_builder_Transports[type];
  42225. if (!transportClass) {
  42226. throw new UnsupportedTransport(type);
  42227. }
  42228. var enabled = (!config.enabledTransports ||
  42229. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42230. (!config.disabledTransports ||
  42231. arrayIndexOf(config.disabledTransports, name) === -1);
  42232. var transport;
  42233. if (enabled) {
  42234. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42235. key: config.key,
  42236. useTLS: config.useTLS,
  42237. timeline: config.timeline,
  42238. ignoreNullOrigin: config.ignoreNullOrigin
  42239. }, options));
  42240. }
  42241. else {
  42242. transport = strategy_builder_UnsupportedStrategy;
  42243. }
  42244. return transport;
  42245. };
  42246. var strategy_builder_UnsupportedStrategy = {
  42247. isSupported: function () {
  42248. return false;
  42249. },
  42250. connect: function (_, callback) {
  42251. var deferred = util.defer(function () {
  42252. callback(new UnsupportedStrategy());
  42253. });
  42254. return {
  42255. abort: function () {
  42256. deferred.ensureAborted();
  42257. },
  42258. forceMinPriority: function () { }
  42259. };
  42260. }
  42261. };
  42262. // CONCATENATED MODULE: ./src/core/config.ts
  42263. var getGlobalConfig = function () {
  42264. return {
  42265. wsHost: defaults.host,
  42266. wsPort: defaults.ws_port,
  42267. wssPort: defaults.wss_port,
  42268. wsPath: defaults.ws_path,
  42269. httpHost: defaults.sockjs_host,
  42270. httpPort: defaults.sockjs_http_port,
  42271. httpsPort: defaults.sockjs_https_port,
  42272. httpPath: defaults.sockjs_path,
  42273. statsHost: defaults.stats_host,
  42274. authEndpoint: defaults.channel_auth_endpoint,
  42275. authTransport: defaults.channel_auth_transport,
  42276. activity_timeout: defaults.activity_timeout,
  42277. pong_timeout: defaults.pong_timeout,
  42278. unavailable_timeout: defaults.unavailable_timeout
  42279. };
  42280. };
  42281. var getClusterConfig = function (clusterName) {
  42282. return {
  42283. wsHost: 'ws-' + clusterName + '.pusher.com',
  42284. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42285. };
  42286. };
  42287. // CONCATENATED MODULE: ./src/core/pusher.ts
  42288. var pusher_Pusher = (function () {
  42289. function Pusher(app_key, options) {
  42290. var _this = this;
  42291. checkAppKey(app_key);
  42292. options = options || {};
  42293. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42294. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42295. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42296. }
  42297. this.key = app_key;
  42298. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42299. this.channels = factory.createChannels();
  42300. this.global_emitter = new dispatcher();
  42301. this.sessionID = Math.floor(Math.random() * 1000000000);
  42302. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42303. cluster: this.config.cluster,
  42304. features: Pusher.getClientFeatures(),
  42305. params: this.config.timelineParams || {},
  42306. limit: 50,
  42307. level: timeline_level.INFO,
  42308. version: defaults.VERSION
  42309. });
  42310. if (!this.config.disableStats) {
  42311. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42312. host: this.config.statsHost,
  42313. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42314. });
  42315. }
  42316. var getStrategy = function (options) {
  42317. var config = extend({}, _this.config, options);
  42318. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42319. };
  42320. this.connection = factory.createConnectionManager(this.key, extend({
  42321. getStrategy: getStrategy,
  42322. timeline: this.timeline,
  42323. activityTimeout: this.config.activity_timeout,
  42324. pongTimeout: this.config.pong_timeout,
  42325. unavailableTimeout: this.config.unavailable_timeout
  42326. }, this.config, { useTLS: this.shouldUseTLS() }));
  42327. this.connection.bind('connected', function () {
  42328. _this.subscribeAll();
  42329. if (_this.timelineSender) {
  42330. _this.timelineSender.send(_this.connection.isUsingTLS());
  42331. }
  42332. });
  42333. this.connection.bind('message', function (event) {
  42334. var eventName = event.event;
  42335. var internal = eventName.indexOf('pusher_internal:') === 0;
  42336. if (event.channel) {
  42337. var channel = _this.channel(event.channel);
  42338. if (channel) {
  42339. channel.handleEvent(event);
  42340. }
  42341. }
  42342. if (!internal) {
  42343. _this.global_emitter.emit(event.event, event.data);
  42344. }
  42345. });
  42346. this.connection.bind('connecting', function () {
  42347. _this.channels.disconnect();
  42348. });
  42349. this.connection.bind('disconnected', function () {
  42350. _this.channels.disconnect();
  42351. });
  42352. this.connection.bind('error', function (err) {
  42353. logger.warn(err);
  42354. });
  42355. Pusher.instances.push(this);
  42356. this.timeline.info({ instances: Pusher.instances.length });
  42357. if (Pusher.isReady) {
  42358. this.connect();
  42359. }
  42360. }
  42361. Pusher.ready = function () {
  42362. Pusher.isReady = true;
  42363. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42364. Pusher.instances[i].connect();
  42365. }
  42366. };
  42367. Pusher.getClientFeatures = function () {
  42368. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42369. return t.isSupported({});
  42370. }));
  42371. };
  42372. Pusher.prototype.channel = function (name) {
  42373. return this.channels.find(name);
  42374. };
  42375. Pusher.prototype.allChannels = function () {
  42376. return this.channels.all();
  42377. };
  42378. Pusher.prototype.connect = function () {
  42379. this.connection.connect();
  42380. if (this.timelineSender) {
  42381. if (!this.timelineSenderTimer) {
  42382. var usingTLS = this.connection.isUsingTLS();
  42383. var timelineSender = this.timelineSender;
  42384. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42385. timelineSender.send(usingTLS);
  42386. });
  42387. }
  42388. }
  42389. };
  42390. Pusher.prototype.disconnect = function () {
  42391. this.connection.disconnect();
  42392. if (this.timelineSenderTimer) {
  42393. this.timelineSenderTimer.ensureAborted();
  42394. this.timelineSenderTimer = null;
  42395. }
  42396. };
  42397. Pusher.prototype.bind = function (event_name, callback, context) {
  42398. this.global_emitter.bind(event_name, callback, context);
  42399. return this;
  42400. };
  42401. Pusher.prototype.unbind = function (event_name, callback, context) {
  42402. this.global_emitter.unbind(event_name, callback, context);
  42403. return this;
  42404. };
  42405. Pusher.prototype.bind_global = function (callback) {
  42406. this.global_emitter.bind_global(callback);
  42407. return this;
  42408. };
  42409. Pusher.prototype.unbind_global = function (callback) {
  42410. this.global_emitter.unbind_global(callback);
  42411. return this;
  42412. };
  42413. Pusher.prototype.unbind_all = function (callback) {
  42414. this.global_emitter.unbind_all();
  42415. return this;
  42416. };
  42417. Pusher.prototype.subscribeAll = function () {
  42418. var channelName;
  42419. for (channelName in this.channels.channels) {
  42420. if (this.channels.channels.hasOwnProperty(channelName)) {
  42421. this.subscribe(channelName);
  42422. }
  42423. }
  42424. };
  42425. Pusher.prototype.subscribe = function (channel_name) {
  42426. var channel = this.channels.add(channel_name, this);
  42427. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42428. channel.reinstateSubscription();
  42429. }
  42430. else if (!channel.subscriptionPending &&
  42431. this.connection.state === 'connected') {
  42432. channel.subscribe();
  42433. }
  42434. return channel;
  42435. };
  42436. Pusher.prototype.unsubscribe = function (channel_name) {
  42437. var channel = this.channels.find(channel_name);
  42438. if (channel && channel.subscriptionPending) {
  42439. channel.cancelSubscription();
  42440. }
  42441. else {
  42442. channel = this.channels.remove(channel_name);
  42443. if (channel && this.connection.state === 'connected') {
  42444. channel.unsubscribe();
  42445. }
  42446. }
  42447. };
  42448. Pusher.prototype.send_event = function (event_name, data, channel) {
  42449. return this.connection.send_event(event_name, data, channel);
  42450. };
  42451. Pusher.prototype.shouldUseTLS = function () {
  42452. if (runtime.getProtocol() === 'https:') {
  42453. return true;
  42454. }
  42455. else if (this.config.forceTLS === true) {
  42456. return true;
  42457. }
  42458. else {
  42459. return Boolean(this.config.encrypted);
  42460. }
  42461. };
  42462. Pusher.instances = [];
  42463. Pusher.isReady = false;
  42464. Pusher.logToConsole = false;
  42465. Pusher.Runtime = runtime;
  42466. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42467. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42468. Pusher.auth_callbacks = runtime.auth_callbacks;
  42469. return Pusher;
  42470. }());
  42471. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42472. function checkAppKey(key) {
  42473. if (key === null || key === undefined) {
  42474. throw 'You must pass your app key when you instantiate Pusher.';
  42475. }
  42476. }
  42477. runtime.setup(pusher_Pusher);
  42478. /***/ })
  42479. /******/ ]);
  42480. });
  42481. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42482. /***/ }),
  42483. /***/ "./node_modules/setimmediate/setImmediate.js":
  42484. /*!***************************************************!*\
  42485. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42486. \***************************************************/
  42487. /*! no static exports found */
  42488. /***/ (function(module, exports, __webpack_require__) {
  42489. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42490. "use strict";
  42491. if (global.setImmediate) {
  42492. return;
  42493. }
  42494. var nextHandle = 1; // Spec says greater than zero
  42495. var tasksByHandle = {};
  42496. var currentlyRunningATask = false;
  42497. var doc = global.document;
  42498. var registerImmediate;
  42499. function setImmediate(callback) {
  42500. // Callback can either be a function or a string
  42501. if (typeof callback !== "function") {
  42502. callback = new Function("" + callback);
  42503. }
  42504. // Copy function arguments
  42505. var args = new Array(arguments.length - 1);
  42506. for (var i = 0; i < args.length; i++) {
  42507. args[i] = arguments[i + 1];
  42508. }
  42509. // Store and register the task
  42510. var task = { callback: callback, args: args };
  42511. tasksByHandle[nextHandle] = task;
  42512. registerImmediate(nextHandle);
  42513. return nextHandle++;
  42514. }
  42515. function clearImmediate(handle) {
  42516. delete tasksByHandle[handle];
  42517. }
  42518. function run(task) {
  42519. var callback = task.callback;
  42520. var args = task.args;
  42521. switch (args.length) {
  42522. case 0:
  42523. callback();
  42524. break;
  42525. case 1:
  42526. callback(args[0]);
  42527. break;
  42528. case 2:
  42529. callback(args[0], args[1]);
  42530. break;
  42531. case 3:
  42532. callback(args[0], args[1], args[2]);
  42533. break;
  42534. default:
  42535. callback.apply(undefined, args);
  42536. break;
  42537. }
  42538. }
  42539. function runIfPresent(handle) {
  42540. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42541. // So if we're currently running a task, we'll need to delay this invocation.
  42542. if (currentlyRunningATask) {
  42543. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42544. // "too much recursion" error.
  42545. setTimeout(runIfPresent, 0, handle);
  42546. } else {
  42547. var task = tasksByHandle[handle];
  42548. if (task) {
  42549. currentlyRunningATask = true;
  42550. try {
  42551. run(task);
  42552. } finally {
  42553. clearImmediate(handle);
  42554. currentlyRunningATask = false;
  42555. }
  42556. }
  42557. }
  42558. }
  42559. function installNextTickImplementation() {
  42560. registerImmediate = function(handle) {
  42561. process.nextTick(function () { runIfPresent(handle); });
  42562. };
  42563. }
  42564. function canUsePostMessage() {
  42565. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42566. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42567. if (global.postMessage && !global.importScripts) {
  42568. var postMessageIsAsynchronous = true;
  42569. var oldOnMessage = global.onmessage;
  42570. global.onmessage = function() {
  42571. postMessageIsAsynchronous = false;
  42572. };
  42573. global.postMessage("", "*");
  42574. global.onmessage = oldOnMessage;
  42575. return postMessageIsAsynchronous;
  42576. }
  42577. }
  42578. function installPostMessageImplementation() {
  42579. // Installs an event handler on `global` for the `message` event: see
  42580. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42581. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42582. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42583. var onGlobalMessage = function(event) {
  42584. if (event.source === global &&
  42585. typeof event.data === "string" &&
  42586. event.data.indexOf(messagePrefix) === 0) {
  42587. runIfPresent(+event.data.slice(messagePrefix.length));
  42588. }
  42589. };
  42590. if (global.addEventListener) {
  42591. global.addEventListener("message", onGlobalMessage, false);
  42592. } else {
  42593. global.attachEvent("onmessage", onGlobalMessage);
  42594. }
  42595. registerImmediate = function(handle) {
  42596. global.postMessage(messagePrefix + handle, "*");
  42597. };
  42598. }
  42599. function installMessageChannelImplementation() {
  42600. var channel = new MessageChannel();
  42601. channel.port1.onmessage = function(event) {
  42602. var handle = event.data;
  42603. runIfPresent(handle);
  42604. };
  42605. registerImmediate = function(handle) {
  42606. channel.port2.postMessage(handle);
  42607. };
  42608. }
  42609. function installReadyStateChangeImplementation() {
  42610. var html = doc.documentElement;
  42611. registerImmediate = function(handle) {
  42612. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42613. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42614. var script = doc.createElement("script");
  42615. script.onreadystatechange = function () {
  42616. runIfPresent(handle);
  42617. script.onreadystatechange = null;
  42618. html.removeChild(script);
  42619. script = null;
  42620. };
  42621. html.appendChild(script);
  42622. };
  42623. }
  42624. function installSetTimeoutImplementation() {
  42625. registerImmediate = function(handle) {
  42626. setTimeout(runIfPresent, 0, handle);
  42627. };
  42628. }
  42629. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42630. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42631. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42632. // Don't get fooled by e.g. browserify environments.
  42633. if ({}.toString.call(global.process) === "[object process]") {
  42634. // For Node.js before 0.9
  42635. installNextTickImplementation();
  42636. } else if (canUsePostMessage()) {
  42637. // For non-IE10 modern browsers
  42638. installPostMessageImplementation();
  42639. } else if (global.MessageChannel) {
  42640. // For web workers, where supported
  42641. installMessageChannelImplementation();
  42642. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42643. // For IE 6–8
  42644. installReadyStateChangeImplementation();
  42645. } else {
  42646. // For older browsers
  42647. installSetTimeoutImplementation();
  42648. }
  42649. attachTo.setImmediate = setImmediate;
  42650. attachTo.clearImmediate = clearImmediate;
  42651. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42652. /* 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")))
  42653. /***/ }),
  42654. /***/ "./node_modules/timers-browserify/main.js":
  42655. /*!************************************************!*\
  42656. !*** ./node_modules/timers-browserify/main.js ***!
  42657. \************************************************/
  42658. /*! no static exports found */
  42659. /***/ (function(module, exports, __webpack_require__) {
  42660. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42661. (typeof self !== "undefined" && self) ||
  42662. window;
  42663. var apply = Function.prototype.apply;
  42664. // DOM APIs, for completeness
  42665. exports.setTimeout = function() {
  42666. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42667. };
  42668. exports.setInterval = function() {
  42669. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42670. };
  42671. exports.clearTimeout =
  42672. exports.clearInterval = function(timeout) {
  42673. if (timeout) {
  42674. timeout.close();
  42675. }
  42676. };
  42677. function Timeout(id, clearFn) {
  42678. this._id = id;
  42679. this._clearFn = clearFn;
  42680. }
  42681. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42682. Timeout.prototype.close = function() {
  42683. this._clearFn.call(scope, this._id);
  42684. };
  42685. // Does not start the time, just sets up the members needed.
  42686. exports.enroll = function(item, msecs) {
  42687. clearTimeout(item._idleTimeoutId);
  42688. item._idleTimeout = msecs;
  42689. };
  42690. exports.unenroll = function(item) {
  42691. clearTimeout(item._idleTimeoutId);
  42692. item._idleTimeout = -1;
  42693. };
  42694. exports._unrefActive = exports.active = function(item) {
  42695. clearTimeout(item._idleTimeoutId);
  42696. var msecs = item._idleTimeout;
  42697. if (msecs >= 0) {
  42698. item._idleTimeoutId = setTimeout(function onTimeout() {
  42699. if (item._onTimeout)
  42700. item._onTimeout();
  42701. }, msecs);
  42702. }
  42703. };
  42704. // setimmediate attaches itself to the global object
  42705. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42706. // On some exotic environments, it's not clear which object `setimmediate` was
  42707. // able to install onto. Search each possibility in the same order as the
  42708. // `setimmediate` library.
  42709. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42710. (typeof global !== "undefined" && global.setImmediate) ||
  42711. (this && this.setImmediate);
  42712. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42713. (typeof global !== "undefined" && global.clearImmediate) ||
  42714. (this && this.clearImmediate);
  42715. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42716. /***/ }),
  42717. /***/ "./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&":
  42718. /*!*******************************************************************************************************************************************************************************************************************!*\
  42719. !*** ./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& ***!
  42720. \*******************************************************************************************************************************************************************************************************************/
  42721. /*! exports provided: render, staticRenderFns */
  42722. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42723. "use strict";
  42724. __webpack_require__.r(__webpack_exports__);
  42725. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42726. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42727. var render = function() {
  42728. var _vm = this
  42729. var _h = _vm.$createElement
  42730. var _c = _vm._self._c || _h
  42731. return _vm._m(0)
  42732. }
  42733. var staticRenderFns = [
  42734. function() {
  42735. var _vm = this
  42736. var _h = _vm.$createElement
  42737. var _c = _vm._self._c || _h
  42738. return _c("div", { staticClass: "container" }, [
  42739. _c("div", { staticClass: "row justify-content-center" }, [
  42740. _c("div", { staticClass: "col-md-8" }, [
  42741. _c("div", { staticClass: "card" }, [
  42742. _c("div", { staticClass: "card-header" }, [
  42743. _vm._v("Example Component")
  42744. ]),
  42745. _vm._v(" "),
  42746. _c("div", { staticClass: "card-body" }, [
  42747. _vm._v(
  42748. "\n I'm an example component.\n "
  42749. )
  42750. ])
  42751. ])
  42752. ])
  42753. ])
  42754. ])
  42755. }
  42756. ]
  42757. render._withStripped = true
  42758. /***/ }),
  42759. /***/ "./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&":
  42760. /*!************************************************************************************************************************************************************************************************************!*\
  42761. !*** ./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& ***!
  42762. \************************************************************************************************************************************************************************************************************/
  42763. /*! exports provided: render, staticRenderFns */
  42764. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42765. "use strict";
  42766. __webpack_require__.r(__webpack_exports__);
  42767. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42768. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42769. var render = function() {
  42770. var _vm = this
  42771. var _h = _vm.$createElement
  42772. var _c = _vm._self._c || _h
  42773. return _c(
  42774. "div",
  42775. [
  42776. _c(
  42777. "modal",
  42778. {
  42779. attrs: {
  42780. id: "asseteditModal",
  42781. tabindex: "-1",
  42782. role: "dialog",
  42783. "aria-labelledby": "asseteditModalLabel"
  42784. }
  42785. },
  42786. [
  42787. _c(
  42788. "h5",
  42789. {
  42790. staticClass: "modal-title",
  42791. attrs: { slot: "header", id: "asseteditModalLabel" },
  42792. slot: "header"
  42793. },
  42794. [_vm._v("\n Edit Work Order Information\n ")]
  42795. ),
  42796. _vm._v(" "),
  42797. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  42798. _c("div", { staticClass: "form-group" }, [
  42799. _c("label", { attrs: { for: "manufacturer" } }, [
  42800. _vm._v("Manufacturer")
  42801. ]),
  42802. _vm._v(" "),
  42803. _c("input", {
  42804. directives: [
  42805. {
  42806. name: "model",
  42807. rawName: "v-model.lazy",
  42808. value: _vm.data.pcmanu,
  42809. expression: "data.pcmanu",
  42810. modifiers: { lazy: true }
  42811. }
  42812. ],
  42813. staticClass: "form-control",
  42814. attrs: {
  42815. type: "text",
  42816. name: "manufacturer",
  42817. id: "manufacturer"
  42818. },
  42819. domProps: { value: _vm.data.pcmanu },
  42820. on: {
  42821. change: function($event) {
  42822. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  42823. }
  42824. }
  42825. })
  42826. ]),
  42827. _vm._v(" "),
  42828. _c("div", { staticClass: "form-group" }, [
  42829. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  42830. _vm._v(" "),
  42831. _c("input", {
  42832. directives: [
  42833. {
  42834. name: "model",
  42835. rawName: "v-model.lazy",
  42836. value: _vm.data.pcmake,
  42837. expression: "data.pcmake",
  42838. modifiers: { lazy: true }
  42839. }
  42840. ],
  42841. staticClass: "form-control",
  42842. attrs: { type: "text", name: "make", id: "make" },
  42843. domProps: { value: _vm.data.pcmake },
  42844. on: {
  42845. change: function($event) {
  42846. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  42847. }
  42848. }
  42849. })
  42850. ]),
  42851. _vm._v(" "),
  42852. _c("div", { staticClass: "form-group" }, [
  42853. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  42854. _vm._v(" "),
  42855. _c("input", {
  42856. directives: [
  42857. {
  42858. name: "model",
  42859. rawName: "v-model.lazy",
  42860. value: _vm.data.pcnickname,
  42861. expression: "data.pcnickname",
  42862. modifiers: { lazy: true }
  42863. }
  42864. ],
  42865. staticClass: "form-control",
  42866. attrs: { type: "text", name: "nickname", id: "nickname" },
  42867. domProps: { value: _vm.data.pcnickname },
  42868. on: {
  42869. change: function($event) {
  42870. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  42871. }
  42872. }
  42873. })
  42874. ]),
  42875. _vm._v(" "),
  42876. _c("div", { staticClass: "form-group" }, [
  42877. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  42878. _vm._v(" "),
  42879. _c("input", {
  42880. directives: [
  42881. {
  42882. name: "model",
  42883. rawName: "v-model.lazy",
  42884. value: _vm.pcextra[2],
  42885. expression: "pcextra[2]",
  42886. modifiers: { lazy: true }
  42887. }
  42888. ],
  42889. staticClass: "form-control",
  42890. attrs: { type: "text", name: "os", id: "os" },
  42891. domProps: { value: _vm.pcextra[2] },
  42892. on: {
  42893. change: function($event) {
  42894. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  42895. }
  42896. }
  42897. })
  42898. ]),
  42899. _vm._v(" "),
  42900. _c("div", { staticClass: "form-group" }, [
  42901. _c("label", { attrs: { for: "serial" } }, [
  42902. _vm._v("Serial Number")
  42903. ]),
  42904. _vm._v(" "),
  42905. _c("input", {
  42906. directives: [
  42907. {
  42908. name: "model",
  42909. rawName: "v-model.lazy",
  42910. value: _vm.pcextra[104],
  42911. expression: "pcextra[104]",
  42912. modifiers: { lazy: true }
  42913. }
  42914. ],
  42915. staticClass: "form-control",
  42916. attrs: { type: "text", id: "serial", name: "serial" },
  42917. domProps: { value: _vm.pcextra[104] },
  42918. on: {
  42919. change: function($event) {
  42920. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  42921. }
  42922. }
  42923. })
  42924. ]),
  42925. _vm._v(" "),
  42926. _c("div", { staticClass: "form-group" }, [
  42927. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  42928. _vm._v(" "),
  42929. _c("input", {
  42930. directives: [
  42931. {
  42932. name: "model",
  42933. rawName: "v-model.lazy",
  42934. value: _vm.pcextra[101],
  42935. expression: "pcextra[101]",
  42936. modifiers: { lazy: true }
  42937. }
  42938. ],
  42939. staticClass: "form-control",
  42940. attrs: { type: "text", id: "cpu", name: "cpu" },
  42941. domProps: { value: _vm.pcextra[101] },
  42942. on: {
  42943. change: function($event) {
  42944. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  42945. }
  42946. }
  42947. })
  42948. ]),
  42949. _vm._v(" "),
  42950. _c("div", { staticClass: "form-group" }, [
  42951. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  42952. _vm._v(" "),
  42953. _c("input", {
  42954. directives: [
  42955. {
  42956. name: "model",
  42957. rawName: "v-model.lazy",
  42958. value: _vm.pcextra[100],
  42959. expression: "pcextra[100]",
  42960. modifiers: { lazy: true }
  42961. }
  42962. ],
  42963. staticClass: "form-control",
  42964. attrs: { type: "text", name: "ram", id: "ram" },
  42965. domProps: { value: _vm.pcextra[100] },
  42966. on: {
  42967. change: function($event) {
  42968. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  42969. }
  42970. }
  42971. })
  42972. ]),
  42973. _vm._v(" "),
  42974. _c("div", { staticClass: "form-group" }, [
  42975. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  42976. _vm._v(" "),
  42977. _c("input", {
  42978. directives: [
  42979. {
  42980. name: "model",
  42981. rawName: "v-model.lazy",
  42982. value: _vm.pcextra[4],
  42983. expression: "pcextra[4]",
  42984. modifiers: { lazy: true }
  42985. }
  42986. ],
  42987. staticClass: "form-control",
  42988. attrs: { type: "text", name: "graphics", id: "grapics" },
  42989. domProps: { value: _vm.pcextra[4] },
  42990. on: {
  42991. change: function($event) {
  42992. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  42993. }
  42994. }
  42995. })
  42996. ])
  42997. ]),
  42998. _vm._v(" "),
  42999. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43000. _c(
  43001. "button",
  43002. {
  43003. staticClass: "btn btn-secondary",
  43004. attrs: { type: "button", "data-dismiss": "modal" }
  43005. },
  43006. [_vm._v("Close")]
  43007. ),
  43008. _vm._v(" "),
  43009. _c(
  43010. "button",
  43011. {
  43012. staticClass: "btn btn-primary",
  43013. attrs: { type: "button" },
  43014. on: {
  43015. click: function($event) {
  43016. return _vm.updateAsset()
  43017. }
  43018. }
  43019. },
  43020. [_vm._v("Save")]
  43021. )
  43022. ])
  43023. ]
  43024. ),
  43025. _vm._v(" "),
  43026. _c("h4", { staticClass: "text-center" }, [
  43027. _vm._v(
  43028. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43029. ),
  43030. _c("small", { staticClass: "text-muted" }, [
  43031. _vm._v(_vm._s(this.data.pcnickname))
  43032. ])
  43033. ]),
  43034. _vm._v(" "),
  43035. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43036. _vm._v(" "),
  43037. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43038. _vm._v(" "),
  43039. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43040. _vm._v(" "),
  43041. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43042. _vm._v(" "),
  43043. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43044. _vm._v(" "),
  43045. _c(
  43046. "button",
  43047. {
  43048. staticClass: "btn btn-primary",
  43049. attrs: {
  43050. type: "button",
  43051. "data-toggle": "modal",
  43052. "data-target": "#asseteditModal"
  43053. }
  43054. },
  43055. [_vm._v("Edit")]
  43056. )
  43057. ],
  43058. 1
  43059. )
  43060. }
  43061. var staticRenderFns = []
  43062. render._withStripped = true
  43063. /***/ }),
  43064. /***/ "./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&":
  43065. /*!************************************************************************************************************************************************************************************************************************!*\
  43066. !*** ./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& ***!
  43067. \************************************************************************************************************************************************************************************************************************/
  43068. /*! exports provided: render, staticRenderFns */
  43069. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43070. "use strict";
  43071. __webpack_require__.r(__webpack_exports__);
  43072. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43073. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43074. var render = function() {
  43075. var _vm = this
  43076. var _h = _vm.$createElement
  43077. var _c = _vm._self._c || _h
  43078. return _c(
  43079. "modal",
  43080. {
  43081. attrs: {
  43082. id: _vm.id,
  43083. tabindex: "-1",
  43084. role: "dialog",
  43085. "aria-labelledby": _vm.id + "Label"
  43086. }
  43087. },
  43088. [
  43089. _c(
  43090. "h5",
  43091. {
  43092. staticClass: "modal-title",
  43093. attrs: { slot: "header", id: _vm.id + "Label" },
  43094. slot: "header"
  43095. },
  43096. [_vm._v("\n Edit Credential\n ")]
  43097. ),
  43098. _vm._v(" "),
  43099. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43100. _c("div", { staticClass: "form-group" }, [
  43101. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43102. _vm._v(" "),
  43103. _c("input", {
  43104. directives: [
  43105. {
  43106. name: "model",
  43107. rawName: "v-model",
  43108. value: _vm.data.creduser,
  43109. expression: "data.creduser"
  43110. }
  43111. ],
  43112. staticClass: "form-control credential",
  43113. attrs: {
  43114. type: "text",
  43115. name: "newusername" + _vm.data.credid,
  43116. id: "newusername" + _vm.data.credid
  43117. },
  43118. domProps: { value: _vm.data.creduser },
  43119. on: {
  43120. input: function($event) {
  43121. if ($event.target.composing) {
  43122. return
  43123. }
  43124. _vm.$set(_vm.data, "creduser", $event.target.value)
  43125. }
  43126. }
  43127. })
  43128. ]),
  43129. _vm._v(" "),
  43130. _c("div", { staticClass: "form-group" }, [
  43131. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43132. _vm._v(" "),
  43133. _c("input", {
  43134. directives: [
  43135. {
  43136. name: "model",
  43137. rawName: "v-model",
  43138. value: _vm.data.credpass,
  43139. expression: "data.credpass"
  43140. }
  43141. ],
  43142. staticClass: "form-control credential",
  43143. attrs: {
  43144. type: "text",
  43145. name: "newpassword" + _vm.data.credid,
  43146. id: "newpassword" + _vm.data.credid
  43147. },
  43148. domProps: { value: _vm.data.credpass },
  43149. on: {
  43150. input: function($event) {
  43151. if ($event.target.composing) {
  43152. return
  43153. }
  43154. _vm.$set(_vm.data, "credpass", $event.target.value)
  43155. }
  43156. }
  43157. }),
  43158. _vm._v(" "),
  43159. _c(
  43160. "button",
  43161. {
  43162. staticClass: "btn btn-secondary",
  43163. attrs: { type: "button" },
  43164. on: {
  43165. click: function($event) {
  43166. return _vm.getRandomPassword(_vm.data.credid)
  43167. }
  43168. }
  43169. },
  43170. [_vm._v("Generate Random")]
  43171. )
  43172. ]),
  43173. _vm._v(" "),
  43174. _c("div", { staticClass: "form-group" })
  43175. ]),
  43176. _vm._v(" "),
  43177. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43178. _c(
  43179. "button",
  43180. {
  43181. staticClass: "btn btn-secondary",
  43182. attrs: { type: "button", "data-dismiss": "modal" }
  43183. },
  43184. [_vm._v("Close")]
  43185. ),
  43186. _vm._v(" "),
  43187. _c(
  43188. "button",
  43189. {
  43190. staticClass: "btn btn-primary",
  43191. attrs: { type: "button" },
  43192. on: {
  43193. click: function($event) {
  43194. return _vm.updateCredential()
  43195. }
  43196. }
  43197. },
  43198. [_vm._v("Save")]
  43199. )
  43200. ])
  43201. ]
  43202. )
  43203. }
  43204. var staticRenderFns = []
  43205. render._withStripped = true
  43206. /***/ }),
  43207. /***/ "./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&":
  43208. /*!*************************************************************************************************************************************************************************************************************!*\
  43209. !*** ./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& ***!
  43210. \*************************************************************************************************************************************************************************************************************/
  43211. /*! exports provided: render, staticRenderFns */
  43212. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43213. "use strict";
  43214. __webpack_require__.r(__webpack_exports__);
  43215. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43216. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43217. var render = function() {
  43218. var _vm = this
  43219. var _h = _vm.$createElement
  43220. var _c = _vm._self._c || _h
  43221. return _c(
  43222. "div",
  43223. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43224. [
  43225. _c("credential-form-modal", {
  43226. attrs: {
  43227. "modal-id": "credential" + this.data.credid + "editModal",
  43228. populateWith: this.data
  43229. }
  43230. }),
  43231. _vm._v(" "),
  43232. _c("div", { staticClass: "row no-gutters" }, [
  43233. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43234. _vm._v(_vm._s(this.data.creddesc))
  43235. ]),
  43236. _vm._v(" "),
  43237. _c("div", { staticClass: "col-9 text-right" }, [
  43238. _vm._v(_vm._s(this.data.creddate))
  43239. ])
  43240. ]),
  43241. _vm._v(" "),
  43242. _c("div", { staticClass: "row" }, [
  43243. _c("div", { staticClass: "col-lg-9" }, [
  43244. _c("div", [
  43245. _vm._m(0),
  43246. _vm._v(" "),
  43247. _c("input", {
  43248. staticClass: "border-0 credential",
  43249. attrs: {
  43250. type: "text",
  43251. id: "username" + this.data.credid,
  43252. readonly: ""
  43253. },
  43254. domProps: { value: this.data.creduser }
  43255. }),
  43256. _vm._v(" "),
  43257. _c(
  43258. "button",
  43259. {
  43260. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43261. attrs: {
  43262. id: "btn-username" + this.data.credid,
  43263. "data-clipboard-target": "#username" + this.data.credid
  43264. }
  43265. },
  43266. [_c("i", { staticClass: "far fa-clone" })]
  43267. )
  43268. ]),
  43269. _vm._v(" "),
  43270. _c("div", [
  43271. _vm._m(1),
  43272. _vm._v(" "),
  43273. _c("input", {
  43274. staticClass: "border-0 credential",
  43275. attrs: {
  43276. type: "text",
  43277. id: "password" + this.data.credid,
  43278. readonly: ""
  43279. },
  43280. domProps: { value: this.data.credpass }
  43281. }),
  43282. _vm._v(" "),
  43283. _c(
  43284. "button",
  43285. {
  43286. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43287. attrs: {
  43288. id: "btn-password" + this.data.credid,
  43289. "data-clipboard-target": "#password" + this.data.credid
  43290. }
  43291. },
  43292. [_c("i", { staticClass: "far fa-clone" })]
  43293. )
  43294. ])
  43295. ]),
  43296. _vm._v(" "),
  43297. _c(
  43298. "div",
  43299. {
  43300. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43301. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43302. },
  43303. [
  43304. _c(
  43305. "button",
  43306. {
  43307. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43308. attrs: {
  43309. type: "button",
  43310. "data-toggle": "modal",
  43311. "data-target": "#credential" + this.data.credid + "editModal"
  43312. }
  43313. },
  43314. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43315. ),
  43316. _vm._v(" "),
  43317. _vm._m(2)
  43318. ]
  43319. )
  43320. ])
  43321. ],
  43322. 1
  43323. )
  43324. }
  43325. var staticRenderFns = [
  43326. function() {
  43327. var _vm = this
  43328. var _h = _vm.$createElement
  43329. var _c = _vm._self._c || _h
  43330. return _c("label", { attrs: { for: "username" } }, [
  43331. _c("i", { staticClass: "fas fa-fw fa-user" })
  43332. ])
  43333. },
  43334. function() {
  43335. var _vm = this
  43336. var _h = _vm.$createElement
  43337. var _c = _vm._self._c || _h
  43338. return _c("label", { attrs: { for: "password" } }, [
  43339. _c("i", { staticClass: "fas fa-fw fa-key" })
  43340. ])
  43341. },
  43342. function() {
  43343. var _vm = this
  43344. var _h = _vm.$createElement
  43345. var _c = _vm._self._c || _h
  43346. return _c(
  43347. "button",
  43348. {
  43349. staticClass: "btn btn-sm btn-danger p-lg-1",
  43350. attrs: { type: "button" }
  43351. },
  43352. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43353. )
  43354. }
  43355. ]
  43356. render._withStripped = true
  43357. /***/ }),
  43358. /***/ "./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&":
  43359. /*!************************************************************************************************************************************************************************************************************!*\
  43360. !*** ./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& ***!
  43361. \************************************************************************************************************************************************************************************************************/
  43362. /*! exports provided: render, staticRenderFns */
  43363. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43364. "use strict";
  43365. __webpack_require__.r(__webpack_exports__);
  43366. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43367. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43368. var render = function() {
  43369. var _vm = this
  43370. var _h = _vm.$createElement
  43371. var _c = _vm._self._c || _h
  43372. return _c(
  43373. "ul",
  43374. { staticClass: "list-unstyled" },
  43375. _vm._l(_vm.errorList, function(error) {
  43376. return _c("li", { key: error, staticClass: "text-danger" }, [
  43377. _vm._v(" " + _vm._s(error) + " ")
  43378. ])
  43379. }),
  43380. 0
  43381. )
  43382. }
  43383. var staticRenderFns = []
  43384. render._withStripped = true
  43385. /***/ }),
  43386. /***/ "./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&":
  43387. /*!********************************************************************************************************************************************************************************************************!*\
  43388. !*** ./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& ***!
  43389. \********************************************************************************************************************************************************************************************************/
  43390. /*! exports provided: render, staticRenderFns */
  43391. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43392. "use strict";
  43393. __webpack_require__.r(__webpack_exports__);
  43394. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43395. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43396. var render = function() {
  43397. var _vm = this
  43398. var _h = _vm.$createElement
  43399. var _c = _vm._self._c || _h
  43400. return _c("div", { staticClass: "modal fade" }, [
  43401. _c(
  43402. "div",
  43403. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43404. [
  43405. _c("div", { staticClass: "modal-content" }, [
  43406. _c(
  43407. "div",
  43408. { staticClass: "modal-header" },
  43409. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43410. 2
  43411. ),
  43412. _vm._v(" "),
  43413. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43414. _vm._v(" "),
  43415. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43416. ])
  43417. ]
  43418. )
  43419. ])
  43420. }
  43421. var staticRenderFns = [
  43422. function() {
  43423. var _vm = this
  43424. var _h = _vm.$createElement
  43425. var _c = _vm._self._c || _h
  43426. return _c(
  43427. "button",
  43428. {
  43429. staticClass: "close",
  43430. attrs: {
  43431. type: "button",
  43432. "data-dismiss": "modal",
  43433. "aria-label": "Close"
  43434. }
  43435. },
  43436. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43437. )
  43438. }
  43439. ]
  43440. render._withStripped = true
  43441. /***/ }),
  43442. /***/ "./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&":
  43443. /*!********************************************************************************************************************************************************************************************************!*\
  43444. !*** ./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& ***!
  43445. \********************************************************************************************************************************************************************************************************/
  43446. /*! exports provided: render, staticRenderFns */
  43447. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43448. "use strict";
  43449. __webpack_require__.r(__webpack_exports__);
  43450. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43451. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43452. var render = function() {
  43453. var _vm = this
  43454. var _h = _vm.$createElement
  43455. var _c = _vm._self._c || _h
  43456. return _c(
  43457. "ul",
  43458. { staticClass: "list-unstyled" },
  43459. _vm._l(this.notes, function(note) {
  43460. return _c(
  43461. "li",
  43462. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43463. [
  43464. _c(
  43465. "modal",
  43466. {
  43467. attrs: {
  43468. id: "note" + note.noteid + "editModal",
  43469. tabindex: "-1",
  43470. role: "dialog",
  43471. "aria-labelledby": "note" + note.noteid + "editModalLabel"
  43472. }
  43473. },
  43474. [
  43475. _c(
  43476. "h5",
  43477. {
  43478. staticClass: "modal-title",
  43479. attrs: {
  43480. slot: "header",
  43481. id: "note" + note.noteid + "editModalLabel"
  43482. },
  43483. slot: "header"
  43484. },
  43485. [_vm._v("\n Edit Note\n ")]
  43486. ),
  43487. _vm._v(" "),
  43488. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43489. _c("div", { staticClass: "form-group" }, [
  43490. _c("label", { attrs: { for: "content" } }, [
  43491. _vm._v("Content")
  43492. ]),
  43493. _vm._v(" "),
  43494. _c("textarea", {
  43495. directives: [
  43496. {
  43497. name: "model",
  43498. rawName: "v-model",
  43499. value: note.thenote,
  43500. expression: "note.thenote"
  43501. }
  43502. ],
  43503. staticClass: "form-control",
  43504. attrs: {
  43505. name: "content" + note.noteid,
  43506. id: "content" + note.noteid
  43507. },
  43508. domProps: { value: note.thenote },
  43509. on: {
  43510. input: function($event) {
  43511. if ($event.target.composing) {
  43512. return
  43513. }
  43514. _vm.$set(note, "thenote", $event.target.value)
  43515. }
  43516. }
  43517. })
  43518. ])
  43519. ]),
  43520. _vm._v(" "),
  43521. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43522. _c(
  43523. "button",
  43524. {
  43525. staticClass: "btn btn-secondary",
  43526. attrs: { type: "button", "data-dismiss": "modal" }
  43527. },
  43528. [_vm._v("Close")]
  43529. ),
  43530. _vm._v(" "),
  43531. _c(
  43532. "button",
  43533. {
  43534. staticClass: "btn btn-primary",
  43535. attrs: { type: "button" },
  43536. on: {
  43537. click: function($event) {
  43538. return _vm.updateNote(note.noteid)
  43539. }
  43540. }
  43541. },
  43542. [_vm._v("Save")]
  43543. )
  43544. ])
  43545. ]
  43546. ),
  43547. _vm._v(" "),
  43548. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  43549. _c("div", { staticClass: "text-center p-0 m-0" }, [
  43550. _vm._v(_vm._s(note.noteuser))
  43551. ]),
  43552. _vm._v(" "),
  43553. _c(
  43554. "div",
  43555. { staticClass: "text-muted text-small text-center p-0 m-0" },
  43556. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  43557. ),
  43558. _vm._v(" "),
  43559. _c(
  43560. "div",
  43561. { staticClass: "btn-group justify-content-center p-0 m-0" },
  43562. [
  43563. _vm.authusername === note.noteuser ||
  43564. _vm.authusername === "admin"
  43565. ? [
  43566. _c(
  43567. "button",
  43568. {
  43569. staticClass: "btn btn-sm btn-primary m-1",
  43570. attrs: {
  43571. "data-toggle": "modal",
  43572. "data-target": "#note" + note.noteid + "editModal"
  43573. }
  43574. },
  43575. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43576. ),
  43577. _vm._v(" "),
  43578. _vm._m(0, true),
  43579. _vm._v(" "),
  43580. _vm._m(1, true)
  43581. ]
  43582. : _vm._e()
  43583. ],
  43584. 2
  43585. )
  43586. ]),
  43587. _vm._v(" "),
  43588. _c("div", { staticClass: "col-md-10" }, [
  43589. _c("div", { staticClass: "card m-2" }, [
  43590. _c("div", { staticClass: "card-body p-2" }, [
  43591. _vm._v(
  43592. "\n " +
  43593. _vm._s(note.thenote) +
  43594. "\n "
  43595. )
  43596. ])
  43597. ])
  43598. ])
  43599. ],
  43600. 1
  43601. )
  43602. }),
  43603. 0
  43604. )
  43605. }
  43606. var staticRenderFns = [
  43607. function() {
  43608. var _vm = this
  43609. var _h = _vm.$createElement
  43610. var _c = _vm._self._c || _h
  43611. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  43612. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  43613. ])
  43614. },
  43615. function() {
  43616. var _vm = this
  43617. var _h = _vm.$createElement
  43618. var _c = _vm._self._c || _h
  43619. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  43620. _c("i", { staticClass: "fa fa-fw fa-random" })
  43621. ])
  43622. }
  43623. ]
  43624. render._withStripped = true
  43625. /***/ }),
  43626. /***/ "./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&":
  43627. /*!********************************************************************************************************************************************************************************************************************!*\
  43628. !*** ./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& ***!
  43629. \********************************************************************************************************************************************************************************************************************/
  43630. /*! exports provided: render, staticRenderFns */
  43631. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43632. "use strict";
  43633. __webpack_require__.r(__webpack_exports__);
  43634. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43635. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43636. var render = function() {
  43637. var _vm = this
  43638. var _h = _vm.$createElement
  43639. var _c = _vm._self._c || _h
  43640. return _c(
  43641. "modal",
  43642. {
  43643. attrs: {
  43644. id: _vm.id,
  43645. tabindex: "-1",
  43646. role: "dialog",
  43647. "aria-labelledby": _vm.id + "Label"
  43648. }
  43649. },
  43650. [
  43651. _c(
  43652. "h5",
  43653. {
  43654. staticClass: "modal-title",
  43655. attrs: { slot: "header", id: _vm.id + "Label" },
  43656. slot: "header"
  43657. },
  43658. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  43659. ),
  43660. _vm._v(" "),
  43661. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43662. _c(
  43663. "div",
  43664. { staticClass: "form-group" },
  43665. [
  43666. _c("label", { attrs: { for: "probdesc" } }, [
  43667. _vm._v("Problem Description")
  43668. ]),
  43669. _vm._v(" "),
  43670. _c("textarea", {
  43671. directives: [
  43672. {
  43673. name: "model",
  43674. rawName: "v-model",
  43675. value: _vm.data.probdesc,
  43676. expression: "data.probdesc"
  43677. }
  43678. ],
  43679. class: {
  43680. "form-control": true,
  43681. "is-invalid": _vm.errors.probdesc
  43682. },
  43683. attrs: { id: "probdesc", name: "probdesc" },
  43684. domProps: { value: _vm.data.probdesc },
  43685. on: {
  43686. input: function($event) {
  43687. if ($event.target.composing) {
  43688. return
  43689. }
  43690. _vm.$set(_vm.data, "probdesc", $event.target.value)
  43691. }
  43692. }
  43693. }),
  43694. _vm._v(" "),
  43695. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  43696. ],
  43697. 1
  43698. ),
  43699. _vm._v(" "),
  43700. _c(
  43701. "div",
  43702. { staticClass: "form-group" },
  43703. [
  43704. _c("label", { attrs: { for: "suggested" } }, [
  43705. _vm._v("Suggested Solution")
  43706. ]),
  43707. _vm._v(" "),
  43708. _c("textarea", {
  43709. directives: [
  43710. {
  43711. name: "model",
  43712. rawName: "v-model",
  43713. value: _vm.data.suggested,
  43714. expression: "data.suggested"
  43715. }
  43716. ],
  43717. class: {
  43718. "form-control": true,
  43719. "is-invalid": _vm.errors.suggested
  43720. },
  43721. attrs: { id: "suggested", name: "suggested" },
  43722. domProps: { value: _vm.data.suggested },
  43723. on: {
  43724. input: function($event) {
  43725. if ($event.target.composing) {
  43726. return
  43727. }
  43728. _vm.$set(_vm.data, "suggested", $event.target.value)
  43729. }
  43730. }
  43731. }),
  43732. _vm._v(" "),
  43733. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  43734. ],
  43735. 1
  43736. ),
  43737. _vm._v(" "),
  43738. _c("div", { staticClass: "form-group" }, [
  43739. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  43740. _vm._v(" "),
  43741. _vm.storeList
  43742. ? _c(
  43743. "select",
  43744. {
  43745. directives: [
  43746. {
  43747. name: "model",
  43748. rawName: "v-model",
  43749. value: _vm.data.storeid,
  43750. expression: "data.storeid"
  43751. }
  43752. ],
  43753. staticClass: "form-control",
  43754. attrs: { name: "storelist", id: "storelist" },
  43755. on: {
  43756. change: function($event) {
  43757. var $$selectedVal = Array.prototype.filter
  43758. .call($event.target.options, function(o) {
  43759. return o.selected
  43760. })
  43761. .map(function(o) {
  43762. var val = "_value" in o ? o._value : o.value
  43763. return val
  43764. })
  43765. _vm.$set(
  43766. _vm.data,
  43767. "storeid",
  43768. $event.target.multiple
  43769. ? $$selectedVal
  43770. : $$selectedVal[0]
  43771. )
  43772. }
  43773. }
  43774. },
  43775. _vm._l(_vm.storeList, function(store) {
  43776. return _c(
  43777. "option",
  43778. { key: store.storeid, domProps: { value: store.storeid } },
  43779. [
  43780. _vm._v(
  43781. "\r\n " +
  43782. _vm._s(store.storesname) +
  43783. "\r\n "
  43784. )
  43785. ]
  43786. )
  43787. }),
  43788. 0
  43789. )
  43790. : _vm._e()
  43791. ])
  43792. ]),
  43793. _vm._v(" "),
  43794. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43795. _c(
  43796. "button",
  43797. {
  43798. staticClass: "btn btn-secondary",
  43799. attrs: { type: "button", "data-dismiss": "modal" }
  43800. },
  43801. [_vm._v("Close")]
  43802. ),
  43803. _vm._v(" "),
  43804. _c(
  43805. "button",
  43806. {
  43807. staticClass: "btn btn-primary",
  43808. attrs: { type: "button" },
  43809. on: {
  43810. click: function($event) {
  43811. return _vm.updateWorkOrder()
  43812. }
  43813. }
  43814. },
  43815. [_vm._v("Save")]
  43816. )
  43817. ])
  43818. ]
  43819. )
  43820. }
  43821. var staticRenderFns = []
  43822. render._withStripped = true
  43823. /***/ }),
  43824. /***/ "./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&":
  43825. /*!*********************************************************************************************************************************************************************************************************!*\
  43826. !*** ./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& ***!
  43827. \*********************************************************************************************************************************************************************************************************/
  43828. /*! exports provided: render, staticRenderFns */
  43829. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43830. "use strict";
  43831. __webpack_require__.r(__webpack_exports__);
  43832. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43833. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43834. var render = function() {
  43835. var _vm = this
  43836. var _h = _vm.$createElement
  43837. var _c = _vm._self._c || _h
  43838. return _c(
  43839. "div",
  43840. [
  43841. _c("woinfo-edit-modal", {
  43842. attrs: {
  43843. "modal-id": "workordereditModal",
  43844. "populate-with": this.data,
  43845. "store-list": this.storeList
  43846. }
  43847. }),
  43848. _vm._v(" "),
  43849. _c("p", [
  43850. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  43851. _vm._v(" "),
  43852. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  43853. ]),
  43854. _vm._v(" "),
  43855. _c("p", [
  43856. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  43857. _vm._v(" "),
  43858. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  43859. ]),
  43860. _vm._v(" "),
  43861. _c("p", [
  43862. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  43863. _vm._v(" "),
  43864. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  43865. ]),
  43866. _vm._v(" "),
  43867. _c("p", [
  43868. _c("i", { staticClass: "fas fa-fw fa-building" }),
  43869. _vm._v(" "),
  43870. this.storeList
  43871. ? _c("span", [
  43872. _vm._v(_vm._s(this.storeList[this.data.storeid].storesname))
  43873. ])
  43874. : _vm._e()
  43875. ]),
  43876. _vm._v(" "),
  43877. _c("p", [
  43878. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  43879. _vm._v(" "),
  43880. _c(
  43881. "span",
  43882. {
  43883. staticClass: "dashed-underline",
  43884. attrs: {
  43885. "data-toggle": "tooltip",
  43886. "data-placement": "bottom",
  43887. title: this.getHRDate(this.data.dropdate)
  43888. }
  43889. },
  43890. [
  43891. _vm._v(
  43892. "\n " +
  43893. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  43894. " days ago\n "
  43895. )
  43896. ]
  43897. )
  43898. ]),
  43899. _vm._v(" "),
  43900. _c("p", [
  43901. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  43902. _vm._v(" "),
  43903. !this.isZero(this.data.pickupdate)
  43904. ? _c(
  43905. "span",
  43906. {
  43907. staticClass: "dashed-underline",
  43908. attrs: {
  43909. "data-toggle": "tooltip",
  43910. "data-placement": "bottom",
  43911. title: this.getHRDate(this.data.pickupdate)
  43912. }
  43913. },
  43914. [
  43915. _vm._v(
  43916. "\n " +
  43917. _vm._s(
  43918. Math.floor(this.daysSinceToday(this.data.pickupdate))
  43919. ) +
  43920. " days ago\n "
  43921. )
  43922. ]
  43923. )
  43924. : _vm._e()
  43925. ]),
  43926. _vm._v(" "),
  43927. _c(
  43928. "button",
  43929. {
  43930. staticClass: "btn btn-primary",
  43931. attrs: {
  43932. type: "button",
  43933. "data-toggle": "modal",
  43934. "data-target": "#workordereditModal"
  43935. }
  43936. },
  43937. [_vm._v("Edit")]
  43938. )
  43939. ],
  43940. 1
  43941. )
  43942. }
  43943. var staticRenderFns = []
  43944. render._withStripped = true
  43945. /***/ }),
  43946. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  43947. /*!********************************************************************!*\
  43948. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  43949. \********************************************************************/
  43950. /*! exports provided: default */
  43951. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43952. "use strict";
  43953. __webpack_require__.r(__webpack_exports__);
  43954. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  43955. /* globals __VUE_SSR_CONTEXT__ */
  43956. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  43957. // This module is a runtime utility for cleaner component module output and will
  43958. // be included in the final webpack user bundle.
  43959. function normalizeComponent (
  43960. scriptExports,
  43961. render,
  43962. staticRenderFns,
  43963. functionalTemplate,
  43964. injectStyles,
  43965. scopeId,
  43966. moduleIdentifier, /* server only */
  43967. shadowMode /* vue-cli only */
  43968. ) {
  43969. // Vue.extend constructor export interop
  43970. var options = typeof scriptExports === 'function'
  43971. ? scriptExports.options
  43972. : scriptExports
  43973. // render functions
  43974. if (render) {
  43975. options.render = render
  43976. options.staticRenderFns = staticRenderFns
  43977. options._compiled = true
  43978. }
  43979. // functional template
  43980. if (functionalTemplate) {
  43981. options.functional = true
  43982. }
  43983. // scopedId
  43984. if (scopeId) {
  43985. options._scopeId = 'data-v-' + scopeId
  43986. }
  43987. var hook
  43988. if (moduleIdentifier) { // server build
  43989. hook = function (context) {
  43990. // 2.3 injection
  43991. context =
  43992. context || // cached call
  43993. (this.$vnode && this.$vnode.ssrContext) || // stateful
  43994. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  43995. // 2.2 with runInNewContext: true
  43996. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  43997. context = __VUE_SSR_CONTEXT__
  43998. }
  43999. // inject component styles
  44000. if (injectStyles) {
  44001. injectStyles.call(this, context)
  44002. }
  44003. // register component module identifier for async chunk inferrence
  44004. if (context && context._registeredComponents) {
  44005. context._registeredComponents.add(moduleIdentifier)
  44006. }
  44007. }
  44008. // used by ssr in case component is cached and beforeCreate
  44009. // never gets called
  44010. options._ssrRegister = hook
  44011. } else if (injectStyles) {
  44012. hook = shadowMode
  44013. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44014. : injectStyles
  44015. }
  44016. if (hook) {
  44017. if (options.functional) {
  44018. // for template-only hot-reload because in that case the render fn doesn't
  44019. // go through the normalizer
  44020. options._injectStyles = hook
  44021. // register for functioal component in vue file
  44022. var originalRender = options.render
  44023. options.render = function renderWithStyleInjection (h, context) {
  44024. hook.call(context)
  44025. return originalRender(h, context)
  44026. }
  44027. } else {
  44028. // inject component registration as beforeCreate hook
  44029. var existing = options.beforeCreate
  44030. options.beforeCreate = existing
  44031. ? [].concat(existing, hook)
  44032. : [hook]
  44033. }
  44034. }
  44035. return {
  44036. exports: scriptExports,
  44037. options: options
  44038. }
  44039. }
  44040. /***/ }),
  44041. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44042. /*!*************************************************!*\
  44043. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44044. \*************************************************/
  44045. /*! no static exports found */
  44046. /***/ (function(module, exports, __webpack_require__) {
  44047. "use strict";
  44048. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44049. * Vue.js v2.6.11
  44050. * (c) 2014-2019 Evan You
  44051. * Released under the MIT License.
  44052. */
  44053. /* */
  44054. var emptyObject = Object.freeze({});
  44055. // These helpers produce better VM code in JS engines due to their
  44056. // explicitness and function inlining.
  44057. function isUndef (v) {
  44058. return v === undefined || v === null
  44059. }
  44060. function isDef (v) {
  44061. return v !== undefined && v !== null
  44062. }
  44063. function isTrue (v) {
  44064. return v === true
  44065. }
  44066. function isFalse (v) {
  44067. return v === false
  44068. }
  44069. /**
  44070. * Check if value is primitive.
  44071. */
  44072. function isPrimitive (value) {
  44073. return (
  44074. typeof value === 'string' ||
  44075. typeof value === 'number' ||
  44076. // $flow-disable-line
  44077. typeof value === 'symbol' ||
  44078. typeof value === 'boolean'
  44079. )
  44080. }
  44081. /**
  44082. * Quick object check - this is primarily used to tell
  44083. * Objects from primitive values when we know the value
  44084. * is a JSON-compliant type.
  44085. */
  44086. function isObject (obj) {
  44087. return obj !== null && typeof obj === 'object'
  44088. }
  44089. /**
  44090. * Get the raw type string of a value, e.g., [object Object].
  44091. */
  44092. var _toString = Object.prototype.toString;
  44093. function toRawType (value) {
  44094. return _toString.call(value).slice(8, -1)
  44095. }
  44096. /**
  44097. * Strict object type check. Only returns true
  44098. * for plain JavaScript objects.
  44099. */
  44100. function isPlainObject (obj) {
  44101. return _toString.call(obj) === '[object Object]'
  44102. }
  44103. function isRegExp (v) {
  44104. return _toString.call(v) === '[object RegExp]'
  44105. }
  44106. /**
  44107. * Check if val is a valid array index.
  44108. */
  44109. function isValidArrayIndex (val) {
  44110. var n = parseFloat(String(val));
  44111. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44112. }
  44113. function isPromise (val) {
  44114. return (
  44115. isDef(val) &&
  44116. typeof val.then === 'function' &&
  44117. typeof val.catch === 'function'
  44118. )
  44119. }
  44120. /**
  44121. * Convert a value to a string that is actually rendered.
  44122. */
  44123. function toString (val) {
  44124. return val == null
  44125. ? ''
  44126. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44127. ? JSON.stringify(val, null, 2)
  44128. : String(val)
  44129. }
  44130. /**
  44131. * Convert an input value to a number for persistence.
  44132. * If the conversion fails, return original string.
  44133. */
  44134. function toNumber (val) {
  44135. var n = parseFloat(val);
  44136. return isNaN(n) ? val : n
  44137. }
  44138. /**
  44139. * Make a map and return a function for checking if a key
  44140. * is in that map.
  44141. */
  44142. function makeMap (
  44143. str,
  44144. expectsLowerCase
  44145. ) {
  44146. var map = Object.create(null);
  44147. var list = str.split(',');
  44148. for (var i = 0; i < list.length; i++) {
  44149. map[list[i]] = true;
  44150. }
  44151. return expectsLowerCase
  44152. ? function (val) { return map[val.toLowerCase()]; }
  44153. : function (val) { return map[val]; }
  44154. }
  44155. /**
  44156. * Check if a tag is a built-in tag.
  44157. */
  44158. var isBuiltInTag = makeMap('slot,component', true);
  44159. /**
  44160. * Check if an attribute is a reserved attribute.
  44161. */
  44162. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44163. /**
  44164. * Remove an item from an array.
  44165. */
  44166. function remove (arr, item) {
  44167. if (arr.length) {
  44168. var index = arr.indexOf(item);
  44169. if (index > -1) {
  44170. return arr.splice(index, 1)
  44171. }
  44172. }
  44173. }
  44174. /**
  44175. * Check whether an object has the property.
  44176. */
  44177. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44178. function hasOwn (obj, key) {
  44179. return hasOwnProperty.call(obj, key)
  44180. }
  44181. /**
  44182. * Create a cached version of a pure function.
  44183. */
  44184. function cached (fn) {
  44185. var cache = Object.create(null);
  44186. return (function cachedFn (str) {
  44187. var hit = cache[str];
  44188. return hit || (cache[str] = fn(str))
  44189. })
  44190. }
  44191. /**
  44192. * Camelize a hyphen-delimited string.
  44193. */
  44194. var camelizeRE = /-(\w)/g;
  44195. var camelize = cached(function (str) {
  44196. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44197. });
  44198. /**
  44199. * Capitalize a string.
  44200. */
  44201. var capitalize = cached(function (str) {
  44202. return str.charAt(0).toUpperCase() + str.slice(1)
  44203. });
  44204. /**
  44205. * Hyphenate a camelCase string.
  44206. */
  44207. var hyphenateRE = /\B([A-Z])/g;
  44208. var hyphenate = cached(function (str) {
  44209. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44210. });
  44211. /**
  44212. * Simple bind polyfill for environments that do not support it,
  44213. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44214. * since native bind is now performant enough in most browsers.
  44215. * But removing it would mean breaking code that was able to run in
  44216. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44217. */
  44218. /* istanbul ignore next */
  44219. function polyfillBind (fn, ctx) {
  44220. function boundFn (a) {
  44221. var l = arguments.length;
  44222. return l
  44223. ? l > 1
  44224. ? fn.apply(ctx, arguments)
  44225. : fn.call(ctx, a)
  44226. : fn.call(ctx)
  44227. }
  44228. boundFn._length = fn.length;
  44229. return boundFn
  44230. }
  44231. function nativeBind (fn, ctx) {
  44232. return fn.bind(ctx)
  44233. }
  44234. var bind = Function.prototype.bind
  44235. ? nativeBind
  44236. : polyfillBind;
  44237. /**
  44238. * Convert an Array-like object to a real Array.
  44239. */
  44240. function toArray (list, start) {
  44241. start = start || 0;
  44242. var i = list.length - start;
  44243. var ret = new Array(i);
  44244. while (i--) {
  44245. ret[i] = list[i + start];
  44246. }
  44247. return ret
  44248. }
  44249. /**
  44250. * Mix properties into target object.
  44251. */
  44252. function extend (to, _from) {
  44253. for (var key in _from) {
  44254. to[key] = _from[key];
  44255. }
  44256. return to
  44257. }
  44258. /**
  44259. * Merge an Array of Objects into a single Object.
  44260. */
  44261. function toObject (arr) {
  44262. var res = {};
  44263. for (var i = 0; i < arr.length; i++) {
  44264. if (arr[i]) {
  44265. extend(res, arr[i]);
  44266. }
  44267. }
  44268. return res
  44269. }
  44270. /* eslint-disable no-unused-vars */
  44271. /**
  44272. * Perform no operation.
  44273. * Stubbing args to make Flow happy without leaving useless transpiled code
  44274. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44275. */
  44276. function noop (a, b, c) {}
  44277. /**
  44278. * Always return false.
  44279. */
  44280. var no = function (a, b, c) { return false; };
  44281. /* eslint-enable no-unused-vars */
  44282. /**
  44283. * Return the same value.
  44284. */
  44285. var identity = function (_) { return _; };
  44286. /**
  44287. * Generate a string containing static keys from compiler modules.
  44288. */
  44289. function genStaticKeys (modules) {
  44290. return modules.reduce(function (keys, m) {
  44291. return keys.concat(m.staticKeys || [])
  44292. }, []).join(',')
  44293. }
  44294. /**
  44295. * Check if two values are loosely equal - that is,
  44296. * if they are plain objects, do they have the same shape?
  44297. */
  44298. function looseEqual (a, b) {
  44299. if (a === b) { return true }
  44300. var isObjectA = isObject(a);
  44301. var isObjectB = isObject(b);
  44302. if (isObjectA && isObjectB) {
  44303. try {
  44304. var isArrayA = Array.isArray(a);
  44305. var isArrayB = Array.isArray(b);
  44306. if (isArrayA && isArrayB) {
  44307. return a.length === b.length && a.every(function (e, i) {
  44308. return looseEqual(e, b[i])
  44309. })
  44310. } else if (a instanceof Date && b instanceof Date) {
  44311. return a.getTime() === b.getTime()
  44312. } else if (!isArrayA && !isArrayB) {
  44313. var keysA = Object.keys(a);
  44314. var keysB = Object.keys(b);
  44315. return keysA.length === keysB.length && keysA.every(function (key) {
  44316. return looseEqual(a[key], b[key])
  44317. })
  44318. } else {
  44319. /* istanbul ignore next */
  44320. return false
  44321. }
  44322. } catch (e) {
  44323. /* istanbul ignore next */
  44324. return false
  44325. }
  44326. } else if (!isObjectA && !isObjectB) {
  44327. return String(a) === String(b)
  44328. } else {
  44329. return false
  44330. }
  44331. }
  44332. /**
  44333. * Return the first index at which a loosely equal value can be
  44334. * found in the array (if value is a plain object, the array must
  44335. * contain an object of the same shape), or -1 if it is not present.
  44336. */
  44337. function looseIndexOf (arr, val) {
  44338. for (var i = 0; i < arr.length; i++) {
  44339. if (looseEqual(arr[i], val)) { return i }
  44340. }
  44341. return -1
  44342. }
  44343. /**
  44344. * Ensure a function is called only once.
  44345. */
  44346. function once (fn) {
  44347. var called = false;
  44348. return function () {
  44349. if (!called) {
  44350. called = true;
  44351. fn.apply(this, arguments);
  44352. }
  44353. }
  44354. }
  44355. var SSR_ATTR = 'data-server-rendered';
  44356. var ASSET_TYPES = [
  44357. 'component',
  44358. 'directive',
  44359. 'filter'
  44360. ];
  44361. var LIFECYCLE_HOOKS = [
  44362. 'beforeCreate',
  44363. 'created',
  44364. 'beforeMount',
  44365. 'mounted',
  44366. 'beforeUpdate',
  44367. 'updated',
  44368. 'beforeDestroy',
  44369. 'destroyed',
  44370. 'activated',
  44371. 'deactivated',
  44372. 'errorCaptured',
  44373. 'serverPrefetch'
  44374. ];
  44375. /* */
  44376. var config = ({
  44377. /**
  44378. * Option merge strategies (used in core/util/options)
  44379. */
  44380. // $flow-disable-line
  44381. optionMergeStrategies: Object.create(null),
  44382. /**
  44383. * Whether to suppress warnings.
  44384. */
  44385. silent: false,
  44386. /**
  44387. * Show production mode tip message on boot?
  44388. */
  44389. productionTip: "development" !== 'production',
  44390. /**
  44391. * Whether to enable devtools
  44392. */
  44393. devtools: "development" !== 'production',
  44394. /**
  44395. * Whether to record perf
  44396. */
  44397. performance: false,
  44398. /**
  44399. * Error handler for watcher errors
  44400. */
  44401. errorHandler: null,
  44402. /**
  44403. * Warn handler for watcher warns
  44404. */
  44405. warnHandler: null,
  44406. /**
  44407. * Ignore certain custom elements
  44408. */
  44409. ignoredElements: [],
  44410. /**
  44411. * Custom user key aliases for v-on
  44412. */
  44413. // $flow-disable-line
  44414. keyCodes: Object.create(null),
  44415. /**
  44416. * Check if a tag is reserved so that it cannot be registered as a
  44417. * component. This is platform-dependent and may be overwritten.
  44418. */
  44419. isReservedTag: no,
  44420. /**
  44421. * Check if an attribute is reserved so that it cannot be used as a component
  44422. * prop. This is platform-dependent and may be overwritten.
  44423. */
  44424. isReservedAttr: no,
  44425. /**
  44426. * Check if a tag is an unknown element.
  44427. * Platform-dependent.
  44428. */
  44429. isUnknownElement: no,
  44430. /**
  44431. * Get the namespace of an element
  44432. */
  44433. getTagNamespace: noop,
  44434. /**
  44435. * Parse the real tag name for the specific platform.
  44436. */
  44437. parsePlatformTagName: identity,
  44438. /**
  44439. * Check if an attribute must be bound using property, e.g. value
  44440. * Platform-dependent.
  44441. */
  44442. mustUseProp: no,
  44443. /**
  44444. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44445. * This will significantly reduce performance if set to false.
  44446. */
  44447. async: true,
  44448. /**
  44449. * Exposed for legacy reasons
  44450. */
  44451. _lifecycleHooks: LIFECYCLE_HOOKS
  44452. });
  44453. /* */
  44454. /**
  44455. * unicode letters used for parsing html tags, component names and property paths.
  44456. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44457. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44458. */
  44459. 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/;
  44460. /**
  44461. * Check if a string starts with $ or _
  44462. */
  44463. function isReserved (str) {
  44464. var c = (str + '').charCodeAt(0);
  44465. return c === 0x24 || c === 0x5F
  44466. }
  44467. /**
  44468. * Define a property.
  44469. */
  44470. function def (obj, key, val, enumerable) {
  44471. Object.defineProperty(obj, key, {
  44472. value: val,
  44473. enumerable: !!enumerable,
  44474. writable: true,
  44475. configurable: true
  44476. });
  44477. }
  44478. /**
  44479. * Parse simple path.
  44480. */
  44481. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44482. function parsePath (path) {
  44483. if (bailRE.test(path)) {
  44484. return
  44485. }
  44486. var segments = path.split('.');
  44487. return function (obj) {
  44488. for (var i = 0; i < segments.length; i++) {
  44489. if (!obj) { return }
  44490. obj = obj[segments[i]];
  44491. }
  44492. return obj
  44493. }
  44494. }
  44495. /* */
  44496. // can we use __proto__?
  44497. var hasProto = '__proto__' in {};
  44498. // Browser environment sniffing
  44499. var inBrowser = typeof window !== 'undefined';
  44500. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44501. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44502. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44503. var isIE = UA && /msie|trident/.test(UA);
  44504. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44505. var isEdge = UA && UA.indexOf('edge/') > 0;
  44506. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44507. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  44508. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  44509. var isPhantomJS = UA && /phantomjs/.test(UA);
  44510. var isFF = UA && UA.match(/firefox\/(\d+)/);
  44511. // Firefox has a "watch" function on Object.prototype...
  44512. var nativeWatch = ({}).watch;
  44513. var supportsPassive = false;
  44514. if (inBrowser) {
  44515. try {
  44516. var opts = {};
  44517. Object.defineProperty(opts, 'passive', ({
  44518. get: function get () {
  44519. /* istanbul ignore next */
  44520. supportsPassive = true;
  44521. }
  44522. })); // https://github.com/facebook/flow/issues/285
  44523. window.addEventListener('test-passive', null, opts);
  44524. } catch (e) {}
  44525. }
  44526. // this needs to be lazy-evaled because vue may be required before
  44527. // vue-server-renderer can set VUE_ENV
  44528. var _isServer;
  44529. var isServerRendering = function () {
  44530. if (_isServer === undefined) {
  44531. /* istanbul ignore if */
  44532. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  44533. // detect presence of vue-server-renderer and avoid
  44534. // Webpack shimming the process
  44535. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  44536. } else {
  44537. _isServer = false;
  44538. }
  44539. }
  44540. return _isServer
  44541. };
  44542. // detect devtools
  44543. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  44544. /* istanbul ignore next */
  44545. function isNative (Ctor) {
  44546. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  44547. }
  44548. var hasSymbol =
  44549. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  44550. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  44551. var _Set;
  44552. /* istanbul ignore if */ // $flow-disable-line
  44553. if (typeof Set !== 'undefined' && isNative(Set)) {
  44554. // use native Set when available.
  44555. _Set = Set;
  44556. } else {
  44557. // a non-standard Set polyfill that only works with primitive keys.
  44558. _Set = /*@__PURE__*/(function () {
  44559. function Set () {
  44560. this.set = Object.create(null);
  44561. }
  44562. Set.prototype.has = function has (key) {
  44563. return this.set[key] === true
  44564. };
  44565. Set.prototype.add = function add (key) {
  44566. this.set[key] = true;
  44567. };
  44568. Set.prototype.clear = function clear () {
  44569. this.set = Object.create(null);
  44570. };
  44571. return Set;
  44572. }());
  44573. }
  44574. /* */
  44575. var warn = noop;
  44576. var tip = noop;
  44577. var generateComponentTrace = (noop); // work around flow check
  44578. var formatComponentName = (noop);
  44579. {
  44580. var hasConsole = typeof console !== 'undefined';
  44581. var classifyRE = /(?:^|[-_])(\w)/g;
  44582. var classify = function (str) { return str
  44583. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  44584. .replace(/[-_]/g, ''); };
  44585. warn = function (msg, vm) {
  44586. var trace = vm ? generateComponentTrace(vm) : '';
  44587. if (config.warnHandler) {
  44588. config.warnHandler.call(null, msg, vm, trace);
  44589. } else if (hasConsole && (!config.silent)) {
  44590. console.error(("[Vue warn]: " + msg + trace));
  44591. }
  44592. };
  44593. tip = function (msg, vm) {
  44594. if (hasConsole && (!config.silent)) {
  44595. console.warn("[Vue tip]: " + msg + (
  44596. vm ? generateComponentTrace(vm) : ''
  44597. ));
  44598. }
  44599. };
  44600. formatComponentName = function (vm, includeFile) {
  44601. if (vm.$root === vm) {
  44602. return '<Root>'
  44603. }
  44604. var options = typeof vm === 'function' && vm.cid != null
  44605. ? vm.options
  44606. : vm._isVue
  44607. ? vm.$options || vm.constructor.options
  44608. : vm;
  44609. var name = options.name || options._componentTag;
  44610. var file = options.__file;
  44611. if (!name && file) {
  44612. var match = file.match(/([^/\\]+)\.vue$/);
  44613. name = match && match[1];
  44614. }
  44615. return (
  44616. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  44617. (file && includeFile !== false ? (" at " + file) : '')
  44618. )
  44619. };
  44620. var repeat = function (str, n) {
  44621. var res = '';
  44622. while (n) {
  44623. if (n % 2 === 1) { res += str; }
  44624. if (n > 1) { str += str; }
  44625. n >>= 1;
  44626. }
  44627. return res
  44628. };
  44629. generateComponentTrace = function (vm) {
  44630. if (vm._isVue && vm.$parent) {
  44631. var tree = [];
  44632. var currentRecursiveSequence = 0;
  44633. while (vm) {
  44634. if (tree.length > 0) {
  44635. var last = tree[tree.length - 1];
  44636. if (last.constructor === vm.constructor) {
  44637. currentRecursiveSequence++;
  44638. vm = vm.$parent;
  44639. continue
  44640. } else if (currentRecursiveSequence > 0) {
  44641. tree[tree.length - 1] = [last, currentRecursiveSequence];
  44642. currentRecursiveSequence = 0;
  44643. }
  44644. }
  44645. tree.push(vm);
  44646. vm = vm.$parent;
  44647. }
  44648. return '\n\nfound in\n\n' + tree
  44649. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  44650. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  44651. : formatComponentName(vm))); })
  44652. .join('\n')
  44653. } else {
  44654. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  44655. }
  44656. };
  44657. }
  44658. /* */
  44659. var uid = 0;
  44660. /**
  44661. * A dep is an observable that can have multiple
  44662. * directives subscribing to it.
  44663. */
  44664. var Dep = function Dep () {
  44665. this.id = uid++;
  44666. this.subs = [];
  44667. };
  44668. Dep.prototype.addSub = function addSub (sub) {
  44669. this.subs.push(sub);
  44670. };
  44671. Dep.prototype.removeSub = function removeSub (sub) {
  44672. remove(this.subs, sub);
  44673. };
  44674. Dep.prototype.depend = function depend () {
  44675. if (Dep.target) {
  44676. Dep.target.addDep(this);
  44677. }
  44678. };
  44679. Dep.prototype.notify = function notify () {
  44680. // stabilize the subscriber list first
  44681. var subs = this.subs.slice();
  44682. if (!config.async) {
  44683. // subs aren't sorted in scheduler if not running async
  44684. // we need to sort them now to make sure they fire in correct
  44685. // order
  44686. subs.sort(function (a, b) { return a.id - b.id; });
  44687. }
  44688. for (var i = 0, l = subs.length; i < l; i++) {
  44689. subs[i].update();
  44690. }
  44691. };
  44692. // The current target watcher being evaluated.
  44693. // This is globally unique because only one watcher
  44694. // can be evaluated at a time.
  44695. Dep.target = null;
  44696. var targetStack = [];
  44697. function pushTarget (target) {
  44698. targetStack.push(target);
  44699. Dep.target = target;
  44700. }
  44701. function popTarget () {
  44702. targetStack.pop();
  44703. Dep.target = targetStack[targetStack.length - 1];
  44704. }
  44705. /* */
  44706. var VNode = function VNode (
  44707. tag,
  44708. data,
  44709. children,
  44710. text,
  44711. elm,
  44712. context,
  44713. componentOptions,
  44714. asyncFactory
  44715. ) {
  44716. this.tag = tag;
  44717. this.data = data;
  44718. this.children = children;
  44719. this.text = text;
  44720. this.elm = elm;
  44721. this.ns = undefined;
  44722. this.context = context;
  44723. this.fnContext = undefined;
  44724. this.fnOptions = undefined;
  44725. this.fnScopeId = undefined;
  44726. this.key = data && data.key;
  44727. this.componentOptions = componentOptions;
  44728. this.componentInstance = undefined;
  44729. this.parent = undefined;
  44730. this.raw = false;
  44731. this.isStatic = false;
  44732. this.isRootInsert = true;
  44733. this.isComment = false;
  44734. this.isCloned = false;
  44735. this.isOnce = false;
  44736. this.asyncFactory = asyncFactory;
  44737. this.asyncMeta = undefined;
  44738. this.isAsyncPlaceholder = false;
  44739. };
  44740. var prototypeAccessors = { child: { configurable: true } };
  44741. // DEPRECATED: alias for componentInstance for backwards compat.
  44742. /* istanbul ignore next */
  44743. prototypeAccessors.child.get = function () {
  44744. return this.componentInstance
  44745. };
  44746. Object.defineProperties( VNode.prototype, prototypeAccessors );
  44747. var createEmptyVNode = function (text) {
  44748. if ( text === void 0 ) text = '';
  44749. var node = new VNode();
  44750. node.text = text;
  44751. node.isComment = true;
  44752. return node
  44753. };
  44754. function createTextVNode (val) {
  44755. return new VNode(undefined, undefined, undefined, String(val))
  44756. }
  44757. // optimized shallow clone
  44758. // used for static nodes and slot nodes because they may be reused across
  44759. // multiple renders, cloning them avoids errors when DOM manipulations rely
  44760. // on their elm reference.
  44761. function cloneVNode (vnode) {
  44762. var cloned = new VNode(
  44763. vnode.tag,
  44764. vnode.data,
  44765. // #7975
  44766. // clone children array to avoid mutating original in case of cloning
  44767. // a child.
  44768. vnode.children && vnode.children.slice(),
  44769. vnode.text,
  44770. vnode.elm,
  44771. vnode.context,
  44772. vnode.componentOptions,
  44773. vnode.asyncFactory
  44774. );
  44775. cloned.ns = vnode.ns;
  44776. cloned.isStatic = vnode.isStatic;
  44777. cloned.key = vnode.key;
  44778. cloned.isComment = vnode.isComment;
  44779. cloned.fnContext = vnode.fnContext;
  44780. cloned.fnOptions = vnode.fnOptions;
  44781. cloned.fnScopeId = vnode.fnScopeId;
  44782. cloned.asyncMeta = vnode.asyncMeta;
  44783. cloned.isCloned = true;
  44784. return cloned
  44785. }
  44786. /*
  44787. * not type checking this file because flow doesn't play well with
  44788. * dynamically accessing methods on Array prototype
  44789. */
  44790. var arrayProto = Array.prototype;
  44791. var arrayMethods = Object.create(arrayProto);
  44792. var methodsToPatch = [
  44793. 'push',
  44794. 'pop',
  44795. 'shift',
  44796. 'unshift',
  44797. 'splice',
  44798. 'sort',
  44799. 'reverse'
  44800. ];
  44801. /**
  44802. * Intercept mutating methods and emit events
  44803. */
  44804. methodsToPatch.forEach(function (method) {
  44805. // cache original method
  44806. var original = arrayProto[method];
  44807. def(arrayMethods, method, function mutator () {
  44808. var args = [], len = arguments.length;
  44809. while ( len-- ) args[ len ] = arguments[ len ];
  44810. var result = original.apply(this, args);
  44811. var ob = this.__ob__;
  44812. var inserted;
  44813. switch (method) {
  44814. case 'push':
  44815. case 'unshift':
  44816. inserted = args;
  44817. break
  44818. case 'splice':
  44819. inserted = args.slice(2);
  44820. break
  44821. }
  44822. if (inserted) { ob.observeArray(inserted); }
  44823. // notify change
  44824. ob.dep.notify();
  44825. return result
  44826. });
  44827. });
  44828. /* */
  44829. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  44830. /**
  44831. * In some cases we may want to disable observation inside a component's
  44832. * update computation.
  44833. */
  44834. var shouldObserve = true;
  44835. function toggleObserving (value) {
  44836. shouldObserve = value;
  44837. }
  44838. /**
  44839. * Observer class that is attached to each observed
  44840. * object. Once attached, the observer converts the target
  44841. * object's property keys into getter/setters that
  44842. * collect dependencies and dispatch updates.
  44843. */
  44844. var Observer = function Observer (value) {
  44845. this.value = value;
  44846. this.dep = new Dep();
  44847. this.vmCount = 0;
  44848. def(value, '__ob__', this);
  44849. if (Array.isArray(value)) {
  44850. if (hasProto) {
  44851. protoAugment(value, arrayMethods);
  44852. } else {
  44853. copyAugment(value, arrayMethods, arrayKeys);
  44854. }
  44855. this.observeArray(value);
  44856. } else {
  44857. this.walk(value);
  44858. }
  44859. };
  44860. /**
  44861. * Walk through all properties and convert them into
  44862. * getter/setters. This method should only be called when
  44863. * value type is Object.
  44864. */
  44865. Observer.prototype.walk = function walk (obj) {
  44866. var keys = Object.keys(obj);
  44867. for (var i = 0; i < keys.length; i++) {
  44868. defineReactive$$1(obj, keys[i]);
  44869. }
  44870. };
  44871. /**
  44872. * Observe a list of Array items.
  44873. */
  44874. Observer.prototype.observeArray = function observeArray (items) {
  44875. for (var i = 0, l = items.length; i < l; i++) {
  44876. observe(items[i]);
  44877. }
  44878. };
  44879. // helpers
  44880. /**
  44881. * Augment a target Object or Array by intercepting
  44882. * the prototype chain using __proto__
  44883. */
  44884. function protoAugment (target, src) {
  44885. /* eslint-disable no-proto */
  44886. target.__proto__ = src;
  44887. /* eslint-enable no-proto */
  44888. }
  44889. /**
  44890. * Augment a target Object or Array by defining
  44891. * hidden properties.
  44892. */
  44893. /* istanbul ignore next */
  44894. function copyAugment (target, src, keys) {
  44895. for (var i = 0, l = keys.length; i < l; i++) {
  44896. var key = keys[i];
  44897. def(target, key, src[key]);
  44898. }
  44899. }
  44900. /**
  44901. * Attempt to create an observer instance for a value,
  44902. * returns the new observer if successfully observed,
  44903. * or the existing observer if the value already has one.
  44904. */
  44905. function observe (value, asRootData) {
  44906. if (!isObject(value) || value instanceof VNode) {
  44907. return
  44908. }
  44909. var ob;
  44910. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  44911. ob = value.__ob__;
  44912. } else if (
  44913. shouldObserve &&
  44914. !isServerRendering() &&
  44915. (Array.isArray(value) || isPlainObject(value)) &&
  44916. Object.isExtensible(value) &&
  44917. !value._isVue
  44918. ) {
  44919. ob = new Observer(value);
  44920. }
  44921. if (asRootData && ob) {
  44922. ob.vmCount++;
  44923. }
  44924. return ob
  44925. }
  44926. /**
  44927. * Define a reactive property on an Object.
  44928. */
  44929. function defineReactive$$1 (
  44930. obj,
  44931. key,
  44932. val,
  44933. customSetter,
  44934. shallow
  44935. ) {
  44936. var dep = new Dep();
  44937. var property = Object.getOwnPropertyDescriptor(obj, key);
  44938. if (property && property.configurable === false) {
  44939. return
  44940. }
  44941. // cater for pre-defined getter/setters
  44942. var getter = property && property.get;
  44943. var setter = property && property.set;
  44944. if ((!getter || setter) && arguments.length === 2) {
  44945. val = obj[key];
  44946. }
  44947. var childOb = !shallow && observe(val);
  44948. Object.defineProperty(obj, key, {
  44949. enumerable: true,
  44950. configurable: true,
  44951. get: function reactiveGetter () {
  44952. var value = getter ? getter.call(obj) : val;
  44953. if (Dep.target) {
  44954. dep.depend();
  44955. if (childOb) {
  44956. childOb.dep.depend();
  44957. if (Array.isArray(value)) {
  44958. dependArray(value);
  44959. }
  44960. }
  44961. }
  44962. return value
  44963. },
  44964. set: function reactiveSetter (newVal) {
  44965. var value = getter ? getter.call(obj) : val;
  44966. /* eslint-disable no-self-compare */
  44967. if (newVal === value || (newVal !== newVal && value !== value)) {
  44968. return
  44969. }
  44970. /* eslint-enable no-self-compare */
  44971. if (customSetter) {
  44972. customSetter();
  44973. }
  44974. // #7981: for accessor properties without setter
  44975. if (getter && !setter) { return }
  44976. if (setter) {
  44977. setter.call(obj, newVal);
  44978. } else {
  44979. val = newVal;
  44980. }
  44981. childOb = !shallow && observe(newVal);
  44982. dep.notify();
  44983. }
  44984. });
  44985. }
  44986. /**
  44987. * Set a property on an object. Adds the new property and
  44988. * triggers change notification if the property doesn't
  44989. * already exist.
  44990. */
  44991. function set (target, key, val) {
  44992. if (isUndef(target) || isPrimitive(target)
  44993. ) {
  44994. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  44995. }
  44996. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44997. target.length = Math.max(target.length, key);
  44998. target.splice(key, 1, val);
  44999. return val
  45000. }
  45001. if (key in target && !(key in Object.prototype)) {
  45002. target[key] = val;
  45003. return val
  45004. }
  45005. var ob = (target).__ob__;
  45006. if (target._isVue || (ob && ob.vmCount)) {
  45007. warn(
  45008. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45009. 'at runtime - declare it upfront in the data option.'
  45010. );
  45011. return val
  45012. }
  45013. if (!ob) {
  45014. target[key] = val;
  45015. return val
  45016. }
  45017. defineReactive$$1(ob.value, key, val);
  45018. ob.dep.notify();
  45019. return val
  45020. }
  45021. /**
  45022. * Delete a property and trigger change if necessary.
  45023. */
  45024. function del (target, key) {
  45025. if (isUndef(target) || isPrimitive(target)
  45026. ) {
  45027. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45028. }
  45029. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45030. target.splice(key, 1);
  45031. return
  45032. }
  45033. var ob = (target).__ob__;
  45034. if (target._isVue || (ob && ob.vmCount)) {
  45035. warn(
  45036. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45037. '- just set it to null.'
  45038. );
  45039. return
  45040. }
  45041. if (!hasOwn(target, key)) {
  45042. return
  45043. }
  45044. delete target[key];
  45045. if (!ob) {
  45046. return
  45047. }
  45048. ob.dep.notify();
  45049. }
  45050. /**
  45051. * Collect dependencies on array elements when the array is touched, since
  45052. * we cannot intercept array element access like property getters.
  45053. */
  45054. function dependArray (value) {
  45055. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45056. e = value[i];
  45057. e && e.__ob__ && e.__ob__.dep.depend();
  45058. if (Array.isArray(e)) {
  45059. dependArray(e);
  45060. }
  45061. }
  45062. }
  45063. /* */
  45064. /**
  45065. * Option overwriting strategies are functions that handle
  45066. * how to merge a parent option value and a child option
  45067. * value into the final value.
  45068. */
  45069. var strats = config.optionMergeStrategies;
  45070. /**
  45071. * Options with restrictions
  45072. */
  45073. {
  45074. strats.el = strats.propsData = function (parent, child, vm, key) {
  45075. if (!vm) {
  45076. warn(
  45077. "option \"" + key + "\" can only be used during instance " +
  45078. 'creation with the `new` keyword.'
  45079. );
  45080. }
  45081. return defaultStrat(parent, child)
  45082. };
  45083. }
  45084. /**
  45085. * Helper that recursively merges two data objects together.
  45086. */
  45087. function mergeData (to, from) {
  45088. if (!from) { return to }
  45089. var key, toVal, fromVal;
  45090. var keys = hasSymbol
  45091. ? Reflect.ownKeys(from)
  45092. : Object.keys(from);
  45093. for (var i = 0; i < keys.length; i++) {
  45094. key = keys[i];
  45095. // in case the object is already observed...
  45096. if (key === '__ob__') { continue }
  45097. toVal = to[key];
  45098. fromVal = from[key];
  45099. if (!hasOwn(to, key)) {
  45100. set(to, key, fromVal);
  45101. } else if (
  45102. toVal !== fromVal &&
  45103. isPlainObject(toVal) &&
  45104. isPlainObject(fromVal)
  45105. ) {
  45106. mergeData(toVal, fromVal);
  45107. }
  45108. }
  45109. return to
  45110. }
  45111. /**
  45112. * Data
  45113. */
  45114. function mergeDataOrFn (
  45115. parentVal,
  45116. childVal,
  45117. vm
  45118. ) {
  45119. if (!vm) {
  45120. // in a Vue.extend merge, both should be functions
  45121. if (!childVal) {
  45122. return parentVal
  45123. }
  45124. if (!parentVal) {
  45125. return childVal
  45126. }
  45127. // when parentVal & childVal are both present,
  45128. // we need to return a function that returns the
  45129. // merged result of both functions... no need to
  45130. // check if parentVal is a function here because
  45131. // it has to be a function to pass previous merges.
  45132. return function mergedDataFn () {
  45133. return mergeData(
  45134. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45135. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45136. )
  45137. }
  45138. } else {
  45139. return function mergedInstanceDataFn () {
  45140. // instance merge
  45141. var instanceData = typeof childVal === 'function'
  45142. ? childVal.call(vm, vm)
  45143. : childVal;
  45144. var defaultData = typeof parentVal === 'function'
  45145. ? parentVal.call(vm, vm)
  45146. : parentVal;
  45147. if (instanceData) {
  45148. return mergeData(instanceData, defaultData)
  45149. } else {
  45150. return defaultData
  45151. }
  45152. }
  45153. }
  45154. }
  45155. strats.data = function (
  45156. parentVal,
  45157. childVal,
  45158. vm
  45159. ) {
  45160. if (!vm) {
  45161. if (childVal && typeof childVal !== 'function') {
  45162. warn(
  45163. 'The "data" option should be a function ' +
  45164. 'that returns a per-instance value in component ' +
  45165. 'definitions.',
  45166. vm
  45167. );
  45168. return parentVal
  45169. }
  45170. return mergeDataOrFn(parentVal, childVal)
  45171. }
  45172. return mergeDataOrFn(parentVal, childVal, vm)
  45173. };
  45174. /**
  45175. * Hooks and props are merged as arrays.
  45176. */
  45177. function mergeHook (
  45178. parentVal,
  45179. childVal
  45180. ) {
  45181. var res = childVal
  45182. ? parentVal
  45183. ? parentVal.concat(childVal)
  45184. : Array.isArray(childVal)
  45185. ? childVal
  45186. : [childVal]
  45187. : parentVal;
  45188. return res
  45189. ? dedupeHooks(res)
  45190. : res
  45191. }
  45192. function dedupeHooks (hooks) {
  45193. var res = [];
  45194. for (var i = 0; i < hooks.length; i++) {
  45195. if (res.indexOf(hooks[i]) === -1) {
  45196. res.push(hooks[i]);
  45197. }
  45198. }
  45199. return res
  45200. }
  45201. LIFECYCLE_HOOKS.forEach(function (hook) {
  45202. strats[hook] = mergeHook;
  45203. });
  45204. /**
  45205. * Assets
  45206. *
  45207. * When a vm is present (instance creation), we need to do
  45208. * a three-way merge between constructor options, instance
  45209. * options and parent options.
  45210. */
  45211. function mergeAssets (
  45212. parentVal,
  45213. childVal,
  45214. vm,
  45215. key
  45216. ) {
  45217. var res = Object.create(parentVal || null);
  45218. if (childVal) {
  45219. assertObjectType(key, childVal, vm);
  45220. return extend(res, childVal)
  45221. } else {
  45222. return res
  45223. }
  45224. }
  45225. ASSET_TYPES.forEach(function (type) {
  45226. strats[type + 's'] = mergeAssets;
  45227. });
  45228. /**
  45229. * Watchers.
  45230. *
  45231. * Watchers hashes should not overwrite one
  45232. * another, so we merge them as arrays.
  45233. */
  45234. strats.watch = function (
  45235. parentVal,
  45236. childVal,
  45237. vm,
  45238. key
  45239. ) {
  45240. // work around Firefox's Object.prototype.watch...
  45241. if (parentVal === nativeWatch) { parentVal = undefined; }
  45242. if (childVal === nativeWatch) { childVal = undefined; }
  45243. /* istanbul ignore if */
  45244. if (!childVal) { return Object.create(parentVal || null) }
  45245. {
  45246. assertObjectType(key, childVal, vm);
  45247. }
  45248. if (!parentVal) { return childVal }
  45249. var ret = {};
  45250. extend(ret, parentVal);
  45251. for (var key$1 in childVal) {
  45252. var parent = ret[key$1];
  45253. var child = childVal[key$1];
  45254. if (parent && !Array.isArray(parent)) {
  45255. parent = [parent];
  45256. }
  45257. ret[key$1] = parent
  45258. ? parent.concat(child)
  45259. : Array.isArray(child) ? child : [child];
  45260. }
  45261. return ret
  45262. };
  45263. /**
  45264. * Other object hashes.
  45265. */
  45266. strats.props =
  45267. strats.methods =
  45268. strats.inject =
  45269. strats.computed = function (
  45270. parentVal,
  45271. childVal,
  45272. vm,
  45273. key
  45274. ) {
  45275. if (childVal && "development" !== 'production') {
  45276. assertObjectType(key, childVal, vm);
  45277. }
  45278. if (!parentVal) { return childVal }
  45279. var ret = Object.create(null);
  45280. extend(ret, parentVal);
  45281. if (childVal) { extend(ret, childVal); }
  45282. return ret
  45283. };
  45284. strats.provide = mergeDataOrFn;
  45285. /**
  45286. * Default strategy.
  45287. */
  45288. var defaultStrat = function (parentVal, childVal) {
  45289. return childVal === undefined
  45290. ? parentVal
  45291. : childVal
  45292. };
  45293. /**
  45294. * Validate component names
  45295. */
  45296. function checkComponents (options) {
  45297. for (var key in options.components) {
  45298. validateComponentName(key);
  45299. }
  45300. }
  45301. function validateComponentName (name) {
  45302. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45303. warn(
  45304. 'Invalid component name: "' + name + '". Component names ' +
  45305. 'should conform to valid custom element name in html5 specification.'
  45306. );
  45307. }
  45308. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45309. warn(
  45310. 'Do not use built-in or reserved HTML elements as component ' +
  45311. 'id: ' + name
  45312. );
  45313. }
  45314. }
  45315. /**
  45316. * Ensure all props option syntax are normalized into the
  45317. * Object-based format.
  45318. */
  45319. function normalizeProps (options, vm) {
  45320. var props = options.props;
  45321. if (!props) { return }
  45322. var res = {};
  45323. var i, val, name;
  45324. if (Array.isArray(props)) {
  45325. i = props.length;
  45326. while (i--) {
  45327. val = props[i];
  45328. if (typeof val === 'string') {
  45329. name = camelize(val);
  45330. res[name] = { type: null };
  45331. } else {
  45332. warn('props must be strings when using array syntax.');
  45333. }
  45334. }
  45335. } else if (isPlainObject(props)) {
  45336. for (var key in props) {
  45337. val = props[key];
  45338. name = camelize(key);
  45339. res[name] = isPlainObject(val)
  45340. ? val
  45341. : { type: val };
  45342. }
  45343. } else {
  45344. warn(
  45345. "Invalid value for option \"props\": expected an Array or an Object, " +
  45346. "but got " + (toRawType(props)) + ".",
  45347. vm
  45348. );
  45349. }
  45350. options.props = res;
  45351. }
  45352. /**
  45353. * Normalize all injections into Object-based format
  45354. */
  45355. function normalizeInject (options, vm) {
  45356. var inject = options.inject;
  45357. if (!inject) { return }
  45358. var normalized = options.inject = {};
  45359. if (Array.isArray(inject)) {
  45360. for (var i = 0; i < inject.length; i++) {
  45361. normalized[inject[i]] = { from: inject[i] };
  45362. }
  45363. } else if (isPlainObject(inject)) {
  45364. for (var key in inject) {
  45365. var val = inject[key];
  45366. normalized[key] = isPlainObject(val)
  45367. ? extend({ from: key }, val)
  45368. : { from: val };
  45369. }
  45370. } else {
  45371. warn(
  45372. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45373. "but got " + (toRawType(inject)) + ".",
  45374. vm
  45375. );
  45376. }
  45377. }
  45378. /**
  45379. * Normalize raw function directives into object format.
  45380. */
  45381. function normalizeDirectives (options) {
  45382. var dirs = options.directives;
  45383. if (dirs) {
  45384. for (var key in dirs) {
  45385. var def$$1 = dirs[key];
  45386. if (typeof def$$1 === 'function') {
  45387. dirs[key] = { bind: def$$1, update: def$$1 };
  45388. }
  45389. }
  45390. }
  45391. }
  45392. function assertObjectType (name, value, vm) {
  45393. if (!isPlainObject(value)) {
  45394. warn(
  45395. "Invalid value for option \"" + name + "\": expected an Object, " +
  45396. "but got " + (toRawType(value)) + ".",
  45397. vm
  45398. );
  45399. }
  45400. }
  45401. /**
  45402. * Merge two option objects into a new one.
  45403. * Core utility used in both instantiation and inheritance.
  45404. */
  45405. function mergeOptions (
  45406. parent,
  45407. child,
  45408. vm
  45409. ) {
  45410. {
  45411. checkComponents(child);
  45412. }
  45413. if (typeof child === 'function') {
  45414. child = child.options;
  45415. }
  45416. normalizeProps(child, vm);
  45417. normalizeInject(child, vm);
  45418. normalizeDirectives(child);
  45419. // Apply extends and mixins on the child options,
  45420. // but only if it is a raw options object that isn't
  45421. // the result of another mergeOptions call.
  45422. // Only merged options has the _base property.
  45423. if (!child._base) {
  45424. if (child.extends) {
  45425. parent = mergeOptions(parent, child.extends, vm);
  45426. }
  45427. if (child.mixins) {
  45428. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45429. parent = mergeOptions(parent, child.mixins[i], vm);
  45430. }
  45431. }
  45432. }
  45433. var options = {};
  45434. var key;
  45435. for (key in parent) {
  45436. mergeField(key);
  45437. }
  45438. for (key in child) {
  45439. if (!hasOwn(parent, key)) {
  45440. mergeField(key);
  45441. }
  45442. }
  45443. function mergeField (key) {
  45444. var strat = strats[key] || defaultStrat;
  45445. options[key] = strat(parent[key], child[key], vm, key);
  45446. }
  45447. return options
  45448. }
  45449. /**
  45450. * Resolve an asset.
  45451. * This function is used because child instances need access
  45452. * to assets defined in its ancestor chain.
  45453. */
  45454. function resolveAsset (
  45455. options,
  45456. type,
  45457. id,
  45458. warnMissing
  45459. ) {
  45460. /* istanbul ignore if */
  45461. if (typeof id !== 'string') {
  45462. return
  45463. }
  45464. var assets = options[type];
  45465. // check local registration variations first
  45466. if (hasOwn(assets, id)) { return assets[id] }
  45467. var camelizedId = camelize(id);
  45468. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45469. var PascalCaseId = capitalize(camelizedId);
  45470. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45471. // fallback to prototype chain
  45472. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45473. if (warnMissing && !res) {
  45474. warn(
  45475. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45476. options
  45477. );
  45478. }
  45479. return res
  45480. }
  45481. /* */
  45482. function validateProp (
  45483. key,
  45484. propOptions,
  45485. propsData,
  45486. vm
  45487. ) {
  45488. var prop = propOptions[key];
  45489. var absent = !hasOwn(propsData, key);
  45490. var value = propsData[key];
  45491. // boolean casting
  45492. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45493. if (booleanIndex > -1) {
  45494. if (absent && !hasOwn(prop, 'default')) {
  45495. value = false;
  45496. } else if (value === '' || value === hyphenate(key)) {
  45497. // only cast empty string / same name to boolean if
  45498. // boolean has higher priority
  45499. var stringIndex = getTypeIndex(String, prop.type);
  45500. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45501. value = true;
  45502. }
  45503. }
  45504. }
  45505. // check default value
  45506. if (value === undefined) {
  45507. value = getPropDefaultValue(vm, prop, key);
  45508. // since the default value is a fresh copy,
  45509. // make sure to observe it.
  45510. var prevShouldObserve = shouldObserve;
  45511. toggleObserving(true);
  45512. observe(value);
  45513. toggleObserving(prevShouldObserve);
  45514. }
  45515. {
  45516. assertProp(prop, key, value, vm, absent);
  45517. }
  45518. return value
  45519. }
  45520. /**
  45521. * Get the default value of a prop.
  45522. */
  45523. function getPropDefaultValue (vm, prop, key) {
  45524. // no default, return undefined
  45525. if (!hasOwn(prop, 'default')) {
  45526. return undefined
  45527. }
  45528. var def = prop.default;
  45529. // warn against non-factory defaults for Object & Array
  45530. if (isObject(def)) {
  45531. warn(
  45532. 'Invalid default value for prop "' + key + '": ' +
  45533. 'Props with type Object/Array must use a factory function ' +
  45534. 'to return the default value.',
  45535. vm
  45536. );
  45537. }
  45538. // the raw prop value was also undefined from previous render,
  45539. // return previous default value to avoid unnecessary watcher trigger
  45540. if (vm && vm.$options.propsData &&
  45541. vm.$options.propsData[key] === undefined &&
  45542. vm._props[key] !== undefined
  45543. ) {
  45544. return vm._props[key]
  45545. }
  45546. // call factory function for non-Function types
  45547. // a value is Function if its prototype is function even across different execution context
  45548. return typeof def === 'function' && getType(prop.type) !== 'Function'
  45549. ? def.call(vm)
  45550. : def
  45551. }
  45552. /**
  45553. * Assert whether a prop is valid.
  45554. */
  45555. function assertProp (
  45556. prop,
  45557. name,
  45558. value,
  45559. vm,
  45560. absent
  45561. ) {
  45562. if (prop.required && absent) {
  45563. warn(
  45564. 'Missing required prop: "' + name + '"',
  45565. vm
  45566. );
  45567. return
  45568. }
  45569. if (value == null && !prop.required) {
  45570. return
  45571. }
  45572. var type = prop.type;
  45573. var valid = !type || type === true;
  45574. var expectedTypes = [];
  45575. if (type) {
  45576. if (!Array.isArray(type)) {
  45577. type = [type];
  45578. }
  45579. for (var i = 0; i < type.length && !valid; i++) {
  45580. var assertedType = assertType(value, type[i]);
  45581. expectedTypes.push(assertedType.expectedType || '');
  45582. valid = assertedType.valid;
  45583. }
  45584. }
  45585. if (!valid) {
  45586. warn(
  45587. getInvalidTypeMessage(name, value, expectedTypes),
  45588. vm
  45589. );
  45590. return
  45591. }
  45592. var validator = prop.validator;
  45593. if (validator) {
  45594. if (!validator(value)) {
  45595. warn(
  45596. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  45597. vm
  45598. );
  45599. }
  45600. }
  45601. }
  45602. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  45603. function assertType (value, type) {
  45604. var valid;
  45605. var expectedType = getType(type);
  45606. if (simpleCheckRE.test(expectedType)) {
  45607. var t = typeof value;
  45608. valid = t === expectedType.toLowerCase();
  45609. // for primitive wrapper objects
  45610. if (!valid && t === 'object') {
  45611. valid = value instanceof type;
  45612. }
  45613. } else if (expectedType === 'Object') {
  45614. valid = isPlainObject(value);
  45615. } else if (expectedType === 'Array') {
  45616. valid = Array.isArray(value);
  45617. } else {
  45618. valid = value instanceof type;
  45619. }
  45620. return {
  45621. valid: valid,
  45622. expectedType: expectedType
  45623. }
  45624. }
  45625. /**
  45626. * Use function string name to check built-in types,
  45627. * because a simple equality check will fail when running
  45628. * across different vms / iframes.
  45629. */
  45630. function getType (fn) {
  45631. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  45632. return match ? match[1] : ''
  45633. }
  45634. function isSameType (a, b) {
  45635. return getType(a) === getType(b)
  45636. }
  45637. function getTypeIndex (type, expectedTypes) {
  45638. if (!Array.isArray(expectedTypes)) {
  45639. return isSameType(expectedTypes, type) ? 0 : -1
  45640. }
  45641. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  45642. if (isSameType(expectedTypes[i], type)) {
  45643. return i
  45644. }
  45645. }
  45646. return -1
  45647. }
  45648. function getInvalidTypeMessage (name, value, expectedTypes) {
  45649. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  45650. " Expected " + (expectedTypes.map(capitalize).join(', '));
  45651. var expectedType = expectedTypes[0];
  45652. var receivedType = toRawType(value);
  45653. var expectedValue = styleValue(value, expectedType);
  45654. var receivedValue = styleValue(value, receivedType);
  45655. // check if we need to specify expected value
  45656. if (expectedTypes.length === 1 &&
  45657. isExplicable(expectedType) &&
  45658. !isBoolean(expectedType, receivedType)) {
  45659. message += " with value " + expectedValue;
  45660. }
  45661. message += ", got " + receivedType + " ";
  45662. // check if we need to specify received value
  45663. if (isExplicable(receivedType)) {
  45664. message += "with value " + receivedValue + ".";
  45665. }
  45666. return message
  45667. }
  45668. function styleValue (value, type) {
  45669. if (type === 'String') {
  45670. return ("\"" + value + "\"")
  45671. } else if (type === 'Number') {
  45672. return ("" + (Number(value)))
  45673. } else {
  45674. return ("" + value)
  45675. }
  45676. }
  45677. function isExplicable (value) {
  45678. var explicitTypes = ['string', 'number', 'boolean'];
  45679. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  45680. }
  45681. function isBoolean () {
  45682. var args = [], len = arguments.length;
  45683. while ( len-- ) args[ len ] = arguments[ len ];
  45684. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  45685. }
  45686. /* */
  45687. function handleError (err, vm, info) {
  45688. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  45689. // See: https://github.com/vuejs/vuex/issues/1505
  45690. pushTarget();
  45691. try {
  45692. if (vm) {
  45693. var cur = vm;
  45694. while ((cur = cur.$parent)) {
  45695. var hooks = cur.$options.errorCaptured;
  45696. if (hooks) {
  45697. for (var i = 0; i < hooks.length; i++) {
  45698. try {
  45699. var capture = hooks[i].call(cur, err, vm, info) === false;
  45700. if (capture) { return }
  45701. } catch (e) {
  45702. globalHandleError(e, cur, 'errorCaptured hook');
  45703. }
  45704. }
  45705. }
  45706. }
  45707. }
  45708. globalHandleError(err, vm, info);
  45709. } finally {
  45710. popTarget();
  45711. }
  45712. }
  45713. function invokeWithErrorHandling (
  45714. handler,
  45715. context,
  45716. args,
  45717. vm,
  45718. info
  45719. ) {
  45720. var res;
  45721. try {
  45722. res = args ? handler.apply(context, args) : handler.call(context);
  45723. if (res && !res._isVue && isPromise(res) && !res._handled) {
  45724. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  45725. // issue #9511
  45726. // avoid catch triggering multiple times when nested calls
  45727. res._handled = true;
  45728. }
  45729. } catch (e) {
  45730. handleError(e, vm, info);
  45731. }
  45732. return res
  45733. }
  45734. function globalHandleError (err, vm, info) {
  45735. if (config.errorHandler) {
  45736. try {
  45737. return config.errorHandler.call(null, err, vm, info)
  45738. } catch (e) {
  45739. // if the user intentionally throws the original error in the handler,
  45740. // do not log it twice
  45741. if (e !== err) {
  45742. logError(e, null, 'config.errorHandler');
  45743. }
  45744. }
  45745. }
  45746. logError(err, vm, info);
  45747. }
  45748. function logError (err, vm, info) {
  45749. {
  45750. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  45751. }
  45752. /* istanbul ignore else */
  45753. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  45754. console.error(err);
  45755. } else {
  45756. throw err
  45757. }
  45758. }
  45759. /* */
  45760. var isUsingMicroTask = false;
  45761. var callbacks = [];
  45762. var pending = false;
  45763. function flushCallbacks () {
  45764. pending = false;
  45765. var copies = callbacks.slice(0);
  45766. callbacks.length = 0;
  45767. for (var i = 0; i < copies.length; i++) {
  45768. copies[i]();
  45769. }
  45770. }
  45771. // Here we have async deferring wrappers using microtasks.
  45772. // In 2.5 we used (macro) tasks (in combination with microtasks).
  45773. // However, it has subtle problems when state is changed right before repaint
  45774. // (e.g. #6813, out-in transitions).
  45775. // Also, using (macro) tasks in event handler would cause some weird behaviors
  45776. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  45777. // So we now use microtasks everywhere, again.
  45778. // A major drawback of this tradeoff is that there are some scenarios
  45779. // where microtasks have too high a priority and fire in between supposedly
  45780. // sequential events (e.g. #4521, #6690, which have workarounds)
  45781. // or even between bubbling of the same event (#6566).
  45782. var timerFunc;
  45783. // The nextTick behavior leverages the microtask queue, which can be accessed
  45784. // via either native Promise.then or MutationObserver.
  45785. // MutationObserver has wider support, however it is seriously bugged in
  45786. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  45787. // completely stops working after triggering a few times... so, if native
  45788. // Promise is available, we will use it:
  45789. /* istanbul ignore next, $flow-disable-line */
  45790. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  45791. var p = Promise.resolve();
  45792. timerFunc = function () {
  45793. p.then(flushCallbacks);
  45794. // In problematic UIWebViews, Promise.then doesn't completely break, but
  45795. // it can get stuck in a weird state where callbacks are pushed into the
  45796. // microtask queue but the queue isn't being flushed, until the browser
  45797. // needs to do some other work, e.g. handle a timer. Therefore we can
  45798. // "force" the microtask queue to be flushed by adding an empty timer.
  45799. if (isIOS) { setTimeout(noop); }
  45800. };
  45801. isUsingMicroTask = true;
  45802. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  45803. isNative(MutationObserver) ||
  45804. // PhantomJS and iOS 7.x
  45805. MutationObserver.toString() === '[object MutationObserverConstructor]'
  45806. )) {
  45807. // Use MutationObserver where native Promise is not available,
  45808. // e.g. PhantomJS, iOS7, Android 4.4
  45809. // (#6466 MutationObserver is unreliable in IE11)
  45810. var counter = 1;
  45811. var observer = new MutationObserver(flushCallbacks);
  45812. var textNode = document.createTextNode(String(counter));
  45813. observer.observe(textNode, {
  45814. characterData: true
  45815. });
  45816. timerFunc = function () {
  45817. counter = (counter + 1) % 2;
  45818. textNode.data = String(counter);
  45819. };
  45820. isUsingMicroTask = true;
  45821. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  45822. // Fallback to setImmediate.
  45823. // Technically it leverages the (macro) task queue,
  45824. // but it is still a better choice than setTimeout.
  45825. timerFunc = function () {
  45826. setImmediate(flushCallbacks);
  45827. };
  45828. } else {
  45829. // Fallback to setTimeout.
  45830. timerFunc = function () {
  45831. setTimeout(flushCallbacks, 0);
  45832. };
  45833. }
  45834. function nextTick (cb, ctx) {
  45835. var _resolve;
  45836. callbacks.push(function () {
  45837. if (cb) {
  45838. try {
  45839. cb.call(ctx);
  45840. } catch (e) {
  45841. handleError(e, ctx, 'nextTick');
  45842. }
  45843. } else if (_resolve) {
  45844. _resolve(ctx);
  45845. }
  45846. });
  45847. if (!pending) {
  45848. pending = true;
  45849. timerFunc();
  45850. }
  45851. // $flow-disable-line
  45852. if (!cb && typeof Promise !== 'undefined') {
  45853. return new Promise(function (resolve) {
  45854. _resolve = resolve;
  45855. })
  45856. }
  45857. }
  45858. /* */
  45859. var mark;
  45860. var measure;
  45861. {
  45862. var perf = inBrowser && window.performance;
  45863. /* istanbul ignore if */
  45864. if (
  45865. perf &&
  45866. perf.mark &&
  45867. perf.measure &&
  45868. perf.clearMarks &&
  45869. perf.clearMeasures
  45870. ) {
  45871. mark = function (tag) { return perf.mark(tag); };
  45872. measure = function (name, startTag, endTag) {
  45873. perf.measure(name, startTag, endTag);
  45874. perf.clearMarks(startTag);
  45875. perf.clearMarks(endTag);
  45876. // perf.clearMeasures(name)
  45877. };
  45878. }
  45879. }
  45880. /* not type checking this file because flow doesn't play well with Proxy */
  45881. var initProxy;
  45882. {
  45883. var allowedGlobals = makeMap(
  45884. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  45885. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  45886. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  45887. 'require' // for Webpack/Browserify
  45888. );
  45889. var warnNonPresent = function (target, key) {
  45890. warn(
  45891. "Property or method \"" + key + "\" is not defined on the instance but " +
  45892. 'referenced during render. Make sure that this property is reactive, ' +
  45893. 'either in the data option, or for class-based components, by ' +
  45894. 'initializing the property. ' +
  45895. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  45896. target
  45897. );
  45898. };
  45899. var warnReservedPrefix = function (target, key) {
  45900. warn(
  45901. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  45902. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  45903. 'prevent conflicts with Vue internals. ' +
  45904. 'See: https://vuejs.org/v2/api/#data',
  45905. target
  45906. );
  45907. };
  45908. var hasProxy =
  45909. typeof Proxy !== 'undefined' && isNative(Proxy);
  45910. if (hasProxy) {
  45911. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  45912. config.keyCodes = new Proxy(config.keyCodes, {
  45913. set: function set (target, key, value) {
  45914. if (isBuiltInModifier(key)) {
  45915. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  45916. return false
  45917. } else {
  45918. target[key] = value;
  45919. return true
  45920. }
  45921. }
  45922. });
  45923. }
  45924. var hasHandler = {
  45925. has: function has (target, key) {
  45926. var has = key in target;
  45927. var isAllowed = allowedGlobals(key) ||
  45928. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  45929. if (!has && !isAllowed) {
  45930. if (key in target.$data) { warnReservedPrefix(target, key); }
  45931. else { warnNonPresent(target, key); }
  45932. }
  45933. return has || !isAllowed
  45934. }
  45935. };
  45936. var getHandler = {
  45937. get: function get (target, key) {
  45938. if (typeof key === 'string' && !(key in target)) {
  45939. if (key in target.$data) { warnReservedPrefix(target, key); }
  45940. else { warnNonPresent(target, key); }
  45941. }
  45942. return target[key]
  45943. }
  45944. };
  45945. initProxy = function initProxy (vm) {
  45946. if (hasProxy) {
  45947. // determine which proxy handler to use
  45948. var options = vm.$options;
  45949. var handlers = options.render && options.render._withStripped
  45950. ? getHandler
  45951. : hasHandler;
  45952. vm._renderProxy = new Proxy(vm, handlers);
  45953. } else {
  45954. vm._renderProxy = vm;
  45955. }
  45956. };
  45957. }
  45958. /* */
  45959. var seenObjects = new _Set();
  45960. /**
  45961. * Recursively traverse an object to evoke all converted
  45962. * getters, so that every nested property inside the object
  45963. * is collected as a "deep" dependency.
  45964. */
  45965. function traverse (val) {
  45966. _traverse(val, seenObjects);
  45967. seenObjects.clear();
  45968. }
  45969. function _traverse (val, seen) {
  45970. var i, keys;
  45971. var isA = Array.isArray(val);
  45972. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  45973. return
  45974. }
  45975. if (val.__ob__) {
  45976. var depId = val.__ob__.dep.id;
  45977. if (seen.has(depId)) {
  45978. return
  45979. }
  45980. seen.add(depId);
  45981. }
  45982. if (isA) {
  45983. i = val.length;
  45984. while (i--) { _traverse(val[i], seen); }
  45985. } else {
  45986. keys = Object.keys(val);
  45987. i = keys.length;
  45988. while (i--) { _traverse(val[keys[i]], seen); }
  45989. }
  45990. }
  45991. /* */
  45992. var normalizeEvent = cached(function (name) {
  45993. var passive = name.charAt(0) === '&';
  45994. name = passive ? name.slice(1) : name;
  45995. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  45996. name = once$$1 ? name.slice(1) : name;
  45997. var capture = name.charAt(0) === '!';
  45998. name = capture ? name.slice(1) : name;
  45999. return {
  46000. name: name,
  46001. once: once$$1,
  46002. capture: capture,
  46003. passive: passive
  46004. }
  46005. });
  46006. function createFnInvoker (fns, vm) {
  46007. function invoker () {
  46008. var arguments$1 = arguments;
  46009. var fns = invoker.fns;
  46010. if (Array.isArray(fns)) {
  46011. var cloned = fns.slice();
  46012. for (var i = 0; i < cloned.length; i++) {
  46013. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46014. }
  46015. } else {
  46016. // return handler return value for single handlers
  46017. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46018. }
  46019. }
  46020. invoker.fns = fns;
  46021. return invoker
  46022. }
  46023. function updateListeners (
  46024. on,
  46025. oldOn,
  46026. add,
  46027. remove$$1,
  46028. createOnceHandler,
  46029. vm
  46030. ) {
  46031. var name, def$$1, cur, old, event;
  46032. for (name in on) {
  46033. def$$1 = cur = on[name];
  46034. old = oldOn[name];
  46035. event = normalizeEvent(name);
  46036. if (isUndef(cur)) {
  46037. warn(
  46038. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46039. vm
  46040. );
  46041. } else if (isUndef(old)) {
  46042. if (isUndef(cur.fns)) {
  46043. cur = on[name] = createFnInvoker(cur, vm);
  46044. }
  46045. if (isTrue(event.once)) {
  46046. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46047. }
  46048. add(event.name, cur, event.capture, event.passive, event.params);
  46049. } else if (cur !== old) {
  46050. old.fns = cur;
  46051. on[name] = old;
  46052. }
  46053. }
  46054. for (name in oldOn) {
  46055. if (isUndef(on[name])) {
  46056. event = normalizeEvent(name);
  46057. remove$$1(event.name, oldOn[name], event.capture);
  46058. }
  46059. }
  46060. }
  46061. /* */
  46062. function mergeVNodeHook (def, hookKey, hook) {
  46063. if (def instanceof VNode) {
  46064. def = def.data.hook || (def.data.hook = {});
  46065. }
  46066. var invoker;
  46067. var oldHook = def[hookKey];
  46068. function wrappedHook () {
  46069. hook.apply(this, arguments);
  46070. // important: remove merged hook to ensure it's called only once
  46071. // and prevent memory leak
  46072. remove(invoker.fns, wrappedHook);
  46073. }
  46074. if (isUndef(oldHook)) {
  46075. // no existing hook
  46076. invoker = createFnInvoker([wrappedHook]);
  46077. } else {
  46078. /* istanbul ignore if */
  46079. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46080. // already a merged invoker
  46081. invoker = oldHook;
  46082. invoker.fns.push(wrappedHook);
  46083. } else {
  46084. // existing plain hook
  46085. invoker = createFnInvoker([oldHook, wrappedHook]);
  46086. }
  46087. }
  46088. invoker.merged = true;
  46089. def[hookKey] = invoker;
  46090. }
  46091. /* */
  46092. function extractPropsFromVNodeData (
  46093. data,
  46094. Ctor,
  46095. tag
  46096. ) {
  46097. // we are only extracting raw values here.
  46098. // validation and default values are handled in the child
  46099. // component itself.
  46100. var propOptions = Ctor.options.props;
  46101. if (isUndef(propOptions)) {
  46102. return
  46103. }
  46104. var res = {};
  46105. var attrs = data.attrs;
  46106. var props = data.props;
  46107. if (isDef(attrs) || isDef(props)) {
  46108. for (var key in propOptions) {
  46109. var altKey = hyphenate(key);
  46110. {
  46111. var keyInLowerCase = key.toLowerCase();
  46112. if (
  46113. key !== keyInLowerCase &&
  46114. attrs && hasOwn(attrs, keyInLowerCase)
  46115. ) {
  46116. tip(
  46117. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46118. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46119. " \"" + key + "\". " +
  46120. "Note that HTML attributes are case-insensitive and camelCased " +
  46121. "props need to use their kebab-case equivalents when using in-DOM " +
  46122. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46123. );
  46124. }
  46125. }
  46126. checkProp(res, props, key, altKey, true) ||
  46127. checkProp(res, attrs, key, altKey, false);
  46128. }
  46129. }
  46130. return res
  46131. }
  46132. function checkProp (
  46133. res,
  46134. hash,
  46135. key,
  46136. altKey,
  46137. preserve
  46138. ) {
  46139. if (isDef(hash)) {
  46140. if (hasOwn(hash, key)) {
  46141. res[key] = hash[key];
  46142. if (!preserve) {
  46143. delete hash[key];
  46144. }
  46145. return true
  46146. } else if (hasOwn(hash, altKey)) {
  46147. res[key] = hash[altKey];
  46148. if (!preserve) {
  46149. delete hash[altKey];
  46150. }
  46151. return true
  46152. }
  46153. }
  46154. return false
  46155. }
  46156. /* */
  46157. // The template compiler attempts to minimize the need for normalization by
  46158. // statically analyzing the template at compile time.
  46159. //
  46160. // For plain HTML markup, normalization can be completely skipped because the
  46161. // generated render function is guaranteed to return Array<VNode>. There are
  46162. // two cases where extra normalization is needed:
  46163. // 1. When the children contains components - because a functional component
  46164. // may return an Array instead of a single root. In this case, just a simple
  46165. // normalization is needed - if any child is an Array, we flatten the whole
  46166. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46167. // because functional components already normalize their own children.
  46168. function simpleNormalizeChildren (children) {
  46169. for (var i = 0; i < children.length; i++) {
  46170. if (Array.isArray(children[i])) {
  46171. return Array.prototype.concat.apply([], children)
  46172. }
  46173. }
  46174. return children
  46175. }
  46176. // 2. When the children contains constructs that always generated nested Arrays,
  46177. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46178. // with hand-written render functions / JSX. In such cases a full normalization
  46179. // is needed to cater to all possible types of children values.
  46180. function normalizeChildren (children) {
  46181. return isPrimitive(children)
  46182. ? [createTextVNode(children)]
  46183. : Array.isArray(children)
  46184. ? normalizeArrayChildren(children)
  46185. : undefined
  46186. }
  46187. function isTextNode (node) {
  46188. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46189. }
  46190. function normalizeArrayChildren (children, nestedIndex) {
  46191. var res = [];
  46192. var i, c, lastIndex, last;
  46193. for (i = 0; i < children.length; i++) {
  46194. c = children[i];
  46195. if (isUndef(c) || typeof c === 'boolean') { continue }
  46196. lastIndex = res.length - 1;
  46197. last = res[lastIndex];
  46198. // nested
  46199. if (Array.isArray(c)) {
  46200. if (c.length > 0) {
  46201. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46202. // merge adjacent text nodes
  46203. if (isTextNode(c[0]) && isTextNode(last)) {
  46204. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46205. c.shift();
  46206. }
  46207. res.push.apply(res, c);
  46208. }
  46209. } else if (isPrimitive(c)) {
  46210. if (isTextNode(last)) {
  46211. // merge adjacent text nodes
  46212. // this is necessary for SSR hydration because text nodes are
  46213. // essentially merged when rendered to HTML strings
  46214. res[lastIndex] = createTextVNode(last.text + c);
  46215. } else if (c !== '') {
  46216. // convert primitive to vnode
  46217. res.push(createTextVNode(c));
  46218. }
  46219. } else {
  46220. if (isTextNode(c) && isTextNode(last)) {
  46221. // merge adjacent text nodes
  46222. res[lastIndex] = createTextVNode(last.text + c.text);
  46223. } else {
  46224. // default key for nested array children (likely generated by v-for)
  46225. if (isTrue(children._isVList) &&
  46226. isDef(c.tag) &&
  46227. isUndef(c.key) &&
  46228. isDef(nestedIndex)) {
  46229. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46230. }
  46231. res.push(c);
  46232. }
  46233. }
  46234. }
  46235. return res
  46236. }
  46237. /* */
  46238. function initProvide (vm) {
  46239. var provide = vm.$options.provide;
  46240. if (provide) {
  46241. vm._provided = typeof provide === 'function'
  46242. ? provide.call(vm)
  46243. : provide;
  46244. }
  46245. }
  46246. function initInjections (vm) {
  46247. var result = resolveInject(vm.$options.inject, vm);
  46248. if (result) {
  46249. toggleObserving(false);
  46250. Object.keys(result).forEach(function (key) {
  46251. /* istanbul ignore else */
  46252. {
  46253. defineReactive$$1(vm, key, result[key], function () {
  46254. warn(
  46255. "Avoid mutating an injected value directly since the changes will be " +
  46256. "overwritten whenever the provided component re-renders. " +
  46257. "injection being mutated: \"" + key + "\"",
  46258. vm
  46259. );
  46260. });
  46261. }
  46262. });
  46263. toggleObserving(true);
  46264. }
  46265. }
  46266. function resolveInject (inject, vm) {
  46267. if (inject) {
  46268. // inject is :any because flow is not smart enough to figure out cached
  46269. var result = Object.create(null);
  46270. var keys = hasSymbol
  46271. ? Reflect.ownKeys(inject)
  46272. : Object.keys(inject);
  46273. for (var i = 0; i < keys.length; i++) {
  46274. var key = keys[i];
  46275. // #6574 in case the inject object is observed...
  46276. if (key === '__ob__') { continue }
  46277. var provideKey = inject[key].from;
  46278. var source = vm;
  46279. while (source) {
  46280. if (source._provided && hasOwn(source._provided, provideKey)) {
  46281. result[key] = source._provided[provideKey];
  46282. break
  46283. }
  46284. source = source.$parent;
  46285. }
  46286. if (!source) {
  46287. if ('default' in inject[key]) {
  46288. var provideDefault = inject[key].default;
  46289. result[key] = typeof provideDefault === 'function'
  46290. ? provideDefault.call(vm)
  46291. : provideDefault;
  46292. } else {
  46293. warn(("Injection \"" + key + "\" not found"), vm);
  46294. }
  46295. }
  46296. }
  46297. return result
  46298. }
  46299. }
  46300. /* */
  46301. /**
  46302. * Runtime helper for resolving raw children VNodes into a slot object.
  46303. */
  46304. function resolveSlots (
  46305. children,
  46306. context
  46307. ) {
  46308. if (!children || !children.length) {
  46309. return {}
  46310. }
  46311. var slots = {};
  46312. for (var i = 0, l = children.length; i < l; i++) {
  46313. var child = children[i];
  46314. var data = child.data;
  46315. // remove slot attribute if the node is resolved as a Vue slot node
  46316. if (data && data.attrs && data.attrs.slot) {
  46317. delete data.attrs.slot;
  46318. }
  46319. // named slots should only be respected if the vnode was rendered in the
  46320. // same context.
  46321. if ((child.context === context || child.fnContext === context) &&
  46322. data && data.slot != null
  46323. ) {
  46324. var name = data.slot;
  46325. var slot = (slots[name] || (slots[name] = []));
  46326. if (child.tag === 'template') {
  46327. slot.push.apply(slot, child.children || []);
  46328. } else {
  46329. slot.push(child);
  46330. }
  46331. } else {
  46332. (slots.default || (slots.default = [])).push(child);
  46333. }
  46334. }
  46335. // ignore slots that contains only whitespace
  46336. for (var name$1 in slots) {
  46337. if (slots[name$1].every(isWhitespace)) {
  46338. delete slots[name$1];
  46339. }
  46340. }
  46341. return slots
  46342. }
  46343. function isWhitespace (node) {
  46344. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46345. }
  46346. /* */
  46347. function normalizeScopedSlots (
  46348. slots,
  46349. normalSlots,
  46350. prevSlots
  46351. ) {
  46352. var res;
  46353. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46354. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46355. var key = slots && slots.$key;
  46356. if (!slots) {
  46357. res = {};
  46358. } else if (slots._normalized) {
  46359. // fast path 1: child component re-render only, parent did not change
  46360. return slots._normalized
  46361. } else if (
  46362. isStable &&
  46363. prevSlots &&
  46364. prevSlots !== emptyObject &&
  46365. key === prevSlots.$key &&
  46366. !hasNormalSlots &&
  46367. !prevSlots.$hasNormal
  46368. ) {
  46369. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46370. // only need to normalize once
  46371. return prevSlots
  46372. } else {
  46373. res = {};
  46374. for (var key$1 in slots) {
  46375. if (slots[key$1] && key$1[0] !== '$') {
  46376. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46377. }
  46378. }
  46379. }
  46380. // expose normal slots on scopedSlots
  46381. for (var key$2 in normalSlots) {
  46382. if (!(key$2 in res)) {
  46383. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46384. }
  46385. }
  46386. // avoriaz seems to mock a non-extensible $scopedSlots object
  46387. // and when that is passed down this would cause an error
  46388. if (slots && Object.isExtensible(slots)) {
  46389. (slots)._normalized = res;
  46390. }
  46391. def(res, '$stable', isStable);
  46392. def(res, '$key', key);
  46393. def(res, '$hasNormal', hasNormalSlots);
  46394. return res
  46395. }
  46396. function normalizeScopedSlot(normalSlots, key, fn) {
  46397. var normalized = function () {
  46398. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46399. res = res && typeof res === 'object' && !Array.isArray(res)
  46400. ? [res] // single vnode
  46401. : normalizeChildren(res);
  46402. return res && (
  46403. res.length === 0 ||
  46404. (res.length === 1 && res[0].isComment) // #9658
  46405. ) ? undefined
  46406. : res
  46407. };
  46408. // this is a slot using the new v-slot syntax without scope. although it is
  46409. // compiled as a scoped slot, render fn users would expect it to be present
  46410. // on this.$slots because the usage is semantically a normal slot.
  46411. if (fn.proxy) {
  46412. Object.defineProperty(normalSlots, key, {
  46413. get: normalized,
  46414. enumerable: true,
  46415. configurable: true
  46416. });
  46417. }
  46418. return normalized
  46419. }
  46420. function proxyNormalSlot(slots, key) {
  46421. return function () { return slots[key]; }
  46422. }
  46423. /* */
  46424. /**
  46425. * Runtime helper for rendering v-for lists.
  46426. */
  46427. function renderList (
  46428. val,
  46429. render
  46430. ) {
  46431. var ret, i, l, keys, key;
  46432. if (Array.isArray(val) || typeof val === 'string') {
  46433. ret = new Array(val.length);
  46434. for (i = 0, l = val.length; i < l; i++) {
  46435. ret[i] = render(val[i], i);
  46436. }
  46437. } else if (typeof val === 'number') {
  46438. ret = new Array(val);
  46439. for (i = 0; i < val; i++) {
  46440. ret[i] = render(i + 1, i);
  46441. }
  46442. } else if (isObject(val)) {
  46443. if (hasSymbol && val[Symbol.iterator]) {
  46444. ret = [];
  46445. var iterator = val[Symbol.iterator]();
  46446. var result = iterator.next();
  46447. while (!result.done) {
  46448. ret.push(render(result.value, ret.length));
  46449. result = iterator.next();
  46450. }
  46451. } else {
  46452. keys = Object.keys(val);
  46453. ret = new Array(keys.length);
  46454. for (i = 0, l = keys.length; i < l; i++) {
  46455. key = keys[i];
  46456. ret[i] = render(val[key], key, i);
  46457. }
  46458. }
  46459. }
  46460. if (!isDef(ret)) {
  46461. ret = [];
  46462. }
  46463. (ret)._isVList = true;
  46464. return ret
  46465. }
  46466. /* */
  46467. /**
  46468. * Runtime helper for rendering <slot>
  46469. */
  46470. function renderSlot (
  46471. name,
  46472. fallback,
  46473. props,
  46474. bindObject
  46475. ) {
  46476. var scopedSlotFn = this.$scopedSlots[name];
  46477. var nodes;
  46478. if (scopedSlotFn) { // scoped slot
  46479. props = props || {};
  46480. if (bindObject) {
  46481. if (!isObject(bindObject)) {
  46482. warn(
  46483. 'slot v-bind without argument expects an Object',
  46484. this
  46485. );
  46486. }
  46487. props = extend(extend({}, bindObject), props);
  46488. }
  46489. nodes = scopedSlotFn(props) || fallback;
  46490. } else {
  46491. nodes = this.$slots[name] || fallback;
  46492. }
  46493. var target = props && props.slot;
  46494. if (target) {
  46495. return this.$createElement('template', { slot: target }, nodes)
  46496. } else {
  46497. return nodes
  46498. }
  46499. }
  46500. /* */
  46501. /**
  46502. * Runtime helper for resolving filters
  46503. */
  46504. function resolveFilter (id) {
  46505. return resolveAsset(this.$options, 'filters', id, true) || identity
  46506. }
  46507. /* */
  46508. function isKeyNotMatch (expect, actual) {
  46509. if (Array.isArray(expect)) {
  46510. return expect.indexOf(actual) === -1
  46511. } else {
  46512. return expect !== actual
  46513. }
  46514. }
  46515. /**
  46516. * Runtime helper for checking keyCodes from config.
  46517. * exposed as Vue.prototype._k
  46518. * passing in eventKeyName as last argument separately for backwards compat
  46519. */
  46520. function checkKeyCodes (
  46521. eventKeyCode,
  46522. key,
  46523. builtInKeyCode,
  46524. eventKeyName,
  46525. builtInKeyName
  46526. ) {
  46527. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  46528. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  46529. return isKeyNotMatch(builtInKeyName, eventKeyName)
  46530. } else if (mappedKeyCode) {
  46531. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  46532. } else if (eventKeyName) {
  46533. return hyphenate(eventKeyName) !== key
  46534. }
  46535. }
  46536. /* */
  46537. /**
  46538. * Runtime helper for merging v-bind="object" into a VNode's data.
  46539. */
  46540. function bindObjectProps (
  46541. data,
  46542. tag,
  46543. value,
  46544. asProp,
  46545. isSync
  46546. ) {
  46547. if (value) {
  46548. if (!isObject(value)) {
  46549. warn(
  46550. 'v-bind without argument expects an Object or Array value',
  46551. this
  46552. );
  46553. } else {
  46554. if (Array.isArray(value)) {
  46555. value = toObject(value);
  46556. }
  46557. var hash;
  46558. var loop = function ( key ) {
  46559. if (
  46560. key === 'class' ||
  46561. key === 'style' ||
  46562. isReservedAttribute(key)
  46563. ) {
  46564. hash = data;
  46565. } else {
  46566. var type = data.attrs && data.attrs.type;
  46567. hash = asProp || config.mustUseProp(tag, type, key)
  46568. ? data.domProps || (data.domProps = {})
  46569. : data.attrs || (data.attrs = {});
  46570. }
  46571. var camelizedKey = camelize(key);
  46572. var hyphenatedKey = hyphenate(key);
  46573. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  46574. hash[key] = value[key];
  46575. if (isSync) {
  46576. var on = data.on || (data.on = {});
  46577. on[("update:" + key)] = function ($event) {
  46578. value[key] = $event;
  46579. };
  46580. }
  46581. }
  46582. };
  46583. for (var key in value) loop( key );
  46584. }
  46585. }
  46586. return data
  46587. }
  46588. /* */
  46589. /**
  46590. * Runtime helper for rendering static trees.
  46591. */
  46592. function renderStatic (
  46593. index,
  46594. isInFor
  46595. ) {
  46596. var cached = this._staticTrees || (this._staticTrees = []);
  46597. var tree = cached[index];
  46598. // if has already-rendered static tree and not inside v-for,
  46599. // we can reuse the same tree.
  46600. if (tree && !isInFor) {
  46601. return tree
  46602. }
  46603. // otherwise, render a fresh tree.
  46604. tree = cached[index] = this.$options.staticRenderFns[index].call(
  46605. this._renderProxy,
  46606. null,
  46607. this // for render fns generated for functional component templates
  46608. );
  46609. markStatic(tree, ("__static__" + index), false);
  46610. return tree
  46611. }
  46612. /**
  46613. * Runtime helper for v-once.
  46614. * Effectively it means marking the node as static with a unique key.
  46615. */
  46616. function markOnce (
  46617. tree,
  46618. index,
  46619. key
  46620. ) {
  46621. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  46622. return tree
  46623. }
  46624. function markStatic (
  46625. tree,
  46626. key,
  46627. isOnce
  46628. ) {
  46629. if (Array.isArray(tree)) {
  46630. for (var i = 0; i < tree.length; i++) {
  46631. if (tree[i] && typeof tree[i] !== 'string') {
  46632. markStaticNode(tree[i], (key + "_" + i), isOnce);
  46633. }
  46634. }
  46635. } else {
  46636. markStaticNode(tree, key, isOnce);
  46637. }
  46638. }
  46639. function markStaticNode (node, key, isOnce) {
  46640. node.isStatic = true;
  46641. node.key = key;
  46642. node.isOnce = isOnce;
  46643. }
  46644. /* */
  46645. function bindObjectListeners (data, value) {
  46646. if (value) {
  46647. if (!isPlainObject(value)) {
  46648. warn(
  46649. 'v-on without argument expects an Object value',
  46650. this
  46651. );
  46652. } else {
  46653. var on = data.on = data.on ? extend({}, data.on) : {};
  46654. for (var key in value) {
  46655. var existing = on[key];
  46656. var ours = value[key];
  46657. on[key] = existing ? [].concat(existing, ours) : ours;
  46658. }
  46659. }
  46660. }
  46661. return data
  46662. }
  46663. /* */
  46664. function resolveScopedSlots (
  46665. fns, // see flow/vnode
  46666. res,
  46667. // the following are added in 2.6
  46668. hasDynamicKeys,
  46669. contentHashKey
  46670. ) {
  46671. res = res || { $stable: !hasDynamicKeys };
  46672. for (var i = 0; i < fns.length; i++) {
  46673. var slot = fns[i];
  46674. if (Array.isArray(slot)) {
  46675. resolveScopedSlots(slot, res, hasDynamicKeys);
  46676. } else if (slot) {
  46677. // marker for reverse proxying v-slot without scope on this.$slots
  46678. if (slot.proxy) {
  46679. slot.fn.proxy = true;
  46680. }
  46681. res[slot.key] = slot.fn;
  46682. }
  46683. }
  46684. if (contentHashKey) {
  46685. (res).$key = contentHashKey;
  46686. }
  46687. return res
  46688. }
  46689. /* */
  46690. function bindDynamicKeys (baseObj, values) {
  46691. for (var i = 0; i < values.length; i += 2) {
  46692. var key = values[i];
  46693. if (typeof key === 'string' && key) {
  46694. baseObj[values[i]] = values[i + 1];
  46695. } else if (key !== '' && key !== null) {
  46696. // null is a special value for explicitly removing a binding
  46697. warn(
  46698. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  46699. this
  46700. );
  46701. }
  46702. }
  46703. return baseObj
  46704. }
  46705. // helper to dynamically append modifier runtime markers to event names.
  46706. // ensure only append when value is already string, otherwise it will be cast
  46707. // to string and cause the type check to miss.
  46708. function prependModifier (value, symbol) {
  46709. return typeof value === 'string' ? symbol + value : value
  46710. }
  46711. /* */
  46712. function installRenderHelpers (target) {
  46713. target._o = markOnce;
  46714. target._n = toNumber;
  46715. target._s = toString;
  46716. target._l = renderList;
  46717. target._t = renderSlot;
  46718. target._q = looseEqual;
  46719. target._i = looseIndexOf;
  46720. target._m = renderStatic;
  46721. target._f = resolveFilter;
  46722. target._k = checkKeyCodes;
  46723. target._b = bindObjectProps;
  46724. target._v = createTextVNode;
  46725. target._e = createEmptyVNode;
  46726. target._u = resolveScopedSlots;
  46727. target._g = bindObjectListeners;
  46728. target._d = bindDynamicKeys;
  46729. target._p = prependModifier;
  46730. }
  46731. /* */
  46732. function FunctionalRenderContext (
  46733. data,
  46734. props,
  46735. children,
  46736. parent,
  46737. Ctor
  46738. ) {
  46739. var this$1 = this;
  46740. var options = Ctor.options;
  46741. // ensure the createElement function in functional components
  46742. // gets a unique context - this is necessary for correct named slot check
  46743. var contextVm;
  46744. if (hasOwn(parent, '_uid')) {
  46745. contextVm = Object.create(parent);
  46746. // $flow-disable-line
  46747. contextVm._original = parent;
  46748. } else {
  46749. // the context vm passed in is a functional context as well.
  46750. // in this case we want to make sure we are able to get a hold to the
  46751. // real context instance.
  46752. contextVm = parent;
  46753. // $flow-disable-line
  46754. parent = parent._original;
  46755. }
  46756. var isCompiled = isTrue(options._compiled);
  46757. var needNormalization = !isCompiled;
  46758. this.data = data;
  46759. this.props = props;
  46760. this.children = children;
  46761. this.parent = parent;
  46762. this.listeners = data.on || emptyObject;
  46763. this.injections = resolveInject(options.inject, parent);
  46764. this.slots = function () {
  46765. if (!this$1.$slots) {
  46766. normalizeScopedSlots(
  46767. data.scopedSlots,
  46768. this$1.$slots = resolveSlots(children, parent)
  46769. );
  46770. }
  46771. return this$1.$slots
  46772. };
  46773. Object.defineProperty(this, 'scopedSlots', ({
  46774. enumerable: true,
  46775. get: function get () {
  46776. return normalizeScopedSlots(data.scopedSlots, this.slots())
  46777. }
  46778. }));
  46779. // support for compiled functional template
  46780. if (isCompiled) {
  46781. // exposing $options for renderStatic()
  46782. this.$options = options;
  46783. // pre-resolve slots for renderSlot()
  46784. this.$slots = this.slots();
  46785. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  46786. }
  46787. if (options._scopeId) {
  46788. this._c = function (a, b, c, d) {
  46789. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  46790. if (vnode && !Array.isArray(vnode)) {
  46791. vnode.fnScopeId = options._scopeId;
  46792. vnode.fnContext = parent;
  46793. }
  46794. return vnode
  46795. };
  46796. } else {
  46797. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  46798. }
  46799. }
  46800. installRenderHelpers(FunctionalRenderContext.prototype);
  46801. function createFunctionalComponent (
  46802. Ctor,
  46803. propsData,
  46804. data,
  46805. contextVm,
  46806. children
  46807. ) {
  46808. var options = Ctor.options;
  46809. var props = {};
  46810. var propOptions = options.props;
  46811. if (isDef(propOptions)) {
  46812. for (var key in propOptions) {
  46813. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  46814. }
  46815. } else {
  46816. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  46817. if (isDef(data.props)) { mergeProps(props, data.props); }
  46818. }
  46819. var renderContext = new FunctionalRenderContext(
  46820. data,
  46821. props,
  46822. children,
  46823. contextVm,
  46824. Ctor
  46825. );
  46826. var vnode = options.render.call(null, renderContext._c, renderContext);
  46827. if (vnode instanceof VNode) {
  46828. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  46829. } else if (Array.isArray(vnode)) {
  46830. var vnodes = normalizeChildren(vnode) || [];
  46831. var res = new Array(vnodes.length);
  46832. for (var i = 0; i < vnodes.length; i++) {
  46833. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  46834. }
  46835. return res
  46836. }
  46837. }
  46838. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  46839. // #7817 clone node before setting fnContext, otherwise if the node is reused
  46840. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  46841. // that should not be matched to match.
  46842. var clone = cloneVNode(vnode);
  46843. clone.fnContext = contextVm;
  46844. clone.fnOptions = options;
  46845. {
  46846. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  46847. }
  46848. if (data.slot) {
  46849. (clone.data || (clone.data = {})).slot = data.slot;
  46850. }
  46851. return clone
  46852. }
  46853. function mergeProps (to, from) {
  46854. for (var key in from) {
  46855. to[camelize(key)] = from[key];
  46856. }
  46857. }
  46858. /* */
  46859. /* */
  46860. /* */
  46861. /* */
  46862. // inline hooks to be invoked on component VNodes during patch
  46863. var componentVNodeHooks = {
  46864. init: function init (vnode, hydrating) {
  46865. if (
  46866. vnode.componentInstance &&
  46867. !vnode.componentInstance._isDestroyed &&
  46868. vnode.data.keepAlive
  46869. ) {
  46870. // kept-alive components, treat as a patch
  46871. var mountedNode = vnode; // work around flow
  46872. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  46873. } else {
  46874. var child = vnode.componentInstance = createComponentInstanceForVnode(
  46875. vnode,
  46876. activeInstance
  46877. );
  46878. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  46879. }
  46880. },
  46881. prepatch: function prepatch (oldVnode, vnode) {
  46882. var options = vnode.componentOptions;
  46883. var child = vnode.componentInstance = oldVnode.componentInstance;
  46884. updateChildComponent(
  46885. child,
  46886. options.propsData, // updated props
  46887. options.listeners, // updated listeners
  46888. vnode, // new parent vnode
  46889. options.children // new children
  46890. );
  46891. },
  46892. insert: function insert (vnode) {
  46893. var context = vnode.context;
  46894. var componentInstance = vnode.componentInstance;
  46895. if (!componentInstance._isMounted) {
  46896. componentInstance._isMounted = true;
  46897. callHook(componentInstance, 'mounted');
  46898. }
  46899. if (vnode.data.keepAlive) {
  46900. if (context._isMounted) {
  46901. // vue-router#1212
  46902. // During updates, a kept-alive component's child components may
  46903. // change, so directly walking the tree here may call activated hooks
  46904. // on incorrect children. Instead we push them into a queue which will
  46905. // be processed after the whole patch process ended.
  46906. queueActivatedComponent(componentInstance);
  46907. } else {
  46908. activateChildComponent(componentInstance, true /* direct */);
  46909. }
  46910. }
  46911. },
  46912. destroy: function destroy (vnode) {
  46913. var componentInstance = vnode.componentInstance;
  46914. if (!componentInstance._isDestroyed) {
  46915. if (!vnode.data.keepAlive) {
  46916. componentInstance.$destroy();
  46917. } else {
  46918. deactivateChildComponent(componentInstance, true /* direct */);
  46919. }
  46920. }
  46921. }
  46922. };
  46923. var hooksToMerge = Object.keys(componentVNodeHooks);
  46924. function createComponent (
  46925. Ctor,
  46926. data,
  46927. context,
  46928. children,
  46929. tag
  46930. ) {
  46931. if (isUndef(Ctor)) {
  46932. return
  46933. }
  46934. var baseCtor = context.$options._base;
  46935. // plain options object: turn it into a constructor
  46936. if (isObject(Ctor)) {
  46937. Ctor = baseCtor.extend(Ctor);
  46938. }
  46939. // if at this stage it's not a constructor or an async component factory,
  46940. // reject.
  46941. if (typeof Ctor !== 'function') {
  46942. {
  46943. warn(("Invalid Component definition: " + (String(Ctor))), context);
  46944. }
  46945. return
  46946. }
  46947. // async component
  46948. var asyncFactory;
  46949. if (isUndef(Ctor.cid)) {
  46950. asyncFactory = Ctor;
  46951. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  46952. if (Ctor === undefined) {
  46953. // return a placeholder node for async component, which is rendered
  46954. // as a comment node but preserves all the raw information for the node.
  46955. // the information will be used for async server-rendering and hydration.
  46956. return createAsyncPlaceholder(
  46957. asyncFactory,
  46958. data,
  46959. context,
  46960. children,
  46961. tag
  46962. )
  46963. }
  46964. }
  46965. data = data || {};
  46966. // resolve constructor options in case global mixins are applied after
  46967. // component constructor creation
  46968. resolveConstructorOptions(Ctor);
  46969. // transform component v-model data into props & events
  46970. if (isDef(data.model)) {
  46971. transformModel(Ctor.options, data);
  46972. }
  46973. // extract props
  46974. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  46975. // functional component
  46976. if (isTrue(Ctor.options.functional)) {
  46977. return createFunctionalComponent(Ctor, propsData, data, context, children)
  46978. }
  46979. // extract listeners, since these needs to be treated as
  46980. // child component listeners instead of DOM listeners
  46981. var listeners = data.on;
  46982. // replace with listeners with .native modifier
  46983. // so it gets processed during parent component patch.
  46984. data.on = data.nativeOn;
  46985. if (isTrue(Ctor.options.abstract)) {
  46986. // abstract components do not keep anything
  46987. // other than props & listeners & slot
  46988. // work around flow
  46989. var slot = data.slot;
  46990. data = {};
  46991. if (slot) {
  46992. data.slot = slot;
  46993. }
  46994. }
  46995. // install component management hooks onto the placeholder node
  46996. installComponentHooks(data);
  46997. // return a placeholder vnode
  46998. var name = Ctor.options.name || tag;
  46999. var vnode = new VNode(
  47000. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47001. data, undefined, undefined, undefined, context,
  47002. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47003. asyncFactory
  47004. );
  47005. return vnode
  47006. }
  47007. function createComponentInstanceForVnode (
  47008. vnode, // we know it's MountedComponentVNode but flow doesn't
  47009. parent // activeInstance in lifecycle state
  47010. ) {
  47011. var options = {
  47012. _isComponent: true,
  47013. _parentVnode: vnode,
  47014. parent: parent
  47015. };
  47016. // check inline-template render functions
  47017. var inlineTemplate = vnode.data.inlineTemplate;
  47018. if (isDef(inlineTemplate)) {
  47019. options.render = inlineTemplate.render;
  47020. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47021. }
  47022. return new vnode.componentOptions.Ctor(options)
  47023. }
  47024. function installComponentHooks (data) {
  47025. var hooks = data.hook || (data.hook = {});
  47026. for (var i = 0; i < hooksToMerge.length; i++) {
  47027. var key = hooksToMerge[i];
  47028. var existing = hooks[key];
  47029. var toMerge = componentVNodeHooks[key];
  47030. if (existing !== toMerge && !(existing && existing._merged)) {
  47031. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47032. }
  47033. }
  47034. }
  47035. function mergeHook$1 (f1, f2) {
  47036. var merged = function (a, b) {
  47037. // flow complains about extra args which is why we use any
  47038. f1(a, b);
  47039. f2(a, b);
  47040. };
  47041. merged._merged = true;
  47042. return merged
  47043. }
  47044. // transform component v-model info (value and callback) into
  47045. // prop and event handler respectively.
  47046. function transformModel (options, data) {
  47047. var prop = (options.model && options.model.prop) || 'value';
  47048. var event = (options.model && options.model.event) || 'input'
  47049. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47050. var on = data.on || (data.on = {});
  47051. var existing = on[event];
  47052. var callback = data.model.callback;
  47053. if (isDef(existing)) {
  47054. if (
  47055. Array.isArray(existing)
  47056. ? existing.indexOf(callback) === -1
  47057. : existing !== callback
  47058. ) {
  47059. on[event] = [callback].concat(existing);
  47060. }
  47061. } else {
  47062. on[event] = callback;
  47063. }
  47064. }
  47065. /* */
  47066. var SIMPLE_NORMALIZE = 1;
  47067. var ALWAYS_NORMALIZE = 2;
  47068. // wrapper function for providing a more flexible interface
  47069. // without getting yelled at by flow
  47070. function createElement (
  47071. context,
  47072. tag,
  47073. data,
  47074. children,
  47075. normalizationType,
  47076. alwaysNormalize
  47077. ) {
  47078. if (Array.isArray(data) || isPrimitive(data)) {
  47079. normalizationType = children;
  47080. children = data;
  47081. data = undefined;
  47082. }
  47083. if (isTrue(alwaysNormalize)) {
  47084. normalizationType = ALWAYS_NORMALIZE;
  47085. }
  47086. return _createElement(context, tag, data, children, normalizationType)
  47087. }
  47088. function _createElement (
  47089. context,
  47090. tag,
  47091. data,
  47092. children,
  47093. normalizationType
  47094. ) {
  47095. if (isDef(data) && isDef((data).__ob__)) {
  47096. warn(
  47097. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47098. 'Always create fresh vnode data objects in each render!',
  47099. context
  47100. );
  47101. return createEmptyVNode()
  47102. }
  47103. // object syntax in v-bind
  47104. if (isDef(data) && isDef(data.is)) {
  47105. tag = data.is;
  47106. }
  47107. if (!tag) {
  47108. // in case of component :is set to falsy value
  47109. return createEmptyVNode()
  47110. }
  47111. // warn against non-primitive key
  47112. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47113. ) {
  47114. {
  47115. warn(
  47116. 'Avoid using non-primitive value as key, ' +
  47117. 'use string/number value instead.',
  47118. context
  47119. );
  47120. }
  47121. }
  47122. // support single function children as default scoped slot
  47123. if (Array.isArray(children) &&
  47124. typeof children[0] === 'function'
  47125. ) {
  47126. data = data || {};
  47127. data.scopedSlots = { default: children[0] };
  47128. children.length = 0;
  47129. }
  47130. if (normalizationType === ALWAYS_NORMALIZE) {
  47131. children = normalizeChildren(children);
  47132. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47133. children = simpleNormalizeChildren(children);
  47134. }
  47135. var vnode, ns;
  47136. if (typeof tag === 'string') {
  47137. var Ctor;
  47138. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47139. if (config.isReservedTag(tag)) {
  47140. // platform built-in elements
  47141. if (isDef(data) && isDef(data.nativeOn)) {
  47142. warn(
  47143. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47144. context
  47145. );
  47146. }
  47147. vnode = new VNode(
  47148. config.parsePlatformTagName(tag), data, children,
  47149. undefined, undefined, context
  47150. );
  47151. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47152. // component
  47153. vnode = createComponent(Ctor, data, context, children, tag);
  47154. } else {
  47155. // unknown or unlisted namespaced elements
  47156. // check at runtime because it may get assigned a namespace when its
  47157. // parent normalizes children
  47158. vnode = new VNode(
  47159. tag, data, children,
  47160. undefined, undefined, context
  47161. );
  47162. }
  47163. } else {
  47164. // direct component options / constructor
  47165. vnode = createComponent(tag, data, context, children);
  47166. }
  47167. if (Array.isArray(vnode)) {
  47168. return vnode
  47169. } else if (isDef(vnode)) {
  47170. if (isDef(ns)) { applyNS(vnode, ns); }
  47171. if (isDef(data)) { registerDeepBindings(data); }
  47172. return vnode
  47173. } else {
  47174. return createEmptyVNode()
  47175. }
  47176. }
  47177. function applyNS (vnode, ns, force) {
  47178. vnode.ns = ns;
  47179. if (vnode.tag === 'foreignObject') {
  47180. // use default namespace inside foreignObject
  47181. ns = undefined;
  47182. force = true;
  47183. }
  47184. if (isDef(vnode.children)) {
  47185. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47186. var child = vnode.children[i];
  47187. if (isDef(child.tag) && (
  47188. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47189. applyNS(child, ns, force);
  47190. }
  47191. }
  47192. }
  47193. }
  47194. // ref #5318
  47195. // necessary to ensure parent re-render when deep bindings like :style and
  47196. // :class are used on slot nodes
  47197. function registerDeepBindings (data) {
  47198. if (isObject(data.style)) {
  47199. traverse(data.style);
  47200. }
  47201. if (isObject(data.class)) {
  47202. traverse(data.class);
  47203. }
  47204. }
  47205. /* */
  47206. function initRender (vm) {
  47207. vm._vnode = null; // the root of the child tree
  47208. vm._staticTrees = null; // v-once cached trees
  47209. var options = vm.$options;
  47210. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47211. var renderContext = parentVnode && parentVnode.context;
  47212. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47213. vm.$scopedSlots = emptyObject;
  47214. // bind the createElement fn to this instance
  47215. // so that we get proper render context inside it.
  47216. // args order: tag, data, children, normalizationType, alwaysNormalize
  47217. // internal version is used by render functions compiled from templates
  47218. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47219. // normalization is always applied for the public version, used in
  47220. // user-written render functions.
  47221. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47222. // $attrs & $listeners are exposed for easier HOC creation.
  47223. // they need to be reactive so that HOCs using them are always updated
  47224. var parentData = parentVnode && parentVnode.data;
  47225. /* istanbul ignore else */
  47226. {
  47227. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47228. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47229. }, true);
  47230. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47231. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47232. }, true);
  47233. }
  47234. }
  47235. var currentRenderingInstance = null;
  47236. function renderMixin (Vue) {
  47237. // install runtime convenience helpers
  47238. installRenderHelpers(Vue.prototype);
  47239. Vue.prototype.$nextTick = function (fn) {
  47240. return nextTick(fn, this)
  47241. };
  47242. Vue.prototype._render = function () {
  47243. var vm = this;
  47244. var ref = vm.$options;
  47245. var render = ref.render;
  47246. var _parentVnode = ref._parentVnode;
  47247. if (_parentVnode) {
  47248. vm.$scopedSlots = normalizeScopedSlots(
  47249. _parentVnode.data.scopedSlots,
  47250. vm.$slots,
  47251. vm.$scopedSlots
  47252. );
  47253. }
  47254. // set parent vnode. this allows render functions to have access
  47255. // to the data on the placeholder node.
  47256. vm.$vnode = _parentVnode;
  47257. // render self
  47258. var vnode;
  47259. try {
  47260. // There's no need to maintain a stack because all render fns are called
  47261. // separately from one another. Nested component's render fns are called
  47262. // when parent component is patched.
  47263. currentRenderingInstance = vm;
  47264. vnode = render.call(vm._renderProxy, vm.$createElement);
  47265. } catch (e) {
  47266. handleError(e, vm, "render");
  47267. // return error render result,
  47268. // or previous vnode to prevent render error causing blank component
  47269. /* istanbul ignore else */
  47270. if (vm.$options.renderError) {
  47271. try {
  47272. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47273. } catch (e) {
  47274. handleError(e, vm, "renderError");
  47275. vnode = vm._vnode;
  47276. }
  47277. } else {
  47278. vnode = vm._vnode;
  47279. }
  47280. } finally {
  47281. currentRenderingInstance = null;
  47282. }
  47283. // if the returned array contains only a single node, allow it
  47284. if (Array.isArray(vnode) && vnode.length === 1) {
  47285. vnode = vnode[0];
  47286. }
  47287. // return empty vnode in case the render function errored out
  47288. if (!(vnode instanceof VNode)) {
  47289. if (Array.isArray(vnode)) {
  47290. warn(
  47291. 'Multiple root nodes returned from render function. Render function ' +
  47292. 'should return a single root node.',
  47293. vm
  47294. );
  47295. }
  47296. vnode = createEmptyVNode();
  47297. }
  47298. // set parent
  47299. vnode.parent = _parentVnode;
  47300. return vnode
  47301. };
  47302. }
  47303. /* */
  47304. function ensureCtor (comp, base) {
  47305. if (
  47306. comp.__esModule ||
  47307. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47308. ) {
  47309. comp = comp.default;
  47310. }
  47311. return isObject(comp)
  47312. ? base.extend(comp)
  47313. : comp
  47314. }
  47315. function createAsyncPlaceholder (
  47316. factory,
  47317. data,
  47318. context,
  47319. children,
  47320. tag
  47321. ) {
  47322. var node = createEmptyVNode();
  47323. node.asyncFactory = factory;
  47324. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47325. return node
  47326. }
  47327. function resolveAsyncComponent (
  47328. factory,
  47329. baseCtor
  47330. ) {
  47331. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47332. return factory.errorComp
  47333. }
  47334. if (isDef(factory.resolved)) {
  47335. return factory.resolved
  47336. }
  47337. var owner = currentRenderingInstance;
  47338. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47339. // already pending
  47340. factory.owners.push(owner);
  47341. }
  47342. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47343. return factory.loadingComp
  47344. }
  47345. if (owner && !isDef(factory.owners)) {
  47346. var owners = factory.owners = [owner];
  47347. var sync = true;
  47348. var timerLoading = null;
  47349. var timerTimeout = null
  47350. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47351. var forceRender = function (renderCompleted) {
  47352. for (var i = 0, l = owners.length; i < l; i++) {
  47353. (owners[i]).$forceUpdate();
  47354. }
  47355. if (renderCompleted) {
  47356. owners.length = 0;
  47357. if (timerLoading !== null) {
  47358. clearTimeout(timerLoading);
  47359. timerLoading = null;
  47360. }
  47361. if (timerTimeout !== null) {
  47362. clearTimeout(timerTimeout);
  47363. timerTimeout = null;
  47364. }
  47365. }
  47366. };
  47367. var resolve = once(function (res) {
  47368. // cache resolved
  47369. factory.resolved = ensureCtor(res, baseCtor);
  47370. // invoke callbacks only if this is not a synchronous resolve
  47371. // (async resolves are shimmed as synchronous during SSR)
  47372. if (!sync) {
  47373. forceRender(true);
  47374. } else {
  47375. owners.length = 0;
  47376. }
  47377. });
  47378. var reject = once(function (reason) {
  47379. warn(
  47380. "Failed to resolve async component: " + (String(factory)) +
  47381. (reason ? ("\nReason: " + reason) : '')
  47382. );
  47383. if (isDef(factory.errorComp)) {
  47384. factory.error = true;
  47385. forceRender(true);
  47386. }
  47387. });
  47388. var res = factory(resolve, reject);
  47389. if (isObject(res)) {
  47390. if (isPromise(res)) {
  47391. // () => Promise
  47392. if (isUndef(factory.resolved)) {
  47393. res.then(resolve, reject);
  47394. }
  47395. } else if (isPromise(res.component)) {
  47396. res.component.then(resolve, reject);
  47397. if (isDef(res.error)) {
  47398. factory.errorComp = ensureCtor(res.error, baseCtor);
  47399. }
  47400. if (isDef(res.loading)) {
  47401. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47402. if (res.delay === 0) {
  47403. factory.loading = true;
  47404. } else {
  47405. timerLoading = setTimeout(function () {
  47406. timerLoading = null;
  47407. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47408. factory.loading = true;
  47409. forceRender(false);
  47410. }
  47411. }, res.delay || 200);
  47412. }
  47413. }
  47414. if (isDef(res.timeout)) {
  47415. timerTimeout = setTimeout(function () {
  47416. timerTimeout = null;
  47417. if (isUndef(factory.resolved)) {
  47418. reject(
  47419. "timeout (" + (res.timeout) + "ms)"
  47420. );
  47421. }
  47422. }, res.timeout);
  47423. }
  47424. }
  47425. }
  47426. sync = false;
  47427. // return in case resolved synchronously
  47428. return factory.loading
  47429. ? factory.loadingComp
  47430. : factory.resolved
  47431. }
  47432. }
  47433. /* */
  47434. function isAsyncPlaceholder (node) {
  47435. return node.isComment && node.asyncFactory
  47436. }
  47437. /* */
  47438. function getFirstComponentChild (children) {
  47439. if (Array.isArray(children)) {
  47440. for (var i = 0; i < children.length; i++) {
  47441. var c = children[i];
  47442. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47443. return c
  47444. }
  47445. }
  47446. }
  47447. }
  47448. /* */
  47449. /* */
  47450. function initEvents (vm) {
  47451. vm._events = Object.create(null);
  47452. vm._hasHookEvent = false;
  47453. // init parent attached events
  47454. var listeners = vm.$options._parentListeners;
  47455. if (listeners) {
  47456. updateComponentListeners(vm, listeners);
  47457. }
  47458. }
  47459. var target;
  47460. function add (event, fn) {
  47461. target.$on(event, fn);
  47462. }
  47463. function remove$1 (event, fn) {
  47464. target.$off(event, fn);
  47465. }
  47466. function createOnceHandler (event, fn) {
  47467. var _target = target;
  47468. return function onceHandler () {
  47469. var res = fn.apply(null, arguments);
  47470. if (res !== null) {
  47471. _target.$off(event, onceHandler);
  47472. }
  47473. }
  47474. }
  47475. function updateComponentListeners (
  47476. vm,
  47477. listeners,
  47478. oldListeners
  47479. ) {
  47480. target = vm;
  47481. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47482. target = undefined;
  47483. }
  47484. function eventsMixin (Vue) {
  47485. var hookRE = /^hook:/;
  47486. Vue.prototype.$on = function (event, fn) {
  47487. var vm = this;
  47488. if (Array.isArray(event)) {
  47489. for (var i = 0, l = event.length; i < l; i++) {
  47490. vm.$on(event[i], fn);
  47491. }
  47492. } else {
  47493. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47494. // optimize hook:event cost by using a boolean flag marked at registration
  47495. // instead of a hash lookup
  47496. if (hookRE.test(event)) {
  47497. vm._hasHookEvent = true;
  47498. }
  47499. }
  47500. return vm
  47501. };
  47502. Vue.prototype.$once = function (event, fn) {
  47503. var vm = this;
  47504. function on () {
  47505. vm.$off(event, on);
  47506. fn.apply(vm, arguments);
  47507. }
  47508. on.fn = fn;
  47509. vm.$on(event, on);
  47510. return vm
  47511. };
  47512. Vue.prototype.$off = function (event, fn) {
  47513. var vm = this;
  47514. // all
  47515. if (!arguments.length) {
  47516. vm._events = Object.create(null);
  47517. return vm
  47518. }
  47519. // array of events
  47520. if (Array.isArray(event)) {
  47521. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  47522. vm.$off(event[i$1], fn);
  47523. }
  47524. return vm
  47525. }
  47526. // specific event
  47527. var cbs = vm._events[event];
  47528. if (!cbs) {
  47529. return vm
  47530. }
  47531. if (!fn) {
  47532. vm._events[event] = null;
  47533. return vm
  47534. }
  47535. // specific handler
  47536. var cb;
  47537. var i = cbs.length;
  47538. while (i--) {
  47539. cb = cbs[i];
  47540. if (cb === fn || cb.fn === fn) {
  47541. cbs.splice(i, 1);
  47542. break
  47543. }
  47544. }
  47545. return vm
  47546. };
  47547. Vue.prototype.$emit = function (event) {
  47548. var vm = this;
  47549. {
  47550. var lowerCaseEvent = event.toLowerCase();
  47551. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  47552. tip(
  47553. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  47554. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  47555. "Note that HTML attributes are case-insensitive and you cannot use " +
  47556. "v-on to listen to camelCase events when using in-DOM templates. " +
  47557. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  47558. );
  47559. }
  47560. }
  47561. var cbs = vm._events[event];
  47562. if (cbs) {
  47563. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  47564. var args = toArray(arguments, 1);
  47565. var info = "event handler for \"" + event + "\"";
  47566. for (var i = 0, l = cbs.length; i < l; i++) {
  47567. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  47568. }
  47569. }
  47570. return vm
  47571. };
  47572. }
  47573. /* */
  47574. var activeInstance = null;
  47575. var isUpdatingChildComponent = false;
  47576. function setActiveInstance(vm) {
  47577. var prevActiveInstance = activeInstance;
  47578. activeInstance = vm;
  47579. return function () {
  47580. activeInstance = prevActiveInstance;
  47581. }
  47582. }
  47583. function initLifecycle (vm) {
  47584. var options = vm.$options;
  47585. // locate first non-abstract parent
  47586. var parent = options.parent;
  47587. if (parent && !options.abstract) {
  47588. while (parent.$options.abstract && parent.$parent) {
  47589. parent = parent.$parent;
  47590. }
  47591. parent.$children.push(vm);
  47592. }
  47593. vm.$parent = parent;
  47594. vm.$root = parent ? parent.$root : vm;
  47595. vm.$children = [];
  47596. vm.$refs = {};
  47597. vm._watcher = null;
  47598. vm._inactive = null;
  47599. vm._directInactive = false;
  47600. vm._isMounted = false;
  47601. vm._isDestroyed = false;
  47602. vm._isBeingDestroyed = false;
  47603. }
  47604. function lifecycleMixin (Vue) {
  47605. Vue.prototype._update = function (vnode, hydrating) {
  47606. var vm = this;
  47607. var prevEl = vm.$el;
  47608. var prevVnode = vm._vnode;
  47609. var restoreActiveInstance = setActiveInstance(vm);
  47610. vm._vnode = vnode;
  47611. // Vue.prototype.__patch__ is injected in entry points
  47612. // based on the rendering backend used.
  47613. if (!prevVnode) {
  47614. // initial render
  47615. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  47616. } else {
  47617. // updates
  47618. vm.$el = vm.__patch__(prevVnode, vnode);
  47619. }
  47620. restoreActiveInstance();
  47621. // update __vue__ reference
  47622. if (prevEl) {
  47623. prevEl.__vue__ = null;
  47624. }
  47625. if (vm.$el) {
  47626. vm.$el.__vue__ = vm;
  47627. }
  47628. // if parent is an HOC, update its $el as well
  47629. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  47630. vm.$parent.$el = vm.$el;
  47631. }
  47632. // updated hook is called by the scheduler to ensure that children are
  47633. // updated in a parent's updated hook.
  47634. };
  47635. Vue.prototype.$forceUpdate = function () {
  47636. var vm = this;
  47637. if (vm._watcher) {
  47638. vm._watcher.update();
  47639. }
  47640. };
  47641. Vue.prototype.$destroy = function () {
  47642. var vm = this;
  47643. if (vm._isBeingDestroyed) {
  47644. return
  47645. }
  47646. callHook(vm, 'beforeDestroy');
  47647. vm._isBeingDestroyed = true;
  47648. // remove self from parent
  47649. var parent = vm.$parent;
  47650. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  47651. remove(parent.$children, vm);
  47652. }
  47653. // teardown watchers
  47654. if (vm._watcher) {
  47655. vm._watcher.teardown();
  47656. }
  47657. var i = vm._watchers.length;
  47658. while (i--) {
  47659. vm._watchers[i].teardown();
  47660. }
  47661. // remove reference from data ob
  47662. // frozen object may not have observer.
  47663. if (vm._data.__ob__) {
  47664. vm._data.__ob__.vmCount--;
  47665. }
  47666. // call the last hook...
  47667. vm._isDestroyed = true;
  47668. // invoke destroy hooks on current rendered tree
  47669. vm.__patch__(vm._vnode, null);
  47670. // fire destroyed hook
  47671. callHook(vm, 'destroyed');
  47672. // turn off all instance listeners.
  47673. vm.$off();
  47674. // remove __vue__ reference
  47675. if (vm.$el) {
  47676. vm.$el.__vue__ = null;
  47677. }
  47678. // release circular reference (#6759)
  47679. if (vm.$vnode) {
  47680. vm.$vnode.parent = null;
  47681. }
  47682. };
  47683. }
  47684. function mountComponent (
  47685. vm,
  47686. el,
  47687. hydrating
  47688. ) {
  47689. vm.$el = el;
  47690. if (!vm.$options.render) {
  47691. vm.$options.render = createEmptyVNode;
  47692. {
  47693. /* istanbul ignore if */
  47694. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  47695. vm.$options.el || el) {
  47696. warn(
  47697. 'You are using the runtime-only build of Vue where the template ' +
  47698. 'compiler is not available. Either pre-compile the templates into ' +
  47699. 'render functions, or use the compiler-included build.',
  47700. vm
  47701. );
  47702. } else {
  47703. warn(
  47704. 'Failed to mount component: template or render function not defined.',
  47705. vm
  47706. );
  47707. }
  47708. }
  47709. }
  47710. callHook(vm, 'beforeMount');
  47711. var updateComponent;
  47712. /* istanbul ignore if */
  47713. if (config.performance && mark) {
  47714. updateComponent = function () {
  47715. var name = vm._name;
  47716. var id = vm._uid;
  47717. var startTag = "vue-perf-start:" + id;
  47718. var endTag = "vue-perf-end:" + id;
  47719. mark(startTag);
  47720. var vnode = vm._render();
  47721. mark(endTag);
  47722. measure(("vue " + name + " render"), startTag, endTag);
  47723. mark(startTag);
  47724. vm._update(vnode, hydrating);
  47725. mark(endTag);
  47726. measure(("vue " + name + " patch"), startTag, endTag);
  47727. };
  47728. } else {
  47729. updateComponent = function () {
  47730. vm._update(vm._render(), hydrating);
  47731. };
  47732. }
  47733. // we set this to vm._watcher inside the watcher's constructor
  47734. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  47735. // component's mounted hook), which relies on vm._watcher being already defined
  47736. new Watcher(vm, updateComponent, noop, {
  47737. before: function before () {
  47738. if (vm._isMounted && !vm._isDestroyed) {
  47739. callHook(vm, 'beforeUpdate');
  47740. }
  47741. }
  47742. }, true /* isRenderWatcher */);
  47743. hydrating = false;
  47744. // manually mounted instance, call mounted on self
  47745. // mounted is called for render-created child components in its inserted hook
  47746. if (vm.$vnode == null) {
  47747. vm._isMounted = true;
  47748. callHook(vm, 'mounted');
  47749. }
  47750. return vm
  47751. }
  47752. function updateChildComponent (
  47753. vm,
  47754. propsData,
  47755. listeners,
  47756. parentVnode,
  47757. renderChildren
  47758. ) {
  47759. {
  47760. isUpdatingChildComponent = true;
  47761. }
  47762. // determine whether component has slot children
  47763. // we need to do this before overwriting $options._renderChildren.
  47764. // check if there are dynamic scopedSlots (hand-written or compiled but with
  47765. // dynamic slot names). Static scoped slots compiled from template has the
  47766. // "$stable" marker.
  47767. var newScopedSlots = parentVnode.data.scopedSlots;
  47768. var oldScopedSlots = vm.$scopedSlots;
  47769. var hasDynamicScopedSlot = !!(
  47770. (newScopedSlots && !newScopedSlots.$stable) ||
  47771. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  47772. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  47773. );
  47774. // Any static slot children from the parent may have changed during parent's
  47775. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  47776. // update is necessary to ensure correctness.
  47777. var needsForceUpdate = !!(
  47778. renderChildren || // has new static slots
  47779. vm.$options._renderChildren || // has old static slots
  47780. hasDynamicScopedSlot
  47781. );
  47782. vm.$options._parentVnode = parentVnode;
  47783. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  47784. if (vm._vnode) { // update child tree's parent
  47785. vm._vnode.parent = parentVnode;
  47786. }
  47787. vm.$options._renderChildren = renderChildren;
  47788. // update $attrs and $listeners hash
  47789. // these are also reactive so they may trigger child update if the child
  47790. // used them during render
  47791. vm.$attrs = parentVnode.data.attrs || emptyObject;
  47792. vm.$listeners = listeners || emptyObject;
  47793. // update props
  47794. if (propsData && vm.$options.props) {
  47795. toggleObserving(false);
  47796. var props = vm._props;
  47797. var propKeys = vm.$options._propKeys || [];
  47798. for (var i = 0; i < propKeys.length; i++) {
  47799. var key = propKeys[i];
  47800. var propOptions = vm.$options.props; // wtf flow?
  47801. props[key] = validateProp(key, propOptions, propsData, vm);
  47802. }
  47803. toggleObserving(true);
  47804. // keep a copy of raw propsData
  47805. vm.$options.propsData = propsData;
  47806. }
  47807. // update listeners
  47808. listeners = listeners || emptyObject;
  47809. var oldListeners = vm.$options._parentListeners;
  47810. vm.$options._parentListeners = listeners;
  47811. updateComponentListeners(vm, listeners, oldListeners);
  47812. // resolve slots + force update if has children
  47813. if (needsForceUpdate) {
  47814. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  47815. vm.$forceUpdate();
  47816. }
  47817. {
  47818. isUpdatingChildComponent = false;
  47819. }
  47820. }
  47821. function isInInactiveTree (vm) {
  47822. while (vm && (vm = vm.$parent)) {
  47823. if (vm._inactive) { return true }
  47824. }
  47825. return false
  47826. }
  47827. function activateChildComponent (vm, direct) {
  47828. if (direct) {
  47829. vm._directInactive = false;
  47830. if (isInInactiveTree(vm)) {
  47831. return
  47832. }
  47833. } else if (vm._directInactive) {
  47834. return
  47835. }
  47836. if (vm._inactive || vm._inactive === null) {
  47837. vm._inactive = false;
  47838. for (var i = 0; i < vm.$children.length; i++) {
  47839. activateChildComponent(vm.$children[i]);
  47840. }
  47841. callHook(vm, 'activated');
  47842. }
  47843. }
  47844. function deactivateChildComponent (vm, direct) {
  47845. if (direct) {
  47846. vm._directInactive = true;
  47847. if (isInInactiveTree(vm)) {
  47848. return
  47849. }
  47850. }
  47851. if (!vm._inactive) {
  47852. vm._inactive = true;
  47853. for (var i = 0; i < vm.$children.length; i++) {
  47854. deactivateChildComponent(vm.$children[i]);
  47855. }
  47856. callHook(vm, 'deactivated');
  47857. }
  47858. }
  47859. function callHook (vm, hook) {
  47860. // #7573 disable dep collection when invoking lifecycle hooks
  47861. pushTarget();
  47862. var handlers = vm.$options[hook];
  47863. var info = hook + " hook";
  47864. if (handlers) {
  47865. for (var i = 0, j = handlers.length; i < j; i++) {
  47866. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  47867. }
  47868. }
  47869. if (vm._hasHookEvent) {
  47870. vm.$emit('hook:' + hook);
  47871. }
  47872. popTarget();
  47873. }
  47874. /* */
  47875. var MAX_UPDATE_COUNT = 100;
  47876. var queue = [];
  47877. var activatedChildren = [];
  47878. var has = {};
  47879. var circular = {};
  47880. var waiting = false;
  47881. var flushing = false;
  47882. var index = 0;
  47883. /**
  47884. * Reset the scheduler's state.
  47885. */
  47886. function resetSchedulerState () {
  47887. index = queue.length = activatedChildren.length = 0;
  47888. has = {};
  47889. {
  47890. circular = {};
  47891. }
  47892. waiting = flushing = false;
  47893. }
  47894. // Async edge case #6566 requires saving the timestamp when event listeners are
  47895. // attached. However, calling performance.now() has a perf overhead especially
  47896. // if the page has thousands of event listeners. Instead, we take a timestamp
  47897. // every time the scheduler flushes and use that for all event listeners
  47898. // attached during that flush.
  47899. var currentFlushTimestamp = 0;
  47900. // Async edge case fix requires storing an event listener's attach timestamp.
  47901. var getNow = Date.now;
  47902. // Determine what event timestamp the browser is using. Annoyingly, the
  47903. // timestamp can either be hi-res (relative to page load) or low-res
  47904. // (relative to UNIX epoch), so in order to compare time we have to use the
  47905. // same timestamp type when saving the flush timestamp.
  47906. // All IE versions use low-res event timestamps, and have problematic clock
  47907. // implementations (#9632)
  47908. if (inBrowser && !isIE) {
  47909. var performance = window.performance;
  47910. if (
  47911. performance &&
  47912. typeof performance.now === 'function' &&
  47913. getNow() > document.createEvent('Event').timeStamp
  47914. ) {
  47915. // if the event timestamp, although evaluated AFTER the Date.now(), is
  47916. // smaller than it, it means the event is using a hi-res timestamp,
  47917. // and we need to use the hi-res version for event listener timestamps as
  47918. // well.
  47919. getNow = function () { return performance.now(); };
  47920. }
  47921. }
  47922. /**
  47923. * Flush both queues and run the watchers.
  47924. */
  47925. function flushSchedulerQueue () {
  47926. currentFlushTimestamp = getNow();
  47927. flushing = true;
  47928. var watcher, id;
  47929. // Sort queue before flush.
  47930. // This ensures that:
  47931. // 1. Components are updated from parent to child. (because parent is always
  47932. // created before the child)
  47933. // 2. A component's user watchers are run before its render watcher (because
  47934. // user watchers are created before the render watcher)
  47935. // 3. If a component is destroyed during a parent component's watcher run,
  47936. // its watchers can be skipped.
  47937. queue.sort(function (a, b) { return a.id - b.id; });
  47938. // do not cache length because more watchers might be pushed
  47939. // as we run existing watchers
  47940. for (index = 0; index < queue.length; index++) {
  47941. watcher = queue[index];
  47942. if (watcher.before) {
  47943. watcher.before();
  47944. }
  47945. id = watcher.id;
  47946. has[id] = null;
  47947. watcher.run();
  47948. // in dev build, check and stop circular updates.
  47949. if (has[id] != null) {
  47950. circular[id] = (circular[id] || 0) + 1;
  47951. if (circular[id] > MAX_UPDATE_COUNT) {
  47952. warn(
  47953. 'You may have an infinite update loop ' + (
  47954. watcher.user
  47955. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  47956. : "in a component render function."
  47957. ),
  47958. watcher.vm
  47959. );
  47960. break
  47961. }
  47962. }
  47963. }
  47964. // keep copies of post queues before resetting state
  47965. var activatedQueue = activatedChildren.slice();
  47966. var updatedQueue = queue.slice();
  47967. resetSchedulerState();
  47968. // call component updated and activated hooks
  47969. callActivatedHooks(activatedQueue);
  47970. callUpdatedHooks(updatedQueue);
  47971. // devtool hook
  47972. /* istanbul ignore if */
  47973. if (devtools && config.devtools) {
  47974. devtools.emit('flush');
  47975. }
  47976. }
  47977. function callUpdatedHooks (queue) {
  47978. var i = queue.length;
  47979. while (i--) {
  47980. var watcher = queue[i];
  47981. var vm = watcher.vm;
  47982. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  47983. callHook(vm, 'updated');
  47984. }
  47985. }
  47986. }
  47987. /**
  47988. * Queue a kept-alive component that was activated during patch.
  47989. * The queue will be processed after the entire tree has been patched.
  47990. */
  47991. function queueActivatedComponent (vm) {
  47992. // setting _inactive to false here so that a render function can
  47993. // rely on checking whether it's in an inactive tree (e.g. router-view)
  47994. vm._inactive = false;
  47995. activatedChildren.push(vm);
  47996. }
  47997. function callActivatedHooks (queue) {
  47998. for (var i = 0; i < queue.length; i++) {
  47999. queue[i]._inactive = true;
  48000. activateChildComponent(queue[i], true /* true */);
  48001. }
  48002. }
  48003. /**
  48004. * Push a watcher into the watcher queue.
  48005. * Jobs with duplicate IDs will be skipped unless it's
  48006. * pushed when the queue is being flushed.
  48007. */
  48008. function queueWatcher (watcher) {
  48009. var id = watcher.id;
  48010. if (has[id] == null) {
  48011. has[id] = true;
  48012. if (!flushing) {
  48013. queue.push(watcher);
  48014. } else {
  48015. // if already flushing, splice the watcher based on its id
  48016. // if already past its id, it will be run next immediately.
  48017. var i = queue.length - 1;
  48018. while (i > index && queue[i].id > watcher.id) {
  48019. i--;
  48020. }
  48021. queue.splice(i + 1, 0, watcher);
  48022. }
  48023. // queue the flush
  48024. if (!waiting) {
  48025. waiting = true;
  48026. if (!config.async) {
  48027. flushSchedulerQueue();
  48028. return
  48029. }
  48030. nextTick(flushSchedulerQueue);
  48031. }
  48032. }
  48033. }
  48034. /* */
  48035. var uid$2 = 0;
  48036. /**
  48037. * A watcher parses an expression, collects dependencies,
  48038. * and fires callback when the expression value changes.
  48039. * This is used for both the $watch() api and directives.
  48040. */
  48041. var Watcher = function Watcher (
  48042. vm,
  48043. expOrFn,
  48044. cb,
  48045. options,
  48046. isRenderWatcher
  48047. ) {
  48048. this.vm = vm;
  48049. if (isRenderWatcher) {
  48050. vm._watcher = this;
  48051. }
  48052. vm._watchers.push(this);
  48053. // options
  48054. if (options) {
  48055. this.deep = !!options.deep;
  48056. this.user = !!options.user;
  48057. this.lazy = !!options.lazy;
  48058. this.sync = !!options.sync;
  48059. this.before = options.before;
  48060. } else {
  48061. this.deep = this.user = this.lazy = this.sync = false;
  48062. }
  48063. this.cb = cb;
  48064. this.id = ++uid$2; // uid for batching
  48065. this.active = true;
  48066. this.dirty = this.lazy; // for lazy watchers
  48067. this.deps = [];
  48068. this.newDeps = [];
  48069. this.depIds = new _Set();
  48070. this.newDepIds = new _Set();
  48071. this.expression = expOrFn.toString();
  48072. // parse expression for getter
  48073. if (typeof expOrFn === 'function') {
  48074. this.getter = expOrFn;
  48075. } else {
  48076. this.getter = parsePath(expOrFn);
  48077. if (!this.getter) {
  48078. this.getter = noop;
  48079. warn(
  48080. "Failed watching path: \"" + expOrFn + "\" " +
  48081. 'Watcher only accepts simple dot-delimited paths. ' +
  48082. 'For full control, use a function instead.',
  48083. vm
  48084. );
  48085. }
  48086. }
  48087. this.value = this.lazy
  48088. ? undefined
  48089. : this.get();
  48090. };
  48091. /**
  48092. * Evaluate the getter, and re-collect dependencies.
  48093. */
  48094. Watcher.prototype.get = function get () {
  48095. pushTarget(this);
  48096. var value;
  48097. var vm = this.vm;
  48098. try {
  48099. value = this.getter.call(vm, vm);
  48100. } catch (e) {
  48101. if (this.user) {
  48102. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48103. } else {
  48104. throw e
  48105. }
  48106. } finally {
  48107. // "touch" every property so they are all tracked as
  48108. // dependencies for deep watching
  48109. if (this.deep) {
  48110. traverse(value);
  48111. }
  48112. popTarget();
  48113. this.cleanupDeps();
  48114. }
  48115. return value
  48116. };
  48117. /**
  48118. * Add a dependency to this directive.
  48119. */
  48120. Watcher.prototype.addDep = function addDep (dep) {
  48121. var id = dep.id;
  48122. if (!this.newDepIds.has(id)) {
  48123. this.newDepIds.add(id);
  48124. this.newDeps.push(dep);
  48125. if (!this.depIds.has(id)) {
  48126. dep.addSub(this);
  48127. }
  48128. }
  48129. };
  48130. /**
  48131. * Clean up for dependency collection.
  48132. */
  48133. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48134. var i = this.deps.length;
  48135. while (i--) {
  48136. var dep = this.deps[i];
  48137. if (!this.newDepIds.has(dep.id)) {
  48138. dep.removeSub(this);
  48139. }
  48140. }
  48141. var tmp = this.depIds;
  48142. this.depIds = this.newDepIds;
  48143. this.newDepIds = tmp;
  48144. this.newDepIds.clear();
  48145. tmp = this.deps;
  48146. this.deps = this.newDeps;
  48147. this.newDeps = tmp;
  48148. this.newDeps.length = 0;
  48149. };
  48150. /**
  48151. * Subscriber interface.
  48152. * Will be called when a dependency changes.
  48153. */
  48154. Watcher.prototype.update = function update () {
  48155. /* istanbul ignore else */
  48156. if (this.lazy) {
  48157. this.dirty = true;
  48158. } else if (this.sync) {
  48159. this.run();
  48160. } else {
  48161. queueWatcher(this);
  48162. }
  48163. };
  48164. /**
  48165. * Scheduler job interface.
  48166. * Will be called by the scheduler.
  48167. */
  48168. Watcher.prototype.run = function run () {
  48169. if (this.active) {
  48170. var value = this.get();
  48171. if (
  48172. value !== this.value ||
  48173. // Deep watchers and watchers on Object/Arrays should fire even
  48174. // when the value is the same, because the value may
  48175. // have mutated.
  48176. isObject(value) ||
  48177. this.deep
  48178. ) {
  48179. // set new value
  48180. var oldValue = this.value;
  48181. this.value = value;
  48182. if (this.user) {
  48183. try {
  48184. this.cb.call(this.vm, value, oldValue);
  48185. } catch (e) {
  48186. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48187. }
  48188. } else {
  48189. this.cb.call(this.vm, value, oldValue);
  48190. }
  48191. }
  48192. }
  48193. };
  48194. /**
  48195. * Evaluate the value of the watcher.
  48196. * This only gets called for lazy watchers.
  48197. */
  48198. Watcher.prototype.evaluate = function evaluate () {
  48199. this.value = this.get();
  48200. this.dirty = false;
  48201. };
  48202. /**
  48203. * Depend on all deps collected by this watcher.
  48204. */
  48205. Watcher.prototype.depend = function depend () {
  48206. var i = this.deps.length;
  48207. while (i--) {
  48208. this.deps[i].depend();
  48209. }
  48210. };
  48211. /**
  48212. * Remove self from all dependencies' subscriber list.
  48213. */
  48214. Watcher.prototype.teardown = function teardown () {
  48215. if (this.active) {
  48216. // remove self from vm's watcher list
  48217. // this is a somewhat expensive operation so we skip it
  48218. // if the vm is being destroyed.
  48219. if (!this.vm._isBeingDestroyed) {
  48220. remove(this.vm._watchers, this);
  48221. }
  48222. var i = this.deps.length;
  48223. while (i--) {
  48224. this.deps[i].removeSub(this);
  48225. }
  48226. this.active = false;
  48227. }
  48228. };
  48229. /* */
  48230. var sharedPropertyDefinition = {
  48231. enumerable: true,
  48232. configurable: true,
  48233. get: noop,
  48234. set: noop
  48235. };
  48236. function proxy (target, sourceKey, key) {
  48237. sharedPropertyDefinition.get = function proxyGetter () {
  48238. return this[sourceKey][key]
  48239. };
  48240. sharedPropertyDefinition.set = function proxySetter (val) {
  48241. this[sourceKey][key] = val;
  48242. };
  48243. Object.defineProperty(target, key, sharedPropertyDefinition);
  48244. }
  48245. function initState (vm) {
  48246. vm._watchers = [];
  48247. var opts = vm.$options;
  48248. if (opts.props) { initProps(vm, opts.props); }
  48249. if (opts.methods) { initMethods(vm, opts.methods); }
  48250. if (opts.data) {
  48251. initData(vm);
  48252. } else {
  48253. observe(vm._data = {}, true /* asRootData */);
  48254. }
  48255. if (opts.computed) { initComputed(vm, opts.computed); }
  48256. if (opts.watch && opts.watch !== nativeWatch) {
  48257. initWatch(vm, opts.watch);
  48258. }
  48259. }
  48260. function initProps (vm, propsOptions) {
  48261. var propsData = vm.$options.propsData || {};
  48262. var props = vm._props = {};
  48263. // cache prop keys so that future props updates can iterate using Array
  48264. // instead of dynamic object key enumeration.
  48265. var keys = vm.$options._propKeys = [];
  48266. var isRoot = !vm.$parent;
  48267. // root instance props should be converted
  48268. if (!isRoot) {
  48269. toggleObserving(false);
  48270. }
  48271. var loop = function ( key ) {
  48272. keys.push(key);
  48273. var value = validateProp(key, propsOptions, propsData, vm);
  48274. /* istanbul ignore else */
  48275. {
  48276. var hyphenatedKey = hyphenate(key);
  48277. if (isReservedAttribute(hyphenatedKey) ||
  48278. config.isReservedAttr(hyphenatedKey)) {
  48279. warn(
  48280. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48281. vm
  48282. );
  48283. }
  48284. defineReactive$$1(props, key, value, function () {
  48285. if (!isRoot && !isUpdatingChildComponent) {
  48286. warn(
  48287. "Avoid mutating a prop directly since the value will be " +
  48288. "overwritten whenever the parent component re-renders. " +
  48289. "Instead, use a data or computed property based on the prop's " +
  48290. "value. Prop being mutated: \"" + key + "\"",
  48291. vm
  48292. );
  48293. }
  48294. });
  48295. }
  48296. // static props are already proxied on the component's prototype
  48297. // during Vue.extend(). We only need to proxy props defined at
  48298. // instantiation here.
  48299. if (!(key in vm)) {
  48300. proxy(vm, "_props", key);
  48301. }
  48302. };
  48303. for (var key in propsOptions) loop( key );
  48304. toggleObserving(true);
  48305. }
  48306. function initData (vm) {
  48307. var data = vm.$options.data;
  48308. data = vm._data = typeof data === 'function'
  48309. ? getData(data, vm)
  48310. : data || {};
  48311. if (!isPlainObject(data)) {
  48312. data = {};
  48313. warn(
  48314. 'data functions should return an object:\n' +
  48315. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48316. vm
  48317. );
  48318. }
  48319. // proxy data on instance
  48320. var keys = Object.keys(data);
  48321. var props = vm.$options.props;
  48322. var methods = vm.$options.methods;
  48323. var i = keys.length;
  48324. while (i--) {
  48325. var key = keys[i];
  48326. {
  48327. if (methods && hasOwn(methods, key)) {
  48328. warn(
  48329. ("Method \"" + key + "\" has already been defined as a data property."),
  48330. vm
  48331. );
  48332. }
  48333. }
  48334. if (props && hasOwn(props, key)) {
  48335. warn(
  48336. "The data property \"" + key + "\" is already declared as a prop. " +
  48337. "Use prop default value instead.",
  48338. vm
  48339. );
  48340. } else if (!isReserved(key)) {
  48341. proxy(vm, "_data", key);
  48342. }
  48343. }
  48344. // observe data
  48345. observe(data, true /* asRootData */);
  48346. }
  48347. function getData (data, vm) {
  48348. // #7573 disable dep collection when invoking data getters
  48349. pushTarget();
  48350. try {
  48351. return data.call(vm, vm)
  48352. } catch (e) {
  48353. handleError(e, vm, "data()");
  48354. return {}
  48355. } finally {
  48356. popTarget();
  48357. }
  48358. }
  48359. var computedWatcherOptions = { lazy: true };
  48360. function initComputed (vm, computed) {
  48361. // $flow-disable-line
  48362. var watchers = vm._computedWatchers = Object.create(null);
  48363. // computed properties are just getters during SSR
  48364. var isSSR = isServerRendering();
  48365. for (var key in computed) {
  48366. var userDef = computed[key];
  48367. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48368. if (getter == null) {
  48369. warn(
  48370. ("Getter is missing for computed property \"" + key + "\"."),
  48371. vm
  48372. );
  48373. }
  48374. if (!isSSR) {
  48375. // create internal watcher for the computed property.
  48376. watchers[key] = new Watcher(
  48377. vm,
  48378. getter || noop,
  48379. noop,
  48380. computedWatcherOptions
  48381. );
  48382. }
  48383. // component-defined computed properties are already defined on the
  48384. // component prototype. We only need to define computed properties defined
  48385. // at instantiation here.
  48386. if (!(key in vm)) {
  48387. defineComputed(vm, key, userDef);
  48388. } else {
  48389. if (key in vm.$data) {
  48390. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48391. } else if (vm.$options.props && key in vm.$options.props) {
  48392. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48393. }
  48394. }
  48395. }
  48396. }
  48397. function defineComputed (
  48398. target,
  48399. key,
  48400. userDef
  48401. ) {
  48402. var shouldCache = !isServerRendering();
  48403. if (typeof userDef === 'function') {
  48404. sharedPropertyDefinition.get = shouldCache
  48405. ? createComputedGetter(key)
  48406. : createGetterInvoker(userDef);
  48407. sharedPropertyDefinition.set = noop;
  48408. } else {
  48409. sharedPropertyDefinition.get = userDef.get
  48410. ? shouldCache && userDef.cache !== false
  48411. ? createComputedGetter(key)
  48412. : createGetterInvoker(userDef.get)
  48413. : noop;
  48414. sharedPropertyDefinition.set = userDef.set || noop;
  48415. }
  48416. if (sharedPropertyDefinition.set === noop) {
  48417. sharedPropertyDefinition.set = function () {
  48418. warn(
  48419. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48420. this
  48421. );
  48422. };
  48423. }
  48424. Object.defineProperty(target, key, sharedPropertyDefinition);
  48425. }
  48426. function createComputedGetter (key) {
  48427. return function computedGetter () {
  48428. var watcher = this._computedWatchers && this._computedWatchers[key];
  48429. if (watcher) {
  48430. if (watcher.dirty) {
  48431. watcher.evaluate();
  48432. }
  48433. if (Dep.target) {
  48434. watcher.depend();
  48435. }
  48436. return watcher.value
  48437. }
  48438. }
  48439. }
  48440. function createGetterInvoker(fn) {
  48441. return function computedGetter () {
  48442. return fn.call(this, this)
  48443. }
  48444. }
  48445. function initMethods (vm, methods) {
  48446. var props = vm.$options.props;
  48447. for (var key in methods) {
  48448. {
  48449. if (typeof methods[key] !== 'function') {
  48450. warn(
  48451. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48452. "Did you reference the function correctly?",
  48453. vm
  48454. );
  48455. }
  48456. if (props && hasOwn(props, key)) {
  48457. warn(
  48458. ("Method \"" + key + "\" has already been defined as a prop."),
  48459. vm
  48460. );
  48461. }
  48462. if ((key in vm) && isReserved(key)) {
  48463. warn(
  48464. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48465. "Avoid defining component methods that start with _ or $."
  48466. );
  48467. }
  48468. }
  48469. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48470. }
  48471. }
  48472. function initWatch (vm, watch) {
  48473. for (var key in watch) {
  48474. var handler = watch[key];
  48475. if (Array.isArray(handler)) {
  48476. for (var i = 0; i < handler.length; i++) {
  48477. createWatcher(vm, key, handler[i]);
  48478. }
  48479. } else {
  48480. createWatcher(vm, key, handler);
  48481. }
  48482. }
  48483. }
  48484. function createWatcher (
  48485. vm,
  48486. expOrFn,
  48487. handler,
  48488. options
  48489. ) {
  48490. if (isPlainObject(handler)) {
  48491. options = handler;
  48492. handler = handler.handler;
  48493. }
  48494. if (typeof handler === 'string') {
  48495. handler = vm[handler];
  48496. }
  48497. return vm.$watch(expOrFn, handler, options)
  48498. }
  48499. function stateMixin (Vue) {
  48500. // flow somehow has problems with directly declared definition object
  48501. // when using Object.defineProperty, so we have to procedurally build up
  48502. // the object here.
  48503. var dataDef = {};
  48504. dataDef.get = function () { return this._data };
  48505. var propsDef = {};
  48506. propsDef.get = function () { return this._props };
  48507. {
  48508. dataDef.set = function () {
  48509. warn(
  48510. 'Avoid replacing instance root $data. ' +
  48511. 'Use nested data properties instead.',
  48512. this
  48513. );
  48514. };
  48515. propsDef.set = function () {
  48516. warn("$props is readonly.", this);
  48517. };
  48518. }
  48519. Object.defineProperty(Vue.prototype, '$data', dataDef);
  48520. Object.defineProperty(Vue.prototype, '$props', propsDef);
  48521. Vue.prototype.$set = set;
  48522. Vue.prototype.$delete = del;
  48523. Vue.prototype.$watch = function (
  48524. expOrFn,
  48525. cb,
  48526. options
  48527. ) {
  48528. var vm = this;
  48529. if (isPlainObject(cb)) {
  48530. return createWatcher(vm, expOrFn, cb, options)
  48531. }
  48532. options = options || {};
  48533. options.user = true;
  48534. var watcher = new Watcher(vm, expOrFn, cb, options);
  48535. if (options.immediate) {
  48536. try {
  48537. cb.call(vm, watcher.value);
  48538. } catch (error) {
  48539. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  48540. }
  48541. }
  48542. return function unwatchFn () {
  48543. watcher.teardown();
  48544. }
  48545. };
  48546. }
  48547. /* */
  48548. var uid$3 = 0;
  48549. function initMixin (Vue) {
  48550. Vue.prototype._init = function (options) {
  48551. var vm = this;
  48552. // a uid
  48553. vm._uid = uid$3++;
  48554. var startTag, endTag;
  48555. /* istanbul ignore if */
  48556. if (config.performance && mark) {
  48557. startTag = "vue-perf-start:" + (vm._uid);
  48558. endTag = "vue-perf-end:" + (vm._uid);
  48559. mark(startTag);
  48560. }
  48561. // a flag to avoid this being observed
  48562. vm._isVue = true;
  48563. // merge options
  48564. if (options && options._isComponent) {
  48565. // optimize internal component instantiation
  48566. // since dynamic options merging is pretty slow, and none of the
  48567. // internal component options needs special treatment.
  48568. initInternalComponent(vm, options);
  48569. } else {
  48570. vm.$options = mergeOptions(
  48571. resolveConstructorOptions(vm.constructor),
  48572. options || {},
  48573. vm
  48574. );
  48575. }
  48576. /* istanbul ignore else */
  48577. {
  48578. initProxy(vm);
  48579. }
  48580. // expose real self
  48581. vm._self = vm;
  48582. initLifecycle(vm);
  48583. initEvents(vm);
  48584. initRender(vm);
  48585. callHook(vm, 'beforeCreate');
  48586. initInjections(vm); // resolve injections before data/props
  48587. initState(vm);
  48588. initProvide(vm); // resolve provide after data/props
  48589. callHook(vm, 'created');
  48590. /* istanbul ignore if */
  48591. if (config.performance && mark) {
  48592. vm._name = formatComponentName(vm, false);
  48593. mark(endTag);
  48594. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  48595. }
  48596. if (vm.$options.el) {
  48597. vm.$mount(vm.$options.el);
  48598. }
  48599. };
  48600. }
  48601. function initInternalComponent (vm, options) {
  48602. var opts = vm.$options = Object.create(vm.constructor.options);
  48603. // doing this because it's faster than dynamic enumeration.
  48604. var parentVnode = options._parentVnode;
  48605. opts.parent = options.parent;
  48606. opts._parentVnode = parentVnode;
  48607. var vnodeComponentOptions = parentVnode.componentOptions;
  48608. opts.propsData = vnodeComponentOptions.propsData;
  48609. opts._parentListeners = vnodeComponentOptions.listeners;
  48610. opts._renderChildren = vnodeComponentOptions.children;
  48611. opts._componentTag = vnodeComponentOptions.tag;
  48612. if (options.render) {
  48613. opts.render = options.render;
  48614. opts.staticRenderFns = options.staticRenderFns;
  48615. }
  48616. }
  48617. function resolveConstructorOptions (Ctor) {
  48618. var options = Ctor.options;
  48619. if (Ctor.super) {
  48620. var superOptions = resolveConstructorOptions(Ctor.super);
  48621. var cachedSuperOptions = Ctor.superOptions;
  48622. if (superOptions !== cachedSuperOptions) {
  48623. // super option changed,
  48624. // need to resolve new options.
  48625. Ctor.superOptions = superOptions;
  48626. // check if there are any late-modified/attached options (#4976)
  48627. var modifiedOptions = resolveModifiedOptions(Ctor);
  48628. // update base extend options
  48629. if (modifiedOptions) {
  48630. extend(Ctor.extendOptions, modifiedOptions);
  48631. }
  48632. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  48633. if (options.name) {
  48634. options.components[options.name] = Ctor;
  48635. }
  48636. }
  48637. }
  48638. return options
  48639. }
  48640. function resolveModifiedOptions (Ctor) {
  48641. var modified;
  48642. var latest = Ctor.options;
  48643. var sealed = Ctor.sealedOptions;
  48644. for (var key in latest) {
  48645. if (latest[key] !== sealed[key]) {
  48646. if (!modified) { modified = {}; }
  48647. modified[key] = latest[key];
  48648. }
  48649. }
  48650. return modified
  48651. }
  48652. function Vue (options) {
  48653. if (!(this instanceof Vue)
  48654. ) {
  48655. warn('Vue is a constructor and should be called with the `new` keyword');
  48656. }
  48657. this._init(options);
  48658. }
  48659. initMixin(Vue);
  48660. stateMixin(Vue);
  48661. eventsMixin(Vue);
  48662. lifecycleMixin(Vue);
  48663. renderMixin(Vue);
  48664. /* */
  48665. function initUse (Vue) {
  48666. Vue.use = function (plugin) {
  48667. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  48668. if (installedPlugins.indexOf(plugin) > -1) {
  48669. return this
  48670. }
  48671. // additional parameters
  48672. var args = toArray(arguments, 1);
  48673. args.unshift(this);
  48674. if (typeof plugin.install === 'function') {
  48675. plugin.install.apply(plugin, args);
  48676. } else if (typeof plugin === 'function') {
  48677. plugin.apply(null, args);
  48678. }
  48679. installedPlugins.push(plugin);
  48680. return this
  48681. };
  48682. }
  48683. /* */
  48684. function initMixin$1 (Vue) {
  48685. Vue.mixin = function (mixin) {
  48686. this.options = mergeOptions(this.options, mixin);
  48687. return this
  48688. };
  48689. }
  48690. /* */
  48691. function initExtend (Vue) {
  48692. /**
  48693. * Each instance constructor, including Vue, has a unique
  48694. * cid. This enables us to create wrapped "child
  48695. * constructors" for prototypal inheritance and cache them.
  48696. */
  48697. Vue.cid = 0;
  48698. var cid = 1;
  48699. /**
  48700. * Class inheritance
  48701. */
  48702. Vue.extend = function (extendOptions) {
  48703. extendOptions = extendOptions || {};
  48704. var Super = this;
  48705. var SuperId = Super.cid;
  48706. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  48707. if (cachedCtors[SuperId]) {
  48708. return cachedCtors[SuperId]
  48709. }
  48710. var name = extendOptions.name || Super.options.name;
  48711. if (name) {
  48712. validateComponentName(name);
  48713. }
  48714. var Sub = function VueComponent (options) {
  48715. this._init(options);
  48716. };
  48717. Sub.prototype = Object.create(Super.prototype);
  48718. Sub.prototype.constructor = Sub;
  48719. Sub.cid = cid++;
  48720. Sub.options = mergeOptions(
  48721. Super.options,
  48722. extendOptions
  48723. );
  48724. Sub['super'] = Super;
  48725. // For props and computed properties, we define the proxy getters on
  48726. // the Vue instances at extension time, on the extended prototype. This
  48727. // avoids Object.defineProperty calls for each instance created.
  48728. if (Sub.options.props) {
  48729. initProps$1(Sub);
  48730. }
  48731. if (Sub.options.computed) {
  48732. initComputed$1(Sub);
  48733. }
  48734. // allow further extension/mixin/plugin usage
  48735. Sub.extend = Super.extend;
  48736. Sub.mixin = Super.mixin;
  48737. Sub.use = Super.use;
  48738. // create asset registers, so extended classes
  48739. // can have their private assets too.
  48740. ASSET_TYPES.forEach(function (type) {
  48741. Sub[type] = Super[type];
  48742. });
  48743. // enable recursive self-lookup
  48744. if (name) {
  48745. Sub.options.components[name] = Sub;
  48746. }
  48747. // keep a reference to the super options at extension time.
  48748. // later at instantiation we can check if Super's options have
  48749. // been updated.
  48750. Sub.superOptions = Super.options;
  48751. Sub.extendOptions = extendOptions;
  48752. Sub.sealedOptions = extend({}, Sub.options);
  48753. // cache constructor
  48754. cachedCtors[SuperId] = Sub;
  48755. return Sub
  48756. };
  48757. }
  48758. function initProps$1 (Comp) {
  48759. var props = Comp.options.props;
  48760. for (var key in props) {
  48761. proxy(Comp.prototype, "_props", key);
  48762. }
  48763. }
  48764. function initComputed$1 (Comp) {
  48765. var computed = Comp.options.computed;
  48766. for (var key in computed) {
  48767. defineComputed(Comp.prototype, key, computed[key]);
  48768. }
  48769. }
  48770. /* */
  48771. function initAssetRegisters (Vue) {
  48772. /**
  48773. * Create asset registration methods.
  48774. */
  48775. ASSET_TYPES.forEach(function (type) {
  48776. Vue[type] = function (
  48777. id,
  48778. definition
  48779. ) {
  48780. if (!definition) {
  48781. return this.options[type + 's'][id]
  48782. } else {
  48783. /* istanbul ignore if */
  48784. if (type === 'component') {
  48785. validateComponentName(id);
  48786. }
  48787. if (type === 'component' && isPlainObject(definition)) {
  48788. definition.name = definition.name || id;
  48789. definition = this.options._base.extend(definition);
  48790. }
  48791. if (type === 'directive' && typeof definition === 'function') {
  48792. definition = { bind: definition, update: definition };
  48793. }
  48794. this.options[type + 's'][id] = definition;
  48795. return definition
  48796. }
  48797. };
  48798. });
  48799. }
  48800. /* */
  48801. function getComponentName (opts) {
  48802. return opts && (opts.Ctor.options.name || opts.tag)
  48803. }
  48804. function matches (pattern, name) {
  48805. if (Array.isArray(pattern)) {
  48806. return pattern.indexOf(name) > -1
  48807. } else if (typeof pattern === 'string') {
  48808. return pattern.split(',').indexOf(name) > -1
  48809. } else if (isRegExp(pattern)) {
  48810. return pattern.test(name)
  48811. }
  48812. /* istanbul ignore next */
  48813. return false
  48814. }
  48815. function pruneCache (keepAliveInstance, filter) {
  48816. var cache = keepAliveInstance.cache;
  48817. var keys = keepAliveInstance.keys;
  48818. var _vnode = keepAliveInstance._vnode;
  48819. for (var key in cache) {
  48820. var cachedNode = cache[key];
  48821. if (cachedNode) {
  48822. var name = getComponentName(cachedNode.componentOptions);
  48823. if (name && !filter(name)) {
  48824. pruneCacheEntry(cache, key, keys, _vnode);
  48825. }
  48826. }
  48827. }
  48828. }
  48829. function pruneCacheEntry (
  48830. cache,
  48831. key,
  48832. keys,
  48833. current
  48834. ) {
  48835. var cached$$1 = cache[key];
  48836. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  48837. cached$$1.componentInstance.$destroy();
  48838. }
  48839. cache[key] = null;
  48840. remove(keys, key);
  48841. }
  48842. var patternTypes = [String, RegExp, Array];
  48843. var KeepAlive = {
  48844. name: 'keep-alive',
  48845. abstract: true,
  48846. props: {
  48847. include: patternTypes,
  48848. exclude: patternTypes,
  48849. max: [String, Number]
  48850. },
  48851. created: function created () {
  48852. this.cache = Object.create(null);
  48853. this.keys = [];
  48854. },
  48855. destroyed: function destroyed () {
  48856. for (var key in this.cache) {
  48857. pruneCacheEntry(this.cache, key, this.keys);
  48858. }
  48859. },
  48860. mounted: function mounted () {
  48861. var this$1 = this;
  48862. this.$watch('include', function (val) {
  48863. pruneCache(this$1, function (name) { return matches(val, name); });
  48864. });
  48865. this.$watch('exclude', function (val) {
  48866. pruneCache(this$1, function (name) { return !matches(val, name); });
  48867. });
  48868. },
  48869. render: function render () {
  48870. var slot = this.$slots.default;
  48871. var vnode = getFirstComponentChild(slot);
  48872. var componentOptions = vnode && vnode.componentOptions;
  48873. if (componentOptions) {
  48874. // check pattern
  48875. var name = getComponentName(componentOptions);
  48876. var ref = this;
  48877. var include = ref.include;
  48878. var exclude = ref.exclude;
  48879. if (
  48880. // not included
  48881. (include && (!name || !matches(include, name))) ||
  48882. // excluded
  48883. (exclude && name && matches(exclude, name))
  48884. ) {
  48885. return vnode
  48886. }
  48887. var ref$1 = this;
  48888. var cache = ref$1.cache;
  48889. var keys = ref$1.keys;
  48890. var key = vnode.key == null
  48891. // same constructor may get registered as different local components
  48892. // so cid alone is not enough (#3269)
  48893. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  48894. : vnode.key;
  48895. if (cache[key]) {
  48896. vnode.componentInstance = cache[key].componentInstance;
  48897. // make current key freshest
  48898. remove(keys, key);
  48899. keys.push(key);
  48900. } else {
  48901. cache[key] = vnode;
  48902. keys.push(key);
  48903. // prune oldest entry
  48904. if (this.max && keys.length > parseInt(this.max)) {
  48905. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  48906. }
  48907. }
  48908. vnode.data.keepAlive = true;
  48909. }
  48910. return vnode || (slot && slot[0])
  48911. }
  48912. };
  48913. var builtInComponents = {
  48914. KeepAlive: KeepAlive
  48915. };
  48916. /* */
  48917. function initGlobalAPI (Vue) {
  48918. // config
  48919. var configDef = {};
  48920. configDef.get = function () { return config; };
  48921. {
  48922. configDef.set = function () {
  48923. warn(
  48924. 'Do not replace the Vue.config object, set individual fields instead.'
  48925. );
  48926. };
  48927. }
  48928. Object.defineProperty(Vue, 'config', configDef);
  48929. // exposed util methods.
  48930. // NOTE: these are not considered part of the public API - avoid relying on
  48931. // them unless you are aware of the risk.
  48932. Vue.util = {
  48933. warn: warn,
  48934. extend: extend,
  48935. mergeOptions: mergeOptions,
  48936. defineReactive: defineReactive$$1
  48937. };
  48938. Vue.set = set;
  48939. Vue.delete = del;
  48940. Vue.nextTick = nextTick;
  48941. // 2.6 explicit observable API
  48942. Vue.observable = function (obj) {
  48943. observe(obj);
  48944. return obj
  48945. };
  48946. Vue.options = Object.create(null);
  48947. ASSET_TYPES.forEach(function (type) {
  48948. Vue.options[type + 's'] = Object.create(null);
  48949. });
  48950. // this is used to identify the "base" constructor to extend all plain-object
  48951. // components with in Weex's multi-instance scenarios.
  48952. Vue.options._base = Vue;
  48953. extend(Vue.options.components, builtInComponents);
  48954. initUse(Vue);
  48955. initMixin$1(Vue);
  48956. initExtend(Vue);
  48957. initAssetRegisters(Vue);
  48958. }
  48959. initGlobalAPI(Vue);
  48960. Object.defineProperty(Vue.prototype, '$isServer', {
  48961. get: isServerRendering
  48962. });
  48963. Object.defineProperty(Vue.prototype, '$ssrContext', {
  48964. get: function get () {
  48965. /* istanbul ignore next */
  48966. return this.$vnode && this.$vnode.ssrContext
  48967. }
  48968. });
  48969. // expose FunctionalRenderContext for ssr runtime helper installation
  48970. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  48971. value: FunctionalRenderContext
  48972. });
  48973. Vue.version = '2.6.11';
  48974. /* */
  48975. // these are reserved for web because they are directly compiled away
  48976. // during template compilation
  48977. var isReservedAttr = makeMap('style,class');
  48978. // attributes that should be using props for binding
  48979. var acceptValue = makeMap('input,textarea,option,select,progress');
  48980. var mustUseProp = function (tag, type, attr) {
  48981. return (
  48982. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  48983. (attr === 'selected' && tag === 'option') ||
  48984. (attr === 'checked' && tag === 'input') ||
  48985. (attr === 'muted' && tag === 'video')
  48986. )
  48987. };
  48988. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  48989. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  48990. var convertEnumeratedValue = function (key, value) {
  48991. return isFalsyAttrValue(value) || value === 'false'
  48992. ? 'false'
  48993. // allow arbitrary string value for contenteditable
  48994. : key === 'contenteditable' && isValidContentEditableValue(value)
  48995. ? value
  48996. : 'true'
  48997. };
  48998. var isBooleanAttr = makeMap(
  48999. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49000. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49001. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49002. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49003. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49004. 'truespeed,typemustmatch,visible'
  49005. );
  49006. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49007. var isXlink = function (name) {
  49008. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49009. };
  49010. var getXlinkProp = function (name) {
  49011. return isXlink(name) ? name.slice(6, name.length) : ''
  49012. };
  49013. var isFalsyAttrValue = function (val) {
  49014. return val == null || val === false
  49015. };
  49016. /* */
  49017. function genClassForVnode (vnode) {
  49018. var data = vnode.data;
  49019. var parentNode = vnode;
  49020. var childNode = vnode;
  49021. while (isDef(childNode.componentInstance)) {
  49022. childNode = childNode.componentInstance._vnode;
  49023. if (childNode && childNode.data) {
  49024. data = mergeClassData(childNode.data, data);
  49025. }
  49026. }
  49027. while (isDef(parentNode = parentNode.parent)) {
  49028. if (parentNode && parentNode.data) {
  49029. data = mergeClassData(data, parentNode.data);
  49030. }
  49031. }
  49032. return renderClass(data.staticClass, data.class)
  49033. }
  49034. function mergeClassData (child, parent) {
  49035. return {
  49036. staticClass: concat(child.staticClass, parent.staticClass),
  49037. class: isDef(child.class)
  49038. ? [child.class, parent.class]
  49039. : parent.class
  49040. }
  49041. }
  49042. function renderClass (
  49043. staticClass,
  49044. dynamicClass
  49045. ) {
  49046. if (isDef(staticClass) || isDef(dynamicClass)) {
  49047. return concat(staticClass, stringifyClass(dynamicClass))
  49048. }
  49049. /* istanbul ignore next */
  49050. return ''
  49051. }
  49052. function concat (a, b) {
  49053. return a ? b ? (a + ' ' + b) : a : (b || '')
  49054. }
  49055. function stringifyClass (value) {
  49056. if (Array.isArray(value)) {
  49057. return stringifyArray(value)
  49058. }
  49059. if (isObject(value)) {
  49060. return stringifyObject(value)
  49061. }
  49062. if (typeof value === 'string') {
  49063. return value
  49064. }
  49065. /* istanbul ignore next */
  49066. return ''
  49067. }
  49068. function stringifyArray (value) {
  49069. var res = '';
  49070. var stringified;
  49071. for (var i = 0, l = value.length; i < l; i++) {
  49072. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49073. if (res) { res += ' '; }
  49074. res += stringified;
  49075. }
  49076. }
  49077. return res
  49078. }
  49079. function stringifyObject (value) {
  49080. var res = '';
  49081. for (var key in value) {
  49082. if (value[key]) {
  49083. if (res) { res += ' '; }
  49084. res += key;
  49085. }
  49086. }
  49087. return res
  49088. }
  49089. /* */
  49090. var namespaceMap = {
  49091. svg: 'http://www.w3.org/2000/svg',
  49092. math: 'http://www.w3.org/1998/Math/MathML'
  49093. };
  49094. var isHTMLTag = makeMap(
  49095. 'html,body,base,head,link,meta,style,title,' +
  49096. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49097. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49098. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49099. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49100. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49101. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49102. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49103. 'output,progress,select,textarea,' +
  49104. 'details,dialog,menu,menuitem,summary,' +
  49105. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49106. );
  49107. // this map is intentionally selective, only covering SVG elements that may
  49108. // contain child elements.
  49109. var isSVG = makeMap(
  49110. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49111. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49112. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49113. true
  49114. );
  49115. var isPreTag = function (tag) { return tag === 'pre'; };
  49116. var isReservedTag = function (tag) {
  49117. return isHTMLTag(tag) || isSVG(tag)
  49118. };
  49119. function getTagNamespace (tag) {
  49120. if (isSVG(tag)) {
  49121. return 'svg'
  49122. }
  49123. // basic support for MathML
  49124. // note it doesn't support other MathML elements being component roots
  49125. if (tag === 'math') {
  49126. return 'math'
  49127. }
  49128. }
  49129. var unknownElementCache = Object.create(null);
  49130. function isUnknownElement (tag) {
  49131. /* istanbul ignore if */
  49132. if (!inBrowser) {
  49133. return true
  49134. }
  49135. if (isReservedTag(tag)) {
  49136. return false
  49137. }
  49138. tag = tag.toLowerCase();
  49139. /* istanbul ignore if */
  49140. if (unknownElementCache[tag] != null) {
  49141. return unknownElementCache[tag]
  49142. }
  49143. var el = document.createElement(tag);
  49144. if (tag.indexOf('-') > -1) {
  49145. // http://stackoverflow.com/a/28210364/1070244
  49146. return (unknownElementCache[tag] = (
  49147. el.constructor === window.HTMLUnknownElement ||
  49148. el.constructor === window.HTMLElement
  49149. ))
  49150. } else {
  49151. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49152. }
  49153. }
  49154. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49155. /* */
  49156. /**
  49157. * Query an element selector if it's not an element already.
  49158. */
  49159. function query (el) {
  49160. if (typeof el === 'string') {
  49161. var selected = document.querySelector(el);
  49162. if (!selected) {
  49163. warn(
  49164. 'Cannot find element: ' + el
  49165. );
  49166. return document.createElement('div')
  49167. }
  49168. return selected
  49169. } else {
  49170. return el
  49171. }
  49172. }
  49173. /* */
  49174. function createElement$1 (tagName, vnode) {
  49175. var elm = document.createElement(tagName);
  49176. if (tagName !== 'select') {
  49177. return elm
  49178. }
  49179. // false or null will remove the attribute but undefined will not
  49180. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49181. elm.setAttribute('multiple', 'multiple');
  49182. }
  49183. return elm
  49184. }
  49185. function createElementNS (namespace, tagName) {
  49186. return document.createElementNS(namespaceMap[namespace], tagName)
  49187. }
  49188. function createTextNode (text) {
  49189. return document.createTextNode(text)
  49190. }
  49191. function createComment (text) {
  49192. return document.createComment(text)
  49193. }
  49194. function insertBefore (parentNode, newNode, referenceNode) {
  49195. parentNode.insertBefore(newNode, referenceNode);
  49196. }
  49197. function removeChild (node, child) {
  49198. node.removeChild(child);
  49199. }
  49200. function appendChild (node, child) {
  49201. node.appendChild(child);
  49202. }
  49203. function parentNode (node) {
  49204. return node.parentNode
  49205. }
  49206. function nextSibling (node) {
  49207. return node.nextSibling
  49208. }
  49209. function tagName (node) {
  49210. return node.tagName
  49211. }
  49212. function setTextContent (node, text) {
  49213. node.textContent = text;
  49214. }
  49215. function setStyleScope (node, scopeId) {
  49216. node.setAttribute(scopeId, '');
  49217. }
  49218. var nodeOps = /*#__PURE__*/Object.freeze({
  49219. createElement: createElement$1,
  49220. createElementNS: createElementNS,
  49221. createTextNode: createTextNode,
  49222. createComment: createComment,
  49223. insertBefore: insertBefore,
  49224. removeChild: removeChild,
  49225. appendChild: appendChild,
  49226. parentNode: parentNode,
  49227. nextSibling: nextSibling,
  49228. tagName: tagName,
  49229. setTextContent: setTextContent,
  49230. setStyleScope: setStyleScope
  49231. });
  49232. /* */
  49233. var ref = {
  49234. create: function create (_, vnode) {
  49235. registerRef(vnode);
  49236. },
  49237. update: function update (oldVnode, vnode) {
  49238. if (oldVnode.data.ref !== vnode.data.ref) {
  49239. registerRef(oldVnode, true);
  49240. registerRef(vnode);
  49241. }
  49242. },
  49243. destroy: function destroy (vnode) {
  49244. registerRef(vnode, true);
  49245. }
  49246. };
  49247. function registerRef (vnode, isRemoval) {
  49248. var key = vnode.data.ref;
  49249. if (!isDef(key)) { return }
  49250. var vm = vnode.context;
  49251. var ref = vnode.componentInstance || vnode.elm;
  49252. var refs = vm.$refs;
  49253. if (isRemoval) {
  49254. if (Array.isArray(refs[key])) {
  49255. remove(refs[key], ref);
  49256. } else if (refs[key] === ref) {
  49257. refs[key] = undefined;
  49258. }
  49259. } else {
  49260. if (vnode.data.refInFor) {
  49261. if (!Array.isArray(refs[key])) {
  49262. refs[key] = [ref];
  49263. } else if (refs[key].indexOf(ref) < 0) {
  49264. // $flow-disable-line
  49265. refs[key].push(ref);
  49266. }
  49267. } else {
  49268. refs[key] = ref;
  49269. }
  49270. }
  49271. }
  49272. /**
  49273. * Virtual DOM patching algorithm based on Snabbdom by
  49274. * Simon Friis Vindum (@paldepind)
  49275. * Licensed under the MIT License
  49276. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49277. *
  49278. * modified by Evan You (@yyx990803)
  49279. *
  49280. * Not type-checking this because this file is perf-critical and the cost
  49281. * of making flow understand it is not worth it.
  49282. */
  49283. var emptyNode = new VNode('', {}, []);
  49284. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49285. function sameVnode (a, b) {
  49286. return (
  49287. a.key === b.key && (
  49288. (
  49289. a.tag === b.tag &&
  49290. a.isComment === b.isComment &&
  49291. isDef(a.data) === isDef(b.data) &&
  49292. sameInputType(a, b)
  49293. ) || (
  49294. isTrue(a.isAsyncPlaceholder) &&
  49295. a.asyncFactory === b.asyncFactory &&
  49296. isUndef(b.asyncFactory.error)
  49297. )
  49298. )
  49299. )
  49300. }
  49301. function sameInputType (a, b) {
  49302. if (a.tag !== 'input') { return true }
  49303. var i;
  49304. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49305. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49306. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49307. }
  49308. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49309. var i, key;
  49310. var map = {};
  49311. for (i = beginIdx; i <= endIdx; ++i) {
  49312. key = children[i].key;
  49313. if (isDef(key)) { map[key] = i; }
  49314. }
  49315. return map
  49316. }
  49317. function createPatchFunction (backend) {
  49318. var i, j;
  49319. var cbs = {};
  49320. var modules = backend.modules;
  49321. var nodeOps = backend.nodeOps;
  49322. for (i = 0; i < hooks.length; ++i) {
  49323. cbs[hooks[i]] = [];
  49324. for (j = 0; j < modules.length; ++j) {
  49325. if (isDef(modules[j][hooks[i]])) {
  49326. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49327. }
  49328. }
  49329. }
  49330. function emptyNodeAt (elm) {
  49331. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49332. }
  49333. function createRmCb (childElm, listeners) {
  49334. function remove$$1 () {
  49335. if (--remove$$1.listeners === 0) {
  49336. removeNode(childElm);
  49337. }
  49338. }
  49339. remove$$1.listeners = listeners;
  49340. return remove$$1
  49341. }
  49342. function removeNode (el) {
  49343. var parent = nodeOps.parentNode(el);
  49344. // element may have already been removed due to v-html / v-text
  49345. if (isDef(parent)) {
  49346. nodeOps.removeChild(parent, el);
  49347. }
  49348. }
  49349. function isUnknownElement$$1 (vnode, inVPre) {
  49350. return (
  49351. !inVPre &&
  49352. !vnode.ns &&
  49353. !(
  49354. config.ignoredElements.length &&
  49355. config.ignoredElements.some(function (ignore) {
  49356. return isRegExp(ignore)
  49357. ? ignore.test(vnode.tag)
  49358. : ignore === vnode.tag
  49359. })
  49360. ) &&
  49361. config.isUnknownElement(vnode.tag)
  49362. )
  49363. }
  49364. var creatingElmInVPre = 0;
  49365. function createElm (
  49366. vnode,
  49367. insertedVnodeQueue,
  49368. parentElm,
  49369. refElm,
  49370. nested,
  49371. ownerArray,
  49372. index
  49373. ) {
  49374. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49375. // This vnode was used in a previous render!
  49376. // now it's used as a new node, overwriting its elm would cause
  49377. // potential patch errors down the road when it's used as an insertion
  49378. // reference node. Instead, we clone the node on-demand before creating
  49379. // associated DOM element for it.
  49380. vnode = ownerArray[index] = cloneVNode(vnode);
  49381. }
  49382. vnode.isRootInsert = !nested; // for transition enter check
  49383. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49384. return
  49385. }
  49386. var data = vnode.data;
  49387. var children = vnode.children;
  49388. var tag = vnode.tag;
  49389. if (isDef(tag)) {
  49390. {
  49391. if (data && data.pre) {
  49392. creatingElmInVPre++;
  49393. }
  49394. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49395. warn(
  49396. 'Unknown custom element: <' + tag + '> - did you ' +
  49397. 'register the component correctly? For recursive components, ' +
  49398. 'make sure to provide the "name" option.',
  49399. vnode.context
  49400. );
  49401. }
  49402. }
  49403. vnode.elm = vnode.ns
  49404. ? nodeOps.createElementNS(vnode.ns, tag)
  49405. : nodeOps.createElement(tag, vnode);
  49406. setScope(vnode);
  49407. /* istanbul ignore if */
  49408. {
  49409. createChildren(vnode, children, insertedVnodeQueue);
  49410. if (isDef(data)) {
  49411. invokeCreateHooks(vnode, insertedVnodeQueue);
  49412. }
  49413. insert(parentElm, vnode.elm, refElm);
  49414. }
  49415. if (data && data.pre) {
  49416. creatingElmInVPre--;
  49417. }
  49418. } else if (isTrue(vnode.isComment)) {
  49419. vnode.elm = nodeOps.createComment(vnode.text);
  49420. insert(parentElm, vnode.elm, refElm);
  49421. } else {
  49422. vnode.elm = nodeOps.createTextNode(vnode.text);
  49423. insert(parentElm, vnode.elm, refElm);
  49424. }
  49425. }
  49426. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49427. var i = vnode.data;
  49428. if (isDef(i)) {
  49429. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49430. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49431. i(vnode, false /* hydrating */);
  49432. }
  49433. // after calling the init hook, if the vnode is a child component
  49434. // it should've created a child instance and mounted it. the child
  49435. // component also has set the placeholder vnode's elm.
  49436. // in that case we can just return the element and be done.
  49437. if (isDef(vnode.componentInstance)) {
  49438. initComponent(vnode, insertedVnodeQueue);
  49439. insert(parentElm, vnode.elm, refElm);
  49440. if (isTrue(isReactivated)) {
  49441. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49442. }
  49443. return true
  49444. }
  49445. }
  49446. }
  49447. function initComponent (vnode, insertedVnodeQueue) {
  49448. if (isDef(vnode.data.pendingInsert)) {
  49449. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49450. vnode.data.pendingInsert = null;
  49451. }
  49452. vnode.elm = vnode.componentInstance.$el;
  49453. if (isPatchable(vnode)) {
  49454. invokeCreateHooks(vnode, insertedVnodeQueue);
  49455. setScope(vnode);
  49456. } else {
  49457. // empty component root.
  49458. // skip all element-related modules except for ref (#3455)
  49459. registerRef(vnode);
  49460. // make sure to invoke the insert hook
  49461. insertedVnodeQueue.push(vnode);
  49462. }
  49463. }
  49464. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49465. var i;
  49466. // hack for #4339: a reactivated component with inner transition
  49467. // does not trigger because the inner node's created hooks are not called
  49468. // again. It's not ideal to involve module-specific logic in here but
  49469. // there doesn't seem to be a better way to do it.
  49470. var innerNode = vnode;
  49471. while (innerNode.componentInstance) {
  49472. innerNode = innerNode.componentInstance._vnode;
  49473. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49474. for (i = 0; i < cbs.activate.length; ++i) {
  49475. cbs.activate[i](emptyNode, innerNode);
  49476. }
  49477. insertedVnodeQueue.push(innerNode);
  49478. break
  49479. }
  49480. }
  49481. // unlike a newly created component,
  49482. // a reactivated keep-alive component doesn't insert itself
  49483. insert(parentElm, vnode.elm, refElm);
  49484. }
  49485. function insert (parent, elm, ref$$1) {
  49486. if (isDef(parent)) {
  49487. if (isDef(ref$$1)) {
  49488. if (nodeOps.parentNode(ref$$1) === parent) {
  49489. nodeOps.insertBefore(parent, elm, ref$$1);
  49490. }
  49491. } else {
  49492. nodeOps.appendChild(parent, elm);
  49493. }
  49494. }
  49495. }
  49496. function createChildren (vnode, children, insertedVnodeQueue) {
  49497. if (Array.isArray(children)) {
  49498. {
  49499. checkDuplicateKeys(children);
  49500. }
  49501. for (var i = 0; i < children.length; ++i) {
  49502. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49503. }
  49504. } else if (isPrimitive(vnode.text)) {
  49505. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49506. }
  49507. }
  49508. function isPatchable (vnode) {
  49509. while (vnode.componentInstance) {
  49510. vnode = vnode.componentInstance._vnode;
  49511. }
  49512. return isDef(vnode.tag)
  49513. }
  49514. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  49515. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49516. cbs.create[i$1](emptyNode, vnode);
  49517. }
  49518. i = vnode.data.hook; // Reuse variable
  49519. if (isDef(i)) {
  49520. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  49521. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  49522. }
  49523. }
  49524. // set scope id attribute for scoped CSS.
  49525. // this is implemented as a special case to avoid the overhead
  49526. // of going through the normal attribute patching process.
  49527. function setScope (vnode) {
  49528. var i;
  49529. if (isDef(i = vnode.fnScopeId)) {
  49530. nodeOps.setStyleScope(vnode.elm, i);
  49531. } else {
  49532. var ancestor = vnode;
  49533. while (ancestor) {
  49534. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  49535. nodeOps.setStyleScope(vnode.elm, i);
  49536. }
  49537. ancestor = ancestor.parent;
  49538. }
  49539. }
  49540. // for slot content they should also get the scopeId from the host instance.
  49541. if (isDef(i = activeInstance) &&
  49542. i !== vnode.context &&
  49543. i !== vnode.fnContext &&
  49544. isDef(i = i.$options._scopeId)
  49545. ) {
  49546. nodeOps.setStyleScope(vnode.elm, i);
  49547. }
  49548. }
  49549. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  49550. for (; startIdx <= endIdx; ++startIdx) {
  49551. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  49552. }
  49553. }
  49554. function invokeDestroyHook (vnode) {
  49555. var i, j;
  49556. var data = vnode.data;
  49557. if (isDef(data)) {
  49558. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  49559. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  49560. }
  49561. if (isDef(i = vnode.children)) {
  49562. for (j = 0; j < vnode.children.length; ++j) {
  49563. invokeDestroyHook(vnode.children[j]);
  49564. }
  49565. }
  49566. }
  49567. function removeVnodes (vnodes, startIdx, endIdx) {
  49568. for (; startIdx <= endIdx; ++startIdx) {
  49569. var ch = vnodes[startIdx];
  49570. if (isDef(ch)) {
  49571. if (isDef(ch.tag)) {
  49572. removeAndInvokeRemoveHook(ch);
  49573. invokeDestroyHook(ch);
  49574. } else { // Text node
  49575. removeNode(ch.elm);
  49576. }
  49577. }
  49578. }
  49579. }
  49580. function removeAndInvokeRemoveHook (vnode, rm) {
  49581. if (isDef(rm) || isDef(vnode.data)) {
  49582. var i;
  49583. var listeners = cbs.remove.length + 1;
  49584. if (isDef(rm)) {
  49585. // we have a recursively passed down rm callback
  49586. // increase the listeners count
  49587. rm.listeners += listeners;
  49588. } else {
  49589. // directly removing
  49590. rm = createRmCb(vnode.elm, listeners);
  49591. }
  49592. // recursively invoke hooks on child component root node
  49593. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  49594. removeAndInvokeRemoveHook(i, rm);
  49595. }
  49596. for (i = 0; i < cbs.remove.length; ++i) {
  49597. cbs.remove[i](vnode, rm);
  49598. }
  49599. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  49600. i(vnode, rm);
  49601. } else {
  49602. rm();
  49603. }
  49604. } else {
  49605. removeNode(vnode.elm);
  49606. }
  49607. }
  49608. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  49609. var oldStartIdx = 0;
  49610. var newStartIdx = 0;
  49611. var oldEndIdx = oldCh.length - 1;
  49612. var oldStartVnode = oldCh[0];
  49613. var oldEndVnode = oldCh[oldEndIdx];
  49614. var newEndIdx = newCh.length - 1;
  49615. var newStartVnode = newCh[0];
  49616. var newEndVnode = newCh[newEndIdx];
  49617. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  49618. // removeOnly is a special flag used only by <transition-group>
  49619. // to ensure removed elements stay in correct relative positions
  49620. // during leaving transitions
  49621. var canMove = !removeOnly;
  49622. {
  49623. checkDuplicateKeys(newCh);
  49624. }
  49625. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  49626. if (isUndef(oldStartVnode)) {
  49627. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  49628. } else if (isUndef(oldEndVnode)) {
  49629. oldEndVnode = oldCh[--oldEndIdx];
  49630. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  49631. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49632. oldStartVnode = oldCh[++oldStartIdx];
  49633. newStartVnode = newCh[++newStartIdx];
  49634. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  49635. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49636. oldEndVnode = oldCh[--oldEndIdx];
  49637. newEndVnode = newCh[--newEndIdx];
  49638. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  49639. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49640. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  49641. oldStartVnode = oldCh[++oldStartIdx];
  49642. newEndVnode = newCh[--newEndIdx];
  49643. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  49644. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49645. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  49646. oldEndVnode = oldCh[--oldEndIdx];
  49647. newStartVnode = newCh[++newStartIdx];
  49648. } else {
  49649. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  49650. idxInOld = isDef(newStartVnode.key)
  49651. ? oldKeyToIdx[newStartVnode.key]
  49652. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  49653. if (isUndef(idxInOld)) { // New element
  49654. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49655. } else {
  49656. vnodeToMove = oldCh[idxInOld];
  49657. if (sameVnode(vnodeToMove, newStartVnode)) {
  49658. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49659. oldCh[idxInOld] = undefined;
  49660. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  49661. } else {
  49662. // same key but different element. treat as new element
  49663. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49664. }
  49665. }
  49666. newStartVnode = newCh[++newStartIdx];
  49667. }
  49668. }
  49669. if (oldStartIdx > oldEndIdx) {
  49670. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  49671. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  49672. } else if (newStartIdx > newEndIdx) {
  49673. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  49674. }
  49675. }
  49676. function checkDuplicateKeys (children) {
  49677. var seenKeys = {};
  49678. for (var i = 0; i < children.length; i++) {
  49679. var vnode = children[i];
  49680. var key = vnode.key;
  49681. if (isDef(key)) {
  49682. if (seenKeys[key]) {
  49683. warn(
  49684. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  49685. vnode.context
  49686. );
  49687. } else {
  49688. seenKeys[key] = true;
  49689. }
  49690. }
  49691. }
  49692. }
  49693. function findIdxInOld (node, oldCh, start, end) {
  49694. for (var i = start; i < end; i++) {
  49695. var c = oldCh[i];
  49696. if (isDef(c) && sameVnode(node, c)) { return i }
  49697. }
  49698. }
  49699. function patchVnode (
  49700. oldVnode,
  49701. vnode,
  49702. insertedVnodeQueue,
  49703. ownerArray,
  49704. index,
  49705. removeOnly
  49706. ) {
  49707. if (oldVnode === vnode) {
  49708. return
  49709. }
  49710. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49711. // clone reused vnode
  49712. vnode = ownerArray[index] = cloneVNode(vnode);
  49713. }
  49714. var elm = vnode.elm = oldVnode.elm;
  49715. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  49716. if (isDef(vnode.asyncFactory.resolved)) {
  49717. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  49718. } else {
  49719. vnode.isAsyncPlaceholder = true;
  49720. }
  49721. return
  49722. }
  49723. // reuse element for static trees.
  49724. // note we only do this if the vnode is cloned -
  49725. // if the new node is not cloned it means the render functions have been
  49726. // reset by the hot-reload-api and we need to do a proper re-render.
  49727. if (isTrue(vnode.isStatic) &&
  49728. isTrue(oldVnode.isStatic) &&
  49729. vnode.key === oldVnode.key &&
  49730. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  49731. ) {
  49732. vnode.componentInstance = oldVnode.componentInstance;
  49733. return
  49734. }
  49735. var i;
  49736. var data = vnode.data;
  49737. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  49738. i(oldVnode, vnode);
  49739. }
  49740. var oldCh = oldVnode.children;
  49741. var ch = vnode.children;
  49742. if (isDef(data) && isPatchable(vnode)) {
  49743. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  49744. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  49745. }
  49746. if (isUndef(vnode.text)) {
  49747. if (isDef(oldCh) && isDef(ch)) {
  49748. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  49749. } else if (isDef(ch)) {
  49750. {
  49751. checkDuplicateKeys(ch);
  49752. }
  49753. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  49754. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  49755. } else if (isDef(oldCh)) {
  49756. removeVnodes(oldCh, 0, oldCh.length - 1);
  49757. } else if (isDef(oldVnode.text)) {
  49758. nodeOps.setTextContent(elm, '');
  49759. }
  49760. } else if (oldVnode.text !== vnode.text) {
  49761. nodeOps.setTextContent(elm, vnode.text);
  49762. }
  49763. if (isDef(data)) {
  49764. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  49765. }
  49766. }
  49767. function invokeInsertHook (vnode, queue, initial) {
  49768. // delay insert hooks for component root nodes, invoke them after the
  49769. // element is really inserted
  49770. if (isTrue(initial) && isDef(vnode.parent)) {
  49771. vnode.parent.data.pendingInsert = queue;
  49772. } else {
  49773. for (var i = 0; i < queue.length; ++i) {
  49774. queue[i].data.hook.insert(queue[i]);
  49775. }
  49776. }
  49777. }
  49778. var hydrationBailed = false;
  49779. // list of modules that can skip create hook during hydration because they
  49780. // are already rendered on the client or has no need for initialization
  49781. // Note: style is excluded because it relies on initial clone for future
  49782. // deep updates (#7063).
  49783. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  49784. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  49785. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  49786. var i;
  49787. var tag = vnode.tag;
  49788. var data = vnode.data;
  49789. var children = vnode.children;
  49790. inVPre = inVPre || (data && data.pre);
  49791. vnode.elm = elm;
  49792. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  49793. vnode.isAsyncPlaceholder = true;
  49794. return true
  49795. }
  49796. // assert node match
  49797. {
  49798. if (!assertNodeMatch(elm, vnode, inVPre)) {
  49799. return false
  49800. }
  49801. }
  49802. if (isDef(data)) {
  49803. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  49804. if (isDef(i = vnode.componentInstance)) {
  49805. // child component. it should have hydrated its own tree.
  49806. initComponent(vnode, insertedVnodeQueue);
  49807. return true
  49808. }
  49809. }
  49810. if (isDef(tag)) {
  49811. if (isDef(children)) {
  49812. // empty element, allow client to pick up and populate children
  49813. if (!elm.hasChildNodes()) {
  49814. createChildren(vnode, children, insertedVnodeQueue);
  49815. } else {
  49816. // v-html and domProps: innerHTML
  49817. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  49818. if (i !== elm.innerHTML) {
  49819. /* istanbul ignore if */
  49820. if (typeof console !== 'undefined' &&
  49821. !hydrationBailed
  49822. ) {
  49823. hydrationBailed = true;
  49824. console.warn('Parent: ', elm);
  49825. console.warn('server innerHTML: ', i);
  49826. console.warn('client innerHTML: ', elm.innerHTML);
  49827. }
  49828. return false
  49829. }
  49830. } else {
  49831. // iterate and compare children lists
  49832. var childrenMatch = true;
  49833. var childNode = elm.firstChild;
  49834. for (var i$1 = 0; i$1 < children.length; i$1++) {
  49835. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  49836. childrenMatch = false;
  49837. break
  49838. }
  49839. childNode = childNode.nextSibling;
  49840. }
  49841. // if childNode is not null, it means the actual childNodes list is
  49842. // longer than the virtual children list.
  49843. if (!childrenMatch || childNode) {
  49844. /* istanbul ignore if */
  49845. if (typeof console !== 'undefined' &&
  49846. !hydrationBailed
  49847. ) {
  49848. hydrationBailed = true;
  49849. console.warn('Parent: ', elm);
  49850. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  49851. }
  49852. return false
  49853. }
  49854. }
  49855. }
  49856. }
  49857. if (isDef(data)) {
  49858. var fullInvoke = false;
  49859. for (var key in data) {
  49860. if (!isRenderedModule(key)) {
  49861. fullInvoke = true;
  49862. invokeCreateHooks(vnode, insertedVnodeQueue);
  49863. break
  49864. }
  49865. }
  49866. if (!fullInvoke && data['class']) {
  49867. // ensure collecting deps for deep class bindings for future updates
  49868. traverse(data['class']);
  49869. }
  49870. }
  49871. } else if (elm.data !== vnode.text) {
  49872. elm.data = vnode.text;
  49873. }
  49874. return true
  49875. }
  49876. function assertNodeMatch (node, vnode, inVPre) {
  49877. if (isDef(vnode.tag)) {
  49878. return vnode.tag.indexOf('vue-component') === 0 || (
  49879. !isUnknownElement$$1(vnode, inVPre) &&
  49880. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  49881. )
  49882. } else {
  49883. return node.nodeType === (vnode.isComment ? 8 : 3)
  49884. }
  49885. }
  49886. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  49887. if (isUndef(vnode)) {
  49888. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  49889. return
  49890. }
  49891. var isInitialPatch = false;
  49892. var insertedVnodeQueue = [];
  49893. if (isUndef(oldVnode)) {
  49894. // empty mount (likely as component), create new root element
  49895. isInitialPatch = true;
  49896. createElm(vnode, insertedVnodeQueue);
  49897. } else {
  49898. var isRealElement = isDef(oldVnode.nodeType);
  49899. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  49900. // patch existing root node
  49901. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  49902. } else {
  49903. if (isRealElement) {
  49904. // mounting to a real element
  49905. // check if this is server-rendered content and if we can perform
  49906. // a successful hydration.
  49907. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  49908. oldVnode.removeAttribute(SSR_ATTR);
  49909. hydrating = true;
  49910. }
  49911. if (isTrue(hydrating)) {
  49912. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  49913. invokeInsertHook(vnode, insertedVnodeQueue, true);
  49914. return oldVnode
  49915. } else {
  49916. warn(
  49917. 'The client-side rendered virtual DOM tree is not matching ' +
  49918. 'server-rendered content. This is likely caused by incorrect ' +
  49919. 'HTML markup, for example nesting block-level elements inside ' +
  49920. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  49921. 'full client-side render.'
  49922. );
  49923. }
  49924. }
  49925. // either not server-rendered, or hydration failed.
  49926. // create an empty node and replace it
  49927. oldVnode = emptyNodeAt(oldVnode);
  49928. }
  49929. // replacing existing element
  49930. var oldElm = oldVnode.elm;
  49931. var parentElm = nodeOps.parentNode(oldElm);
  49932. // create new node
  49933. createElm(
  49934. vnode,
  49935. insertedVnodeQueue,
  49936. // extremely rare edge case: do not insert if old element is in a
  49937. // leaving transition. Only happens when combining transition +
  49938. // keep-alive + HOCs. (#4590)
  49939. oldElm._leaveCb ? null : parentElm,
  49940. nodeOps.nextSibling(oldElm)
  49941. );
  49942. // update parent placeholder node element, recursively
  49943. if (isDef(vnode.parent)) {
  49944. var ancestor = vnode.parent;
  49945. var patchable = isPatchable(vnode);
  49946. while (ancestor) {
  49947. for (var i = 0; i < cbs.destroy.length; ++i) {
  49948. cbs.destroy[i](ancestor);
  49949. }
  49950. ancestor.elm = vnode.elm;
  49951. if (patchable) {
  49952. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49953. cbs.create[i$1](emptyNode, ancestor);
  49954. }
  49955. // #6513
  49956. // invoke insert hooks that may have been merged by create hooks.
  49957. // e.g. for directives that uses the "inserted" hook.
  49958. var insert = ancestor.data.hook.insert;
  49959. if (insert.merged) {
  49960. // start at index 1 to avoid re-invoking component mounted hook
  49961. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  49962. insert.fns[i$2]();
  49963. }
  49964. }
  49965. } else {
  49966. registerRef(ancestor);
  49967. }
  49968. ancestor = ancestor.parent;
  49969. }
  49970. }
  49971. // destroy old node
  49972. if (isDef(parentElm)) {
  49973. removeVnodes([oldVnode], 0, 0);
  49974. } else if (isDef(oldVnode.tag)) {
  49975. invokeDestroyHook(oldVnode);
  49976. }
  49977. }
  49978. }
  49979. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  49980. return vnode.elm
  49981. }
  49982. }
  49983. /* */
  49984. var directives = {
  49985. create: updateDirectives,
  49986. update: updateDirectives,
  49987. destroy: function unbindDirectives (vnode) {
  49988. updateDirectives(vnode, emptyNode);
  49989. }
  49990. };
  49991. function updateDirectives (oldVnode, vnode) {
  49992. if (oldVnode.data.directives || vnode.data.directives) {
  49993. _update(oldVnode, vnode);
  49994. }
  49995. }
  49996. function _update (oldVnode, vnode) {
  49997. var isCreate = oldVnode === emptyNode;
  49998. var isDestroy = vnode === emptyNode;
  49999. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50000. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50001. var dirsWithInsert = [];
  50002. var dirsWithPostpatch = [];
  50003. var key, oldDir, dir;
  50004. for (key in newDirs) {
  50005. oldDir = oldDirs[key];
  50006. dir = newDirs[key];
  50007. if (!oldDir) {
  50008. // new directive, bind
  50009. callHook$1(dir, 'bind', vnode, oldVnode);
  50010. if (dir.def && dir.def.inserted) {
  50011. dirsWithInsert.push(dir);
  50012. }
  50013. } else {
  50014. // existing directive, update
  50015. dir.oldValue = oldDir.value;
  50016. dir.oldArg = oldDir.arg;
  50017. callHook$1(dir, 'update', vnode, oldVnode);
  50018. if (dir.def && dir.def.componentUpdated) {
  50019. dirsWithPostpatch.push(dir);
  50020. }
  50021. }
  50022. }
  50023. if (dirsWithInsert.length) {
  50024. var callInsert = function () {
  50025. for (var i = 0; i < dirsWithInsert.length; i++) {
  50026. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50027. }
  50028. };
  50029. if (isCreate) {
  50030. mergeVNodeHook(vnode, 'insert', callInsert);
  50031. } else {
  50032. callInsert();
  50033. }
  50034. }
  50035. if (dirsWithPostpatch.length) {
  50036. mergeVNodeHook(vnode, 'postpatch', function () {
  50037. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50038. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50039. }
  50040. });
  50041. }
  50042. if (!isCreate) {
  50043. for (key in oldDirs) {
  50044. if (!newDirs[key]) {
  50045. // no longer present, unbind
  50046. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50047. }
  50048. }
  50049. }
  50050. }
  50051. var emptyModifiers = Object.create(null);
  50052. function normalizeDirectives$1 (
  50053. dirs,
  50054. vm
  50055. ) {
  50056. var res = Object.create(null);
  50057. if (!dirs) {
  50058. // $flow-disable-line
  50059. return res
  50060. }
  50061. var i, dir;
  50062. for (i = 0; i < dirs.length; i++) {
  50063. dir = dirs[i];
  50064. if (!dir.modifiers) {
  50065. // $flow-disable-line
  50066. dir.modifiers = emptyModifiers;
  50067. }
  50068. res[getRawDirName(dir)] = dir;
  50069. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50070. }
  50071. // $flow-disable-line
  50072. return res
  50073. }
  50074. function getRawDirName (dir) {
  50075. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50076. }
  50077. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50078. var fn = dir.def && dir.def[hook];
  50079. if (fn) {
  50080. try {
  50081. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50082. } catch (e) {
  50083. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50084. }
  50085. }
  50086. }
  50087. var baseModules = [
  50088. ref,
  50089. directives
  50090. ];
  50091. /* */
  50092. function updateAttrs (oldVnode, vnode) {
  50093. var opts = vnode.componentOptions;
  50094. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50095. return
  50096. }
  50097. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50098. return
  50099. }
  50100. var key, cur, old;
  50101. var elm = vnode.elm;
  50102. var oldAttrs = oldVnode.data.attrs || {};
  50103. var attrs = vnode.data.attrs || {};
  50104. // clone observed objects, as the user probably wants to mutate it
  50105. if (isDef(attrs.__ob__)) {
  50106. attrs = vnode.data.attrs = extend({}, attrs);
  50107. }
  50108. for (key in attrs) {
  50109. cur = attrs[key];
  50110. old = oldAttrs[key];
  50111. if (old !== cur) {
  50112. setAttr(elm, key, cur);
  50113. }
  50114. }
  50115. // #4391: in IE9, setting type can reset value for input[type=radio]
  50116. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50117. /* istanbul ignore if */
  50118. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50119. setAttr(elm, 'value', attrs.value);
  50120. }
  50121. for (key in oldAttrs) {
  50122. if (isUndef(attrs[key])) {
  50123. if (isXlink(key)) {
  50124. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50125. } else if (!isEnumeratedAttr(key)) {
  50126. elm.removeAttribute(key);
  50127. }
  50128. }
  50129. }
  50130. }
  50131. function setAttr (el, key, value) {
  50132. if (el.tagName.indexOf('-') > -1) {
  50133. baseSetAttr(el, key, value);
  50134. } else if (isBooleanAttr(key)) {
  50135. // set attribute for blank value
  50136. // e.g. <option disabled>Select one</option>
  50137. if (isFalsyAttrValue(value)) {
  50138. el.removeAttribute(key);
  50139. } else {
  50140. // technically allowfullscreen is a boolean attribute for <iframe>,
  50141. // but Flash expects a value of "true" when used on <embed> tag
  50142. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50143. ? 'true'
  50144. : key;
  50145. el.setAttribute(key, value);
  50146. }
  50147. } else if (isEnumeratedAttr(key)) {
  50148. el.setAttribute(key, convertEnumeratedValue(key, value));
  50149. } else if (isXlink(key)) {
  50150. if (isFalsyAttrValue(value)) {
  50151. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50152. } else {
  50153. el.setAttributeNS(xlinkNS, key, value);
  50154. }
  50155. } else {
  50156. baseSetAttr(el, key, value);
  50157. }
  50158. }
  50159. function baseSetAttr (el, key, value) {
  50160. if (isFalsyAttrValue(value)) {
  50161. el.removeAttribute(key);
  50162. } else {
  50163. // #7138: IE10 & 11 fires input event when setting placeholder on
  50164. // <textarea>... block the first input event and remove the blocker
  50165. // immediately.
  50166. /* istanbul ignore if */
  50167. if (
  50168. isIE && !isIE9 &&
  50169. el.tagName === 'TEXTAREA' &&
  50170. key === 'placeholder' && value !== '' && !el.__ieph
  50171. ) {
  50172. var blocker = function (e) {
  50173. e.stopImmediatePropagation();
  50174. el.removeEventListener('input', blocker);
  50175. };
  50176. el.addEventListener('input', blocker);
  50177. // $flow-disable-line
  50178. el.__ieph = true; /* IE placeholder patched */
  50179. }
  50180. el.setAttribute(key, value);
  50181. }
  50182. }
  50183. var attrs = {
  50184. create: updateAttrs,
  50185. update: updateAttrs
  50186. };
  50187. /* */
  50188. function updateClass (oldVnode, vnode) {
  50189. var el = vnode.elm;
  50190. var data = vnode.data;
  50191. var oldData = oldVnode.data;
  50192. if (
  50193. isUndef(data.staticClass) &&
  50194. isUndef(data.class) && (
  50195. isUndef(oldData) || (
  50196. isUndef(oldData.staticClass) &&
  50197. isUndef(oldData.class)
  50198. )
  50199. )
  50200. ) {
  50201. return
  50202. }
  50203. var cls = genClassForVnode(vnode);
  50204. // handle transition classes
  50205. var transitionClass = el._transitionClasses;
  50206. if (isDef(transitionClass)) {
  50207. cls = concat(cls, stringifyClass(transitionClass));
  50208. }
  50209. // set the class
  50210. if (cls !== el._prevClass) {
  50211. el.setAttribute('class', cls);
  50212. el._prevClass = cls;
  50213. }
  50214. }
  50215. var klass = {
  50216. create: updateClass,
  50217. update: updateClass
  50218. };
  50219. /* */
  50220. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50221. function parseFilters (exp) {
  50222. var inSingle = false;
  50223. var inDouble = false;
  50224. var inTemplateString = false;
  50225. var inRegex = false;
  50226. var curly = 0;
  50227. var square = 0;
  50228. var paren = 0;
  50229. var lastFilterIndex = 0;
  50230. var c, prev, i, expression, filters;
  50231. for (i = 0; i < exp.length; i++) {
  50232. prev = c;
  50233. c = exp.charCodeAt(i);
  50234. if (inSingle) {
  50235. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50236. } else if (inDouble) {
  50237. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50238. } else if (inTemplateString) {
  50239. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50240. } else if (inRegex) {
  50241. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50242. } else if (
  50243. c === 0x7C && // pipe
  50244. exp.charCodeAt(i + 1) !== 0x7C &&
  50245. exp.charCodeAt(i - 1) !== 0x7C &&
  50246. !curly && !square && !paren
  50247. ) {
  50248. if (expression === undefined) {
  50249. // first filter, end of expression
  50250. lastFilterIndex = i + 1;
  50251. expression = exp.slice(0, i).trim();
  50252. } else {
  50253. pushFilter();
  50254. }
  50255. } else {
  50256. switch (c) {
  50257. case 0x22: inDouble = true; break // "
  50258. case 0x27: inSingle = true; break // '
  50259. case 0x60: inTemplateString = true; break // `
  50260. case 0x28: paren++; break // (
  50261. case 0x29: paren--; break // )
  50262. case 0x5B: square++; break // [
  50263. case 0x5D: square--; break // ]
  50264. case 0x7B: curly++; break // {
  50265. case 0x7D: curly--; break // }
  50266. }
  50267. if (c === 0x2f) { // /
  50268. var j = i - 1;
  50269. var p = (void 0);
  50270. // find first non-whitespace prev char
  50271. for (; j >= 0; j--) {
  50272. p = exp.charAt(j);
  50273. if (p !== ' ') { break }
  50274. }
  50275. if (!p || !validDivisionCharRE.test(p)) {
  50276. inRegex = true;
  50277. }
  50278. }
  50279. }
  50280. }
  50281. if (expression === undefined) {
  50282. expression = exp.slice(0, i).trim();
  50283. } else if (lastFilterIndex !== 0) {
  50284. pushFilter();
  50285. }
  50286. function pushFilter () {
  50287. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50288. lastFilterIndex = i + 1;
  50289. }
  50290. if (filters) {
  50291. for (i = 0; i < filters.length; i++) {
  50292. expression = wrapFilter(expression, filters[i]);
  50293. }
  50294. }
  50295. return expression
  50296. }
  50297. function wrapFilter (exp, filter) {
  50298. var i = filter.indexOf('(');
  50299. if (i < 0) {
  50300. // _f: resolveFilter
  50301. return ("_f(\"" + filter + "\")(" + exp + ")")
  50302. } else {
  50303. var name = filter.slice(0, i);
  50304. var args = filter.slice(i + 1);
  50305. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50306. }
  50307. }
  50308. /* */
  50309. /* eslint-disable no-unused-vars */
  50310. function baseWarn (msg, range) {
  50311. console.error(("[Vue compiler]: " + msg));
  50312. }
  50313. /* eslint-enable no-unused-vars */
  50314. function pluckModuleFunction (
  50315. modules,
  50316. key
  50317. ) {
  50318. return modules
  50319. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50320. : []
  50321. }
  50322. function addProp (el, name, value, range, dynamic) {
  50323. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50324. el.plain = false;
  50325. }
  50326. function addAttr (el, name, value, range, dynamic) {
  50327. var attrs = dynamic
  50328. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50329. : (el.attrs || (el.attrs = []));
  50330. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50331. el.plain = false;
  50332. }
  50333. // add a raw attr (use this in preTransforms)
  50334. function addRawAttr (el, name, value, range) {
  50335. el.attrsMap[name] = value;
  50336. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50337. }
  50338. function addDirective (
  50339. el,
  50340. name,
  50341. rawName,
  50342. value,
  50343. arg,
  50344. isDynamicArg,
  50345. modifiers,
  50346. range
  50347. ) {
  50348. (el.directives || (el.directives = [])).push(rangeSetItem({
  50349. name: name,
  50350. rawName: rawName,
  50351. value: value,
  50352. arg: arg,
  50353. isDynamicArg: isDynamicArg,
  50354. modifiers: modifiers
  50355. }, range));
  50356. el.plain = false;
  50357. }
  50358. function prependModifierMarker (symbol, name, dynamic) {
  50359. return dynamic
  50360. ? ("_p(" + name + ",\"" + symbol + "\")")
  50361. : symbol + name // mark the event as captured
  50362. }
  50363. function addHandler (
  50364. el,
  50365. name,
  50366. value,
  50367. modifiers,
  50368. important,
  50369. warn,
  50370. range,
  50371. dynamic
  50372. ) {
  50373. modifiers = modifiers || emptyObject;
  50374. // warn prevent and passive modifier
  50375. /* istanbul ignore if */
  50376. if (
  50377. warn &&
  50378. modifiers.prevent && modifiers.passive
  50379. ) {
  50380. warn(
  50381. 'passive and prevent can\'t be used together. ' +
  50382. 'Passive handler can\'t prevent default event.',
  50383. range
  50384. );
  50385. }
  50386. // normalize click.right and click.middle since they don't actually fire
  50387. // this is technically browser-specific, but at least for now browsers are
  50388. // the only target envs that have right/middle clicks.
  50389. if (modifiers.right) {
  50390. if (dynamic) {
  50391. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50392. } else if (name === 'click') {
  50393. name = 'contextmenu';
  50394. delete modifiers.right;
  50395. }
  50396. } else if (modifiers.middle) {
  50397. if (dynamic) {
  50398. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50399. } else if (name === 'click') {
  50400. name = 'mouseup';
  50401. }
  50402. }
  50403. // check capture modifier
  50404. if (modifiers.capture) {
  50405. delete modifiers.capture;
  50406. name = prependModifierMarker('!', name, dynamic);
  50407. }
  50408. if (modifiers.once) {
  50409. delete modifiers.once;
  50410. name = prependModifierMarker('~', name, dynamic);
  50411. }
  50412. /* istanbul ignore if */
  50413. if (modifiers.passive) {
  50414. delete modifiers.passive;
  50415. name = prependModifierMarker('&', name, dynamic);
  50416. }
  50417. var events;
  50418. if (modifiers.native) {
  50419. delete modifiers.native;
  50420. events = el.nativeEvents || (el.nativeEvents = {});
  50421. } else {
  50422. events = el.events || (el.events = {});
  50423. }
  50424. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50425. if (modifiers !== emptyObject) {
  50426. newHandler.modifiers = modifiers;
  50427. }
  50428. var handlers = events[name];
  50429. /* istanbul ignore if */
  50430. if (Array.isArray(handlers)) {
  50431. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50432. } else if (handlers) {
  50433. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50434. } else {
  50435. events[name] = newHandler;
  50436. }
  50437. el.plain = false;
  50438. }
  50439. function getRawBindingAttr (
  50440. el,
  50441. name
  50442. ) {
  50443. return el.rawAttrsMap[':' + name] ||
  50444. el.rawAttrsMap['v-bind:' + name] ||
  50445. el.rawAttrsMap[name]
  50446. }
  50447. function getBindingAttr (
  50448. el,
  50449. name,
  50450. getStatic
  50451. ) {
  50452. var dynamicValue =
  50453. getAndRemoveAttr(el, ':' + name) ||
  50454. getAndRemoveAttr(el, 'v-bind:' + name);
  50455. if (dynamicValue != null) {
  50456. return parseFilters(dynamicValue)
  50457. } else if (getStatic !== false) {
  50458. var staticValue = getAndRemoveAttr(el, name);
  50459. if (staticValue != null) {
  50460. return JSON.stringify(staticValue)
  50461. }
  50462. }
  50463. }
  50464. // note: this only removes the attr from the Array (attrsList) so that it
  50465. // doesn't get processed by processAttrs.
  50466. // By default it does NOT remove it from the map (attrsMap) because the map is
  50467. // needed during codegen.
  50468. function getAndRemoveAttr (
  50469. el,
  50470. name,
  50471. removeFromMap
  50472. ) {
  50473. var val;
  50474. if ((val = el.attrsMap[name]) != null) {
  50475. var list = el.attrsList;
  50476. for (var i = 0, l = list.length; i < l; i++) {
  50477. if (list[i].name === name) {
  50478. list.splice(i, 1);
  50479. break
  50480. }
  50481. }
  50482. }
  50483. if (removeFromMap) {
  50484. delete el.attrsMap[name];
  50485. }
  50486. return val
  50487. }
  50488. function getAndRemoveAttrByRegex (
  50489. el,
  50490. name
  50491. ) {
  50492. var list = el.attrsList;
  50493. for (var i = 0, l = list.length; i < l; i++) {
  50494. var attr = list[i];
  50495. if (name.test(attr.name)) {
  50496. list.splice(i, 1);
  50497. return attr
  50498. }
  50499. }
  50500. }
  50501. function rangeSetItem (
  50502. item,
  50503. range
  50504. ) {
  50505. if (range) {
  50506. if (range.start != null) {
  50507. item.start = range.start;
  50508. }
  50509. if (range.end != null) {
  50510. item.end = range.end;
  50511. }
  50512. }
  50513. return item
  50514. }
  50515. /* */
  50516. /**
  50517. * Cross-platform code generation for component v-model
  50518. */
  50519. function genComponentModel (
  50520. el,
  50521. value,
  50522. modifiers
  50523. ) {
  50524. var ref = modifiers || {};
  50525. var number = ref.number;
  50526. var trim = ref.trim;
  50527. var baseValueExpression = '$$v';
  50528. var valueExpression = baseValueExpression;
  50529. if (trim) {
  50530. valueExpression =
  50531. "(typeof " + baseValueExpression + " === 'string'" +
  50532. "? " + baseValueExpression + ".trim()" +
  50533. ": " + baseValueExpression + ")";
  50534. }
  50535. if (number) {
  50536. valueExpression = "_n(" + valueExpression + ")";
  50537. }
  50538. var assignment = genAssignmentCode(value, valueExpression);
  50539. el.model = {
  50540. value: ("(" + value + ")"),
  50541. expression: JSON.stringify(value),
  50542. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  50543. };
  50544. }
  50545. /**
  50546. * Cross-platform codegen helper for generating v-model value assignment code.
  50547. */
  50548. function genAssignmentCode (
  50549. value,
  50550. assignment
  50551. ) {
  50552. var res = parseModel(value);
  50553. if (res.key === null) {
  50554. return (value + "=" + assignment)
  50555. } else {
  50556. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  50557. }
  50558. }
  50559. /**
  50560. * Parse a v-model expression into a base path and a final key segment.
  50561. * Handles both dot-path and possible square brackets.
  50562. *
  50563. * Possible cases:
  50564. *
  50565. * - test
  50566. * - test[key]
  50567. * - test[test1[key]]
  50568. * - test["a"][key]
  50569. * - xxx.test[a[a].test1[key]]
  50570. * - test.xxx.a["asa"][test1[key]]
  50571. *
  50572. */
  50573. var len, str, chr, index$1, expressionPos, expressionEndPos;
  50574. function parseModel (val) {
  50575. // Fix https://github.com/vuejs/vue/pull/7730
  50576. // allow v-model="obj.val " (trailing whitespace)
  50577. val = val.trim();
  50578. len = val.length;
  50579. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  50580. index$1 = val.lastIndexOf('.');
  50581. if (index$1 > -1) {
  50582. return {
  50583. exp: val.slice(0, index$1),
  50584. key: '"' + val.slice(index$1 + 1) + '"'
  50585. }
  50586. } else {
  50587. return {
  50588. exp: val,
  50589. key: null
  50590. }
  50591. }
  50592. }
  50593. str = val;
  50594. index$1 = expressionPos = expressionEndPos = 0;
  50595. while (!eof()) {
  50596. chr = next();
  50597. /* istanbul ignore if */
  50598. if (isStringStart(chr)) {
  50599. parseString(chr);
  50600. } else if (chr === 0x5B) {
  50601. parseBracket(chr);
  50602. }
  50603. }
  50604. return {
  50605. exp: val.slice(0, expressionPos),
  50606. key: val.slice(expressionPos + 1, expressionEndPos)
  50607. }
  50608. }
  50609. function next () {
  50610. return str.charCodeAt(++index$1)
  50611. }
  50612. function eof () {
  50613. return index$1 >= len
  50614. }
  50615. function isStringStart (chr) {
  50616. return chr === 0x22 || chr === 0x27
  50617. }
  50618. function parseBracket (chr) {
  50619. var inBracket = 1;
  50620. expressionPos = index$1;
  50621. while (!eof()) {
  50622. chr = next();
  50623. if (isStringStart(chr)) {
  50624. parseString(chr);
  50625. continue
  50626. }
  50627. if (chr === 0x5B) { inBracket++; }
  50628. if (chr === 0x5D) { inBracket--; }
  50629. if (inBracket === 0) {
  50630. expressionEndPos = index$1;
  50631. break
  50632. }
  50633. }
  50634. }
  50635. function parseString (chr) {
  50636. var stringQuote = chr;
  50637. while (!eof()) {
  50638. chr = next();
  50639. if (chr === stringQuote) {
  50640. break
  50641. }
  50642. }
  50643. }
  50644. /* */
  50645. var warn$1;
  50646. // in some cases, the event used has to be determined at runtime
  50647. // so we used some reserved tokens during compile.
  50648. var RANGE_TOKEN = '__r';
  50649. var CHECKBOX_RADIO_TOKEN = '__c';
  50650. function model (
  50651. el,
  50652. dir,
  50653. _warn
  50654. ) {
  50655. warn$1 = _warn;
  50656. var value = dir.value;
  50657. var modifiers = dir.modifiers;
  50658. var tag = el.tag;
  50659. var type = el.attrsMap.type;
  50660. {
  50661. // inputs with type="file" are read only and setting the input's
  50662. // value will throw an error.
  50663. if (tag === 'input' && type === 'file') {
  50664. warn$1(
  50665. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  50666. "File inputs are read only. Use a v-on:change listener instead.",
  50667. el.rawAttrsMap['v-model']
  50668. );
  50669. }
  50670. }
  50671. if (el.component) {
  50672. genComponentModel(el, value, modifiers);
  50673. // component v-model doesn't need extra runtime
  50674. return false
  50675. } else if (tag === 'select') {
  50676. genSelect(el, value, modifiers);
  50677. } else if (tag === 'input' && type === 'checkbox') {
  50678. genCheckboxModel(el, value, modifiers);
  50679. } else if (tag === 'input' && type === 'radio') {
  50680. genRadioModel(el, value, modifiers);
  50681. } else if (tag === 'input' || tag === 'textarea') {
  50682. genDefaultModel(el, value, modifiers);
  50683. } else if (!config.isReservedTag(tag)) {
  50684. genComponentModel(el, value, modifiers);
  50685. // component v-model doesn't need extra runtime
  50686. return false
  50687. } else {
  50688. warn$1(
  50689. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  50690. "v-model is not supported on this element type. " +
  50691. 'If you are working with contenteditable, it\'s recommended to ' +
  50692. 'wrap a library dedicated for that purpose inside a custom component.',
  50693. el.rawAttrsMap['v-model']
  50694. );
  50695. }
  50696. // ensure runtime directive metadata
  50697. return true
  50698. }
  50699. function genCheckboxModel (
  50700. el,
  50701. value,
  50702. modifiers
  50703. ) {
  50704. var number = modifiers && modifiers.number;
  50705. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50706. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  50707. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  50708. addProp(el, 'checked',
  50709. "Array.isArray(" + value + ")" +
  50710. "?_i(" + value + "," + valueBinding + ")>-1" + (
  50711. trueValueBinding === 'true'
  50712. ? (":(" + value + ")")
  50713. : (":_q(" + value + "," + trueValueBinding + ")")
  50714. )
  50715. );
  50716. addHandler(el, 'change',
  50717. "var $$a=" + value + "," +
  50718. '$$el=$event.target,' +
  50719. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  50720. 'if(Array.isArray($$a)){' +
  50721. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  50722. '$$i=_i($$a,$$v);' +
  50723. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  50724. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  50725. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  50726. null, true
  50727. );
  50728. }
  50729. function genRadioModel (
  50730. el,
  50731. value,
  50732. modifiers
  50733. ) {
  50734. var number = modifiers && modifiers.number;
  50735. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50736. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  50737. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  50738. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  50739. }
  50740. function genSelect (
  50741. el,
  50742. value,
  50743. modifiers
  50744. ) {
  50745. var number = modifiers && modifiers.number;
  50746. var selectedVal = "Array.prototype.filter" +
  50747. ".call($event.target.options,function(o){return o.selected})" +
  50748. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  50749. "return " + (number ? '_n(val)' : 'val') + "})";
  50750. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  50751. var code = "var $$selectedVal = " + selectedVal + ";";
  50752. code = code + " " + (genAssignmentCode(value, assignment));
  50753. addHandler(el, 'change', code, null, true);
  50754. }
  50755. function genDefaultModel (
  50756. el,
  50757. value,
  50758. modifiers
  50759. ) {
  50760. var type = el.attrsMap.type;
  50761. // warn if v-bind:value conflicts with v-model
  50762. // except for inputs with v-bind:type
  50763. {
  50764. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  50765. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  50766. if (value$1 && !typeBinding) {
  50767. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  50768. warn$1(
  50769. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  50770. 'because the latter already expands to a value binding internally',
  50771. el.rawAttrsMap[binding]
  50772. );
  50773. }
  50774. }
  50775. var ref = modifiers || {};
  50776. var lazy = ref.lazy;
  50777. var number = ref.number;
  50778. var trim = ref.trim;
  50779. var needCompositionGuard = !lazy && type !== 'range';
  50780. var event = lazy
  50781. ? 'change'
  50782. : type === 'range'
  50783. ? RANGE_TOKEN
  50784. : 'input';
  50785. var valueExpression = '$event.target.value';
  50786. if (trim) {
  50787. valueExpression = "$event.target.value.trim()";
  50788. }
  50789. if (number) {
  50790. valueExpression = "_n(" + valueExpression + ")";
  50791. }
  50792. var code = genAssignmentCode(value, valueExpression);
  50793. if (needCompositionGuard) {
  50794. code = "if($event.target.composing)return;" + code;
  50795. }
  50796. addProp(el, 'value', ("(" + value + ")"));
  50797. addHandler(el, event, code, null, true);
  50798. if (trim || number) {
  50799. addHandler(el, 'blur', '$forceUpdate()');
  50800. }
  50801. }
  50802. /* */
  50803. // normalize v-model event tokens that can only be determined at runtime.
  50804. // it's important to place the event as the first in the array because
  50805. // the whole point is ensuring the v-model callback gets called before
  50806. // user-attached handlers.
  50807. function normalizeEvents (on) {
  50808. /* istanbul ignore if */
  50809. if (isDef(on[RANGE_TOKEN])) {
  50810. // IE input[type=range] only supports `change` event
  50811. var event = isIE ? 'change' : 'input';
  50812. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  50813. delete on[RANGE_TOKEN];
  50814. }
  50815. // This was originally intended to fix #4521 but no longer necessary
  50816. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  50817. /* istanbul ignore if */
  50818. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  50819. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  50820. delete on[CHECKBOX_RADIO_TOKEN];
  50821. }
  50822. }
  50823. var target$1;
  50824. function createOnceHandler$1 (event, handler, capture) {
  50825. var _target = target$1; // save current target element in closure
  50826. return function onceHandler () {
  50827. var res = handler.apply(null, arguments);
  50828. if (res !== null) {
  50829. remove$2(event, onceHandler, capture, _target);
  50830. }
  50831. }
  50832. }
  50833. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  50834. // implementation and does not fire microtasks in between event propagation, so
  50835. // safe to exclude.
  50836. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  50837. function add$1 (
  50838. name,
  50839. handler,
  50840. capture,
  50841. passive
  50842. ) {
  50843. // async edge case #6566: inner click event triggers patch, event handler
  50844. // attached to outer element during patch, and triggered again. This
  50845. // happens because browsers fire microtask ticks between event propagation.
  50846. // the solution is simple: we save the timestamp when a handler is attached,
  50847. // and the handler would only fire if the event passed to it was fired
  50848. // AFTER it was attached.
  50849. if (useMicrotaskFix) {
  50850. var attachedTimestamp = currentFlushTimestamp;
  50851. var original = handler;
  50852. handler = original._wrapper = function (e) {
  50853. if (
  50854. // no bubbling, should always fire.
  50855. // this is just a safety net in case event.timeStamp is unreliable in
  50856. // certain weird environments...
  50857. e.target === e.currentTarget ||
  50858. // event is fired after handler attachment
  50859. e.timeStamp >= attachedTimestamp ||
  50860. // bail for environments that have buggy event.timeStamp implementations
  50861. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  50862. // #9681 QtWebEngine event.timeStamp is negative value
  50863. e.timeStamp <= 0 ||
  50864. // #9448 bail if event is fired in another document in a multi-page
  50865. // electron/nw.js app, since event.timeStamp will be using a different
  50866. // starting reference
  50867. e.target.ownerDocument !== document
  50868. ) {
  50869. return original.apply(this, arguments)
  50870. }
  50871. };
  50872. }
  50873. target$1.addEventListener(
  50874. name,
  50875. handler,
  50876. supportsPassive
  50877. ? { capture: capture, passive: passive }
  50878. : capture
  50879. );
  50880. }
  50881. function remove$2 (
  50882. name,
  50883. handler,
  50884. capture,
  50885. _target
  50886. ) {
  50887. (_target || target$1).removeEventListener(
  50888. name,
  50889. handler._wrapper || handler,
  50890. capture
  50891. );
  50892. }
  50893. function updateDOMListeners (oldVnode, vnode) {
  50894. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  50895. return
  50896. }
  50897. var on = vnode.data.on || {};
  50898. var oldOn = oldVnode.data.on || {};
  50899. target$1 = vnode.elm;
  50900. normalizeEvents(on);
  50901. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  50902. target$1 = undefined;
  50903. }
  50904. var events = {
  50905. create: updateDOMListeners,
  50906. update: updateDOMListeners
  50907. };
  50908. /* */
  50909. var svgContainer;
  50910. function updateDOMProps (oldVnode, vnode) {
  50911. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  50912. return
  50913. }
  50914. var key, cur;
  50915. var elm = vnode.elm;
  50916. var oldProps = oldVnode.data.domProps || {};
  50917. var props = vnode.data.domProps || {};
  50918. // clone observed objects, as the user probably wants to mutate it
  50919. if (isDef(props.__ob__)) {
  50920. props = vnode.data.domProps = extend({}, props);
  50921. }
  50922. for (key in oldProps) {
  50923. if (!(key in props)) {
  50924. elm[key] = '';
  50925. }
  50926. }
  50927. for (key in props) {
  50928. cur = props[key];
  50929. // ignore children if the node has textContent or innerHTML,
  50930. // as these will throw away existing DOM nodes and cause removal errors
  50931. // on subsequent patches (#3360)
  50932. if (key === 'textContent' || key === 'innerHTML') {
  50933. if (vnode.children) { vnode.children.length = 0; }
  50934. if (cur === oldProps[key]) { continue }
  50935. // #6601 work around Chrome version <= 55 bug where single textNode
  50936. // replaced by innerHTML/textContent retains its parentNode property
  50937. if (elm.childNodes.length === 1) {
  50938. elm.removeChild(elm.childNodes[0]);
  50939. }
  50940. }
  50941. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  50942. // store value as _value as well since
  50943. // non-string values will be stringified
  50944. elm._value = cur;
  50945. // avoid resetting cursor position when value is the same
  50946. var strCur = isUndef(cur) ? '' : String(cur);
  50947. if (shouldUpdateValue(elm, strCur)) {
  50948. elm.value = strCur;
  50949. }
  50950. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  50951. // IE doesn't support innerHTML for SVG elements
  50952. svgContainer = svgContainer || document.createElement('div');
  50953. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  50954. var svg = svgContainer.firstChild;
  50955. while (elm.firstChild) {
  50956. elm.removeChild(elm.firstChild);
  50957. }
  50958. while (svg.firstChild) {
  50959. elm.appendChild(svg.firstChild);
  50960. }
  50961. } else if (
  50962. // skip the update if old and new VDOM state is the same.
  50963. // `value` is handled separately because the DOM value may be temporarily
  50964. // out of sync with VDOM state due to focus, composition and modifiers.
  50965. // This #4521 by skipping the unnecesarry `checked` update.
  50966. cur !== oldProps[key]
  50967. ) {
  50968. // some property updates can throw
  50969. // e.g. `value` on <progress> w/ non-finite value
  50970. try {
  50971. elm[key] = cur;
  50972. } catch (e) {}
  50973. }
  50974. }
  50975. }
  50976. // check platforms/web/util/attrs.js acceptValue
  50977. function shouldUpdateValue (elm, checkVal) {
  50978. return (!elm.composing && (
  50979. elm.tagName === 'OPTION' ||
  50980. isNotInFocusAndDirty(elm, checkVal) ||
  50981. isDirtyWithModifiers(elm, checkVal)
  50982. ))
  50983. }
  50984. function isNotInFocusAndDirty (elm, checkVal) {
  50985. // return true when textbox (.number and .trim) loses focus and its value is
  50986. // not equal to the updated value
  50987. var notInFocus = true;
  50988. // #6157
  50989. // work around IE bug when accessing document.activeElement in an iframe
  50990. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  50991. return notInFocus && elm.value !== checkVal
  50992. }
  50993. function isDirtyWithModifiers (elm, newVal) {
  50994. var value = elm.value;
  50995. var modifiers = elm._vModifiers; // injected by v-model runtime
  50996. if (isDef(modifiers)) {
  50997. if (modifiers.number) {
  50998. return toNumber(value) !== toNumber(newVal)
  50999. }
  51000. if (modifiers.trim) {
  51001. return value.trim() !== newVal.trim()
  51002. }
  51003. }
  51004. return value !== newVal
  51005. }
  51006. var domProps = {
  51007. create: updateDOMProps,
  51008. update: updateDOMProps
  51009. };
  51010. /* */
  51011. var parseStyleText = cached(function (cssText) {
  51012. var res = {};
  51013. var listDelimiter = /;(?![^(]*\))/g;
  51014. var propertyDelimiter = /:(.+)/;
  51015. cssText.split(listDelimiter).forEach(function (item) {
  51016. if (item) {
  51017. var tmp = item.split(propertyDelimiter);
  51018. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51019. }
  51020. });
  51021. return res
  51022. });
  51023. // merge static and dynamic style data on the same vnode
  51024. function normalizeStyleData (data) {
  51025. var style = normalizeStyleBinding(data.style);
  51026. // static style is pre-processed into an object during compilation
  51027. // and is always a fresh object, so it's safe to merge into it
  51028. return data.staticStyle
  51029. ? extend(data.staticStyle, style)
  51030. : style
  51031. }
  51032. // normalize possible array / string values into Object
  51033. function normalizeStyleBinding (bindingStyle) {
  51034. if (Array.isArray(bindingStyle)) {
  51035. return toObject(bindingStyle)
  51036. }
  51037. if (typeof bindingStyle === 'string') {
  51038. return parseStyleText(bindingStyle)
  51039. }
  51040. return bindingStyle
  51041. }
  51042. /**
  51043. * parent component style should be after child's
  51044. * so that parent component's style could override it
  51045. */
  51046. function getStyle (vnode, checkChild) {
  51047. var res = {};
  51048. var styleData;
  51049. if (checkChild) {
  51050. var childNode = vnode;
  51051. while (childNode.componentInstance) {
  51052. childNode = childNode.componentInstance._vnode;
  51053. if (
  51054. childNode && childNode.data &&
  51055. (styleData = normalizeStyleData(childNode.data))
  51056. ) {
  51057. extend(res, styleData);
  51058. }
  51059. }
  51060. }
  51061. if ((styleData = normalizeStyleData(vnode.data))) {
  51062. extend(res, styleData);
  51063. }
  51064. var parentNode = vnode;
  51065. while ((parentNode = parentNode.parent)) {
  51066. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51067. extend(res, styleData);
  51068. }
  51069. }
  51070. return res
  51071. }
  51072. /* */
  51073. var cssVarRE = /^--/;
  51074. var importantRE = /\s*!important$/;
  51075. var setProp = function (el, name, val) {
  51076. /* istanbul ignore if */
  51077. if (cssVarRE.test(name)) {
  51078. el.style.setProperty(name, val);
  51079. } else if (importantRE.test(val)) {
  51080. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51081. } else {
  51082. var normalizedName = normalize(name);
  51083. if (Array.isArray(val)) {
  51084. // Support values array created by autoprefixer, e.g.
  51085. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51086. // Set them one by one, and the browser will only set those it can recognize
  51087. for (var i = 0, len = val.length; i < len; i++) {
  51088. el.style[normalizedName] = val[i];
  51089. }
  51090. } else {
  51091. el.style[normalizedName] = val;
  51092. }
  51093. }
  51094. };
  51095. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51096. var emptyStyle;
  51097. var normalize = cached(function (prop) {
  51098. emptyStyle = emptyStyle || document.createElement('div').style;
  51099. prop = camelize(prop);
  51100. if (prop !== 'filter' && (prop in emptyStyle)) {
  51101. return prop
  51102. }
  51103. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51104. for (var i = 0; i < vendorNames.length; i++) {
  51105. var name = vendorNames[i] + capName;
  51106. if (name in emptyStyle) {
  51107. return name
  51108. }
  51109. }
  51110. });
  51111. function updateStyle (oldVnode, vnode) {
  51112. var data = vnode.data;
  51113. var oldData = oldVnode.data;
  51114. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51115. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51116. ) {
  51117. return
  51118. }
  51119. var cur, name;
  51120. var el = vnode.elm;
  51121. var oldStaticStyle = oldData.staticStyle;
  51122. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51123. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51124. var oldStyle = oldStaticStyle || oldStyleBinding;
  51125. var style = normalizeStyleBinding(vnode.data.style) || {};
  51126. // store normalized style under a different key for next diff
  51127. // make sure to clone it if it's reactive, since the user likely wants
  51128. // to mutate it.
  51129. vnode.data.normalizedStyle = isDef(style.__ob__)
  51130. ? extend({}, style)
  51131. : style;
  51132. var newStyle = getStyle(vnode, true);
  51133. for (name in oldStyle) {
  51134. if (isUndef(newStyle[name])) {
  51135. setProp(el, name, '');
  51136. }
  51137. }
  51138. for (name in newStyle) {
  51139. cur = newStyle[name];
  51140. if (cur !== oldStyle[name]) {
  51141. // ie9 setting to null has no effect, must use empty string
  51142. setProp(el, name, cur == null ? '' : cur);
  51143. }
  51144. }
  51145. }
  51146. var style = {
  51147. create: updateStyle,
  51148. update: updateStyle
  51149. };
  51150. /* */
  51151. var whitespaceRE = /\s+/;
  51152. /**
  51153. * Add class with compatibility for SVG since classList is not supported on
  51154. * SVG elements in IE
  51155. */
  51156. function addClass (el, cls) {
  51157. /* istanbul ignore if */
  51158. if (!cls || !(cls = cls.trim())) {
  51159. return
  51160. }
  51161. /* istanbul ignore else */
  51162. if (el.classList) {
  51163. if (cls.indexOf(' ') > -1) {
  51164. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51165. } else {
  51166. el.classList.add(cls);
  51167. }
  51168. } else {
  51169. var cur = " " + (el.getAttribute('class') || '') + " ";
  51170. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51171. el.setAttribute('class', (cur + cls).trim());
  51172. }
  51173. }
  51174. }
  51175. /**
  51176. * Remove class with compatibility for SVG since classList is not supported on
  51177. * SVG elements in IE
  51178. */
  51179. function removeClass (el, cls) {
  51180. /* istanbul ignore if */
  51181. if (!cls || !(cls = cls.trim())) {
  51182. return
  51183. }
  51184. /* istanbul ignore else */
  51185. if (el.classList) {
  51186. if (cls.indexOf(' ') > -1) {
  51187. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51188. } else {
  51189. el.classList.remove(cls);
  51190. }
  51191. if (!el.classList.length) {
  51192. el.removeAttribute('class');
  51193. }
  51194. } else {
  51195. var cur = " " + (el.getAttribute('class') || '') + " ";
  51196. var tar = ' ' + cls + ' ';
  51197. while (cur.indexOf(tar) >= 0) {
  51198. cur = cur.replace(tar, ' ');
  51199. }
  51200. cur = cur.trim();
  51201. if (cur) {
  51202. el.setAttribute('class', cur);
  51203. } else {
  51204. el.removeAttribute('class');
  51205. }
  51206. }
  51207. }
  51208. /* */
  51209. function resolveTransition (def$$1) {
  51210. if (!def$$1) {
  51211. return
  51212. }
  51213. /* istanbul ignore else */
  51214. if (typeof def$$1 === 'object') {
  51215. var res = {};
  51216. if (def$$1.css !== false) {
  51217. extend(res, autoCssTransition(def$$1.name || 'v'));
  51218. }
  51219. extend(res, def$$1);
  51220. return res
  51221. } else if (typeof def$$1 === 'string') {
  51222. return autoCssTransition(def$$1)
  51223. }
  51224. }
  51225. var autoCssTransition = cached(function (name) {
  51226. return {
  51227. enterClass: (name + "-enter"),
  51228. enterToClass: (name + "-enter-to"),
  51229. enterActiveClass: (name + "-enter-active"),
  51230. leaveClass: (name + "-leave"),
  51231. leaveToClass: (name + "-leave-to"),
  51232. leaveActiveClass: (name + "-leave-active")
  51233. }
  51234. });
  51235. var hasTransition = inBrowser && !isIE9;
  51236. var TRANSITION = 'transition';
  51237. var ANIMATION = 'animation';
  51238. // Transition property/event sniffing
  51239. var transitionProp = 'transition';
  51240. var transitionEndEvent = 'transitionend';
  51241. var animationProp = 'animation';
  51242. var animationEndEvent = 'animationend';
  51243. if (hasTransition) {
  51244. /* istanbul ignore if */
  51245. if (window.ontransitionend === undefined &&
  51246. window.onwebkittransitionend !== undefined
  51247. ) {
  51248. transitionProp = 'WebkitTransition';
  51249. transitionEndEvent = 'webkitTransitionEnd';
  51250. }
  51251. if (window.onanimationend === undefined &&
  51252. window.onwebkitanimationend !== undefined
  51253. ) {
  51254. animationProp = 'WebkitAnimation';
  51255. animationEndEvent = 'webkitAnimationEnd';
  51256. }
  51257. }
  51258. // binding to window is necessary to make hot reload work in IE in strict mode
  51259. var raf = inBrowser
  51260. ? window.requestAnimationFrame
  51261. ? window.requestAnimationFrame.bind(window)
  51262. : setTimeout
  51263. : /* istanbul ignore next */ function (fn) { return fn(); };
  51264. function nextFrame (fn) {
  51265. raf(function () {
  51266. raf(fn);
  51267. });
  51268. }
  51269. function addTransitionClass (el, cls) {
  51270. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51271. if (transitionClasses.indexOf(cls) < 0) {
  51272. transitionClasses.push(cls);
  51273. addClass(el, cls);
  51274. }
  51275. }
  51276. function removeTransitionClass (el, cls) {
  51277. if (el._transitionClasses) {
  51278. remove(el._transitionClasses, cls);
  51279. }
  51280. removeClass(el, cls);
  51281. }
  51282. function whenTransitionEnds (
  51283. el,
  51284. expectedType,
  51285. cb
  51286. ) {
  51287. var ref = getTransitionInfo(el, expectedType);
  51288. var type = ref.type;
  51289. var timeout = ref.timeout;
  51290. var propCount = ref.propCount;
  51291. if (!type) { return cb() }
  51292. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51293. var ended = 0;
  51294. var end = function () {
  51295. el.removeEventListener(event, onEnd);
  51296. cb();
  51297. };
  51298. var onEnd = function (e) {
  51299. if (e.target === el) {
  51300. if (++ended >= propCount) {
  51301. end();
  51302. }
  51303. }
  51304. };
  51305. setTimeout(function () {
  51306. if (ended < propCount) {
  51307. end();
  51308. }
  51309. }, timeout + 1);
  51310. el.addEventListener(event, onEnd);
  51311. }
  51312. var transformRE = /\b(transform|all)(,|$)/;
  51313. function getTransitionInfo (el, expectedType) {
  51314. var styles = window.getComputedStyle(el);
  51315. // JSDOM may return undefined for transition properties
  51316. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51317. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51318. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51319. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51320. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51321. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51322. var type;
  51323. var timeout = 0;
  51324. var propCount = 0;
  51325. /* istanbul ignore if */
  51326. if (expectedType === TRANSITION) {
  51327. if (transitionTimeout > 0) {
  51328. type = TRANSITION;
  51329. timeout = transitionTimeout;
  51330. propCount = transitionDurations.length;
  51331. }
  51332. } else if (expectedType === ANIMATION) {
  51333. if (animationTimeout > 0) {
  51334. type = ANIMATION;
  51335. timeout = animationTimeout;
  51336. propCount = animationDurations.length;
  51337. }
  51338. } else {
  51339. timeout = Math.max(transitionTimeout, animationTimeout);
  51340. type = timeout > 0
  51341. ? transitionTimeout > animationTimeout
  51342. ? TRANSITION
  51343. : ANIMATION
  51344. : null;
  51345. propCount = type
  51346. ? type === TRANSITION
  51347. ? transitionDurations.length
  51348. : animationDurations.length
  51349. : 0;
  51350. }
  51351. var hasTransform =
  51352. type === TRANSITION &&
  51353. transformRE.test(styles[transitionProp + 'Property']);
  51354. return {
  51355. type: type,
  51356. timeout: timeout,
  51357. propCount: propCount,
  51358. hasTransform: hasTransform
  51359. }
  51360. }
  51361. function getTimeout (delays, durations) {
  51362. /* istanbul ignore next */
  51363. while (delays.length < durations.length) {
  51364. delays = delays.concat(delays);
  51365. }
  51366. return Math.max.apply(null, durations.map(function (d, i) {
  51367. return toMs(d) + toMs(delays[i])
  51368. }))
  51369. }
  51370. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51371. // in a locale-dependent way, using a comma instead of a dot.
  51372. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51373. // as a floor function) causing unexpected behaviors
  51374. function toMs (s) {
  51375. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51376. }
  51377. /* */
  51378. function enter (vnode, toggleDisplay) {
  51379. var el = vnode.elm;
  51380. // call leave callback now
  51381. if (isDef(el._leaveCb)) {
  51382. el._leaveCb.cancelled = true;
  51383. el._leaveCb();
  51384. }
  51385. var data = resolveTransition(vnode.data.transition);
  51386. if (isUndef(data)) {
  51387. return
  51388. }
  51389. /* istanbul ignore if */
  51390. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51391. return
  51392. }
  51393. var css = data.css;
  51394. var type = data.type;
  51395. var enterClass = data.enterClass;
  51396. var enterToClass = data.enterToClass;
  51397. var enterActiveClass = data.enterActiveClass;
  51398. var appearClass = data.appearClass;
  51399. var appearToClass = data.appearToClass;
  51400. var appearActiveClass = data.appearActiveClass;
  51401. var beforeEnter = data.beforeEnter;
  51402. var enter = data.enter;
  51403. var afterEnter = data.afterEnter;
  51404. var enterCancelled = data.enterCancelled;
  51405. var beforeAppear = data.beforeAppear;
  51406. var appear = data.appear;
  51407. var afterAppear = data.afterAppear;
  51408. var appearCancelled = data.appearCancelled;
  51409. var duration = data.duration;
  51410. // activeInstance will always be the <transition> component managing this
  51411. // transition. One edge case to check is when the <transition> is placed
  51412. // as the root node of a child component. In that case we need to check
  51413. // <transition>'s parent for appear check.
  51414. var context = activeInstance;
  51415. var transitionNode = activeInstance.$vnode;
  51416. while (transitionNode && transitionNode.parent) {
  51417. context = transitionNode.context;
  51418. transitionNode = transitionNode.parent;
  51419. }
  51420. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51421. if (isAppear && !appear && appear !== '') {
  51422. return
  51423. }
  51424. var startClass = isAppear && appearClass
  51425. ? appearClass
  51426. : enterClass;
  51427. var activeClass = isAppear && appearActiveClass
  51428. ? appearActiveClass
  51429. : enterActiveClass;
  51430. var toClass = isAppear && appearToClass
  51431. ? appearToClass
  51432. : enterToClass;
  51433. var beforeEnterHook = isAppear
  51434. ? (beforeAppear || beforeEnter)
  51435. : beforeEnter;
  51436. var enterHook = isAppear
  51437. ? (typeof appear === 'function' ? appear : enter)
  51438. : enter;
  51439. var afterEnterHook = isAppear
  51440. ? (afterAppear || afterEnter)
  51441. : afterEnter;
  51442. var enterCancelledHook = isAppear
  51443. ? (appearCancelled || enterCancelled)
  51444. : enterCancelled;
  51445. var explicitEnterDuration = toNumber(
  51446. isObject(duration)
  51447. ? duration.enter
  51448. : duration
  51449. );
  51450. if (explicitEnterDuration != null) {
  51451. checkDuration(explicitEnterDuration, 'enter', vnode);
  51452. }
  51453. var expectsCSS = css !== false && !isIE9;
  51454. var userWantsControl = getHookArgumentsLength(enterHook);
  51455. var cb = el._enterCb = once(function () {
  51456. if (expectsCSS) {
  51457. removeTransitionClass(el, toClass);
  51458. removeTransitionClass(el, activeClass);
  51459. }
  51460. if (cb.cancelled) {
  51461. if (expectsCSS) {
  51462. removeTransitionClass(el, startClass);
  51463. }
  51464. enterCancelledHook && enterCancelledHook(el);
  51465. } else {
  51466. afterEnterHook && afterEnterHook(el);
  51467. }
  51468. el._enterCb = null;
  51469. });
  51470. if (!vnode.data.show) {
  51471. // remove pending leave element on enter by injecting an insert hook
  51472. mergeVNodeHook(vnode, 'insert', function () {
  51473. var parent = el.parentNode;
  51474. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51475. if (pendingNode &&
  51476. pendingNode.tag === vnode.tag &&
  51477. pendingNode.elm._leaveCb
  51478. ) {
  51479. pendingNode.elm._leaveCb();
  51480. }
  51481. enterHook && enterHook(el, cb);
  51482. });
  51483. }
  51484. // start enter transition
  51485. beforeEnterHook && beforeEnterHook(el);
  51486. if (expectsCSS) {
  51487. addTransitionClass(el, startClass);
  51488. addTransitionClass(el, activeClass);
  51489. nextFrame(function () {
  51490. removeTransitionClass(el, startClass);
  51491. if (!cb.cancelled) {
  51492. addTransitionClass(el, toClass);
  51493. if (!userWantsControl) {
  51494. if (isValidDuration(explicitEnterDuration)) {
  51495. setTimeout(cb, explicitEnterDuration);
  51496. } else {
  51497. whenTransitionEnds(el, type, cb);
  51498. }
  51499. }
  51500. }
  51501. });
  51502. }
  51503. if (vnode.data.show) {
  51504. toggleDisplay && toggleDisplay();
  51505. enterHook && enterHook(el, cb);
  51506. }
  51507. if (!expectsCSS && !userWantsControl) {
  51508. cb();
  51509. }
  51510. }
  51511. function leave (vnode, rm) {
  51512. var el = vnode.elm;
  51513. // call enter callback now
  51514. if (isDef(el._enterCb)) {
  51515. el._enterCb.cancelled = true;
  51516. el._enterCb();
  51517. }
  51518. var data = resolveTransition(vnode.data.transition);
  51519. if (isUndef(data) || el.nodeType !== 1) {
  51520. return rm()
  51521. }
  51522. /* istanbul ignore if */
  51523. if (isDef(el._leaveCb)) {
  51524. return
  51525. }
  51526. var css = data.css;
  51527. var type = data.type;
  51528. var leaveClass = data.leaveClass;
  51529. var leaveToClass = data.leaveToClass;
  51530. var leaveActiveClass = data.leaveActiveClass;
  51531. var beforeLeave = data.beforeLeave;
  51532. var leave = data.leave;
  51533. var afterLeave = data.afterLeave;
  51534. var leaveCancelled = data.leaveCancelled;
  51535. var delayLeave = data.delayLeave;
  51536. var duration = data.duration;
  51537. var expectsCSS = css !== false && !isIE9;
  51538. var userWantsControl = getHookArgumentsLength(leave);
  51539. var explicitLeaveDuration = toNumber(
  51540. isObject(duration)
  51541. ? duration.leave
  51542. : duration
  51543. );
  51544. if (isDef(explicitLeaveDuration)) {
  51545. checkDuration(explicitLeaveDuration, 'leave', vnode);
  51546. }
  51547. var cb = el._leaveCb = once(function () {
  51548. if (el.parentNode && el.parentNode._pending) {
  51549. el.parentNode._pending[vnode.key] = null;
  51550. }
  51551. if (expectsCSS) {
  51552. removeTransitionClass(el, leaveToClass);
  51553. removeTransitionClass(el, leaveActiveClass);
  51554. }
  51555. if (cb.cancelled) {
  51556. if (expectsCSS) {
  51557. removeTransitionClass(el, leaveClass);
  51558. }
  51559. leaveCancelled && leaveCancelled(el);
  51560. } else {
  51561. rm();
  51562. afterLeave && afterLeave(el);
  51563. }
  51564. el._leaveCb = null;
  51565. });
  51566. if (delayLeave) {
  51567. delayLeave(performLeave);
  51568. } else {
  51569. performLeave();
  51570. }
  51571. function performLeave () {
  51572. // the delayed leave may have already been cancelled
  51573. if (cb.cancelled) {
  51574. return
  51575. }
  51576. // record leaving element
  51577. if (!vnode.data.show && el.parentNode) {
  51578. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  51579. }
  51580. beforeLeave && beforeLeave(el);
  51581. if (expectsCSS) {
  51582. addTransitionClass(el, leaveClass);
  51583. addTransitionClass(el, leaveActiveClass);
  51584. nextFrame(function () {
  51585. removeTransitionClass(el, leaveClass);
  51586. if (!cb.cancelled) {
  51587. addTransitionClass(el, leaveToClass);
  51588. if (!userWantsControl) {
  51589. if (isValidDuration(explicitLeaveDuration)) {
  51590. setTimeout(cb, explicitLeaveDuration);
  51591. } else {
  51592. whenTransitionEnds(el, type, cb);
  51593. }
  51594. }
  51595. }
  51596. });
  51597. }
  51598. leave && leave(el, cb);
  51599. if (!expectsCSS && !userWantsControl) {
  51600. cb();
  51601. }
  51602. }
  51603. }
  51604. // only used in dev mode
  51605. function checkDuration (val, name, vnode) {
  51606. if (typeof val !== 'number') {
  51607. warn(
  51608. "<transition> explicit " + name + " duration is not a valid number - " +
  51609. "got " + (JSON.stringify(val)) + ".",
  51610. vnode.context
  51611. );
  51612. } else if (isNaN(val)) {
  51613. warn(
  51614. "<transition> explicit " + name + " duration is NaN - " +
  51615. 'the duration expression might be incorrect.',
  51616. vnode.context
  51617. );
  51618. }
  51619. }
  51620. function isValidDuration (val) {
  51621. return typeof val === 'number' && !isNaN(val)
  51622. }
  51623. /**
  51624. * Normalize a transition hook's argument length. The hook may be:
  51625. * - a merged hook (invoker) with the original in .fns
  51626. * - a wrapped component method (check ._length)
  51627. * - a plain function (.length)
  51628. */
  51629. function getHookArgumentsLength (fn) {
  51630. if (isUndef(fn)) {
  51631. return false
  51632. }
  51633. var invokerFns = fn.fns;
  51634. if (isDef(invokerFns)) {
  51635. // invoker
  51636. return getHookArgumentsLength(
  51637. Array.isArray(invokerFns)
  51638. ? invokerFns[0]
  51639. : invokerFns
  51640. )
  51641. } else {
  51642. return (fn._length || fn.length) > 1
  51643. }
  51644. }
  51645. function _enter (_, vnode) {
  51646. if (vnode.data.show !== true) {
  51647. enter(vnode);
  51648. }
  51649. }
  51650. var transition = inBrowser ? {
  51651. create: _enter,
  51652. activate: _enter,
  51653. remove: function remove$$1 (vnode, rm) {
  51654. /* istanbul ignore else */
  51655. if (vnode.data.show !== true) {
  51656. leave(vnode, rm);
  51657. } else {
  51658. rm();
  51659. }
  51660. }
  51661. } : {};
  51662. var platformModules = [
  51663. attrs,
  51664. klass,
  51665. events,
  51666. domProps,
  51667. style,
  51668. transition
  51669. ];
  51670. /* */
  51671. // the directive module should be applied last, after all
  51672. // built-in modules have been applied.
  51673. var modules = platformModules.concat(baseModules);
  51674. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  51675. /**
  51676. * Not type checking this file because flow doesn't like attaching
  51677. * properties to Elements.
  51678. */
  51679. /* istanbul ignore if */
  51680. if (isIE9) {
  51681. // http://www.matts411.com/post/internet-explorer-9-oninput/
  51682. document.addEventListener('selectionchange', function () {
  51683. var el = document.activeElement;
  51684. if (el && el.vmodel) {
  51685. trigger(el, 'input');
  51686. }
  51687. });
  51688. }
  51689. var directive = {
  51690. inserted: function inserted (el, binding, vnode, oldVnode) {
  51691. if (vnode.tag === 'select') {
  51692. // #6903
  51693. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  51694. mergeVNodeHook(vnode, 'postpatch', function () {
  51695. directive.componentUpdated(el, binding, vnode);
  51696. });
  51697. } else {
  51698. setSelected(el, binding, vnode.context);
  51699. }
  51700. el._vOptions = [].map.call(el.options, getValue);
  51701. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  51702. el._vModifiers = binding.modifiers;
  51703. if (!binding.modifiers.lazy) {
  51704. el.addEventListener('compositionstart', onCompositionStart);
  51705. el.addEventListener('compositionend', onCompositionEnd);
  51706. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  51707. // switching focus before confirming composition choice
  51708. // this also fixes the issue where some browsers e.g. iOS Chrome
  51709. // fires "change" instead of "input" on autocomplete.
  51710. el.addEventListener('change', onCompositionEnd);
  51711. /* istanbul ignore if */
  51712. if (isIE9) {
  51713. el.vmodel = true;
  51714. }
  51715. }
  51716. }
  51717. },
  51718. componentUpdated: function componentUpdated (el, binding, vnode) {
  51719. if (vnode.tag === 'select') {
  51720. setSelected(el, binding, vnode.context);
  51721. // in case the options rendered by v-for have changed,
  51722. // it's possible that the value is out-of-sync with the rendered options.
  51723. // detect such cases and filter out values that no longer has a matching
  51724. // option in the DOM.
  51725. var prevOptions = el._vOptions;
  51726. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  51727. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  51728. // trigger change event if
  51729. // no matching option found for at least one value
  51730. var needReset = el.multiple
  51731. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  51732. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  51733. if (needReset) {
  51734. trigger(el, 'change');
  51735. }
  51736. }
  51737. }
  51738. }
  51739. };
  51740. function setSelected (el, binding, vm) {
  51741. actuallySetSelected(el, binding, vm);
  51742. /* istanbul ignore if */
  51743. if (isIE || isEdge) {
  51744. setTimeout(function () {
  51745. actuallySetSelected(el, binding, vm);
  51746. }, 0);
  51747. }
  51748. }
  51749. function actuallySetSelected (el, binding, vm) {
  51750. var value = binding.value;
  51751. var isMultiple = el.multiple;
  51752. if (isMultiple && !Array.isArray(value)) {
  51753. warn(
  51754. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  51755. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  51756. vm
  51757. );
  51758. return
  51759. }
  51760. var selected, option;
  51761. for (var i = 0, l = el.options.length; i < l; i++) {
  51762. option = el.options[i];
  51763. if (isMultiple) {
  51764. selected = looseIndexOf(value, getValue(option)) > -1;
  51765. if (option.selected !== selected) {
  51766. option.selected = selected;
  51767. }
  51768. } else {
  51769. if (looseEqual(getValue(option), value)) {
  51770. if (el.selectedIndex !== i) {
  51771. el.selectedIndex = i;
  51772. }
  51773. return
  51774. }
  51775. }
  51776. }
  51777. if (!isMultiple) {
  51778. el.selectedIndex = -1;
  51779. }
  51780. }
  51781. function hasNoMatchingOption (value, options) {
  51782. return options.every(function (o) { return !looseEqual(o, value); })
  51783. }
  51784. function getValue (option) {
  51785. return '_value' in option
  51786. ? option._value
  51787. : option.value
  51788. }
  51789. function onCompositionStart (e) {
  51790. e.target.composing = true;
  51791. }
  51792. function onCompositionEnd (e) {
  51793. // prevent triggering an input event for no reason
  51794. if (!e.target.composing) { return }
  51795. e.target.composing = false;
  51796. trigger(e.target, 'input');
  51797. }
  51798. function trigger (el, type) {
  51799. var e = document.createEvent('HTMLEvents');
  51800. e.initEvent(type, true, true);
  51801. el.dispatchEvent(e);
  51802. }
  51803. /* */
  51804. // recursively search for possible transition defined inside the component root
  51805. function locateNode (vnode) {
  51806. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  51807. ? locateNode(vnode.componentInstance._vnode)
  51808. : vnode
  51809. }
  51810. var show = {
  51811. bind: function bind (el, ref, vnode) {
  51812. var value = ref.value;
  51813. vnode = locateNode(vnode);
  51814. var transition$$1 = vnode.data && vnode.data.transition;
  51815. var originalDisplay = el.__vOriginalDisplay =
  51816. el.style.display === 'none' ? '' : el.style.display;
  51817. if (value && transition$$1) {
  51818. vnode.data.show = true;
  51819. enter(vnode, function () {
  51820. el.style.display = originalDisplay;
  51821. });
  51822. } else {
  51823. el.style.display = value ? originalDisplay : 'none';
  51824. }
  51825. },
  51826. update: function update (el, ref, vnode) {
  51827. var value = ref.value;
  51828. var oldValue = ref.oldValue;
  51829. /* istanbul ignore if */
  51830. if (!value === !oldValue) { return }
  51831. vnode = locateNode(vnode);
  51832. var transition$$1 = vnode.data && vnode.data.transition;
  51833. if (transition$$1) {
  51834. vnode.data.show = true;
  51835. if (value) {
  51836. enter(vnode, function () {
  51837. el.style.display = el.__vOriginalDisplay;
  51838. });
  51839. } else {
  51840. leave(vnode, function () {
  51841. el.style.display = 'none';
  51842. });
  51843. }
  51844. } else {
  51845. el.style.display = value ? el.__vOriginalDisplay : 'none';
  51846. }
  51847. },
  51848. unbind: function unbind (
  51849. el,
  51850. binding,
  51851. vnode,
  51852. oldVnode,
  51853. isDestroy
  51854. ) {
  51855. if (!isDestroy) {
  51856. el.style.display = el.__vOriginalDisplay;
  51857. }
  51858. }
  51859. };
  51860. var platformDirectives = {
  51861. model: directive,
  51862. show: show
  51863. };
  51864. /* */
  51865. var transitionProps = {
  51866. name: String,
  51867. appear: Boolean,
  51868. css: Boolean,
  51869. mode: String,
  51870. type: String,
  51871. enterClass: String,
  51872. leaveClass: String,
  51873. enterToClass: String,
  51874. leaveToClass: String,
  51875. enterActiveClass: String,
  51876. leaveActiveClass: String,
  51877. appearClass: String,
  51878. appearActiveClass: String,
  51879. appearToClass: String,
  51880. duration: [Number, String, Object]
  51881. };
  51882. // in case the child is also an abstract component, e.g. <keep-alive>
  51883. // we want to recursively retrieve the real component to be rendered
  51884. function getRealChild (vnode) {
  51885. var compOptions = vnode && vnode.componentOptions;
  51886. if (compOptions && compOptions.Ctor.options.abstract) {
  51887. return getRealChild(getFirstComponentChild(compOptions.children))
  51888. } else {
  51889. return vnode
  51890. }
  51891. }
  51892. function extractTransitionData (comp) {
  51893. var data = {};
  51894. var options = comp.$options;
  51895. // props
  51896. for (var key in options.propsData) {
  51897. data[key] = comp[key];
  51898. }
  51899. // events.
  51900. // extract listeners and pass them directly to the transition methods
  51901. var listeners = options._parentListeners;
  51902. for (var key$1 in listeners) {
  51903. data[camelize(key$1)] = listeners[key$1];
  51904. }
  51905. return data
  51906. }
  51907. function placeholder (h, rawChild) {
  51908. if (/\d-keep-alive$/.test(rawChild.tag)) {
  51909. return h('keep-alive', {
  51910. props: rawChild.componentOptions.propsData
  51911. })
  51912. }
  51913. }
  51914. function hasParentTransition (vnode) {
  51915. while ((vnode = vnode.parent)) {
  51916. if (vnode.data.transition) {
  51917. return true
  51918. }
  51919. }
  51920. }
  51921. function isSameChild (child, oldChild) {
  51922. return oldChild.key === child.key && oldChild.tag === child.tag
  51923. }
  51924. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  51925. var isVShowDirective = function (d) { return d.name === 'show'; };
  51926. var Transition = {
  51927. name: 'transition',
  51928. props: transitionProps,
  51929. abstract: true,
  51930. render: function render (h) {
  51931. var this$1 = this;
  51932. var children = this.$slots.default;
  51933. if (!children) {
  51934. return
  51935. }
  51936. // filter out text nodes (possible whitespaces)
  51937. children = children.filter(isNotTextNode);
  51938. /* istanbul ignore if */
  51939. if (!children.length) {
  51940. return
  51941. }
  51942. // warn multiple elements
  51943. if (children.length > 1) {
  51944. warn(
  51945. '<transition> can only be used on a single element. Use ' +
  51946. '<transition-group> for lists.',
  51947. this.$parent
  51948. );
  51949. }
  51950. var mode = this.mode;
  51951. // warn invalid mode
  51952. if (mode && mode !== 'in-out' && mode !== 'out-in'
  51953. ) {
  51954. warn(
  51955. 'invalid <transition> mode: ' + mode,
  51956. this.$parent
  51957. );
  51958. }
  51959. var rawChild = children[0];
  51960. // if this is a component root node and the component's
  51961. // parent container node also has transition, skip.
  51962. if (hasParentTransition(this.$vnode)) {
  51963. return rawChild
  51964. }
  51965. // apply transition data to child
  51966. // use getRealChild() to ignore abstract components e.g. keep-alive
  51967. var child = getRealChild(rawChild);
  51968. /* istanbul ignore if */
  51969. if (!child) {
  51970. return rawChild
  51971. }
  51972. if (this._leaving) {
  51973. return placeholder(h, rawChild)
  51974. }
  51975. // ensure a key that is unique to the vnode type and to this transition
  51976. // component instance. This key will be used to remove pending leaving nodes
  51977. // during entering.
  51978. var id = "__transition-" + (this._uid) + "-";
  51979. child.key = child.key == null
  51980. ? child.isComment
  51981. ? id + 'comment'
  51982. : id + child.tag
  51983. : isPrimitive(child.key)
  51984. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  51985. : child.key;
  51986. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  51987. var oldRawChild = this._vnode;
  51988. var oldChild = getRealChild(oldRawChild);
  51989. // mark v-show
  51990. // so that the transition module can hand over the control to the directive
  51991. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  51992. child.data.show = true;
  51993. }
  51994. if (
  51995. oldChild &&
  51996. oldChild.data &&
  51997. !isSameChild(child, oldChild) &&
  51998. !isAsyncPlaceholder(oldChild) &&
  51999. // #6687 component root is a comment node
  52000. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52001. ) {
  52002. // replace old child transition data with fresh one
  52003. // important for dynamic transitions!
  52004. var oldData = oldChild.data.transition = extend({}, data);
  52005. // handle transition mode
  52006. if (mode === 'out-in') {
  52007. // return placeholder node and queue update when leave finishes
  52008. this._leaving = true;
  52009. mergeVNodeHook(oldData, 'afterLeave', function () {
  52010. this$1._leaving = false;
  52011. this$1.$forceUpdate();
  52012. });
  52013. return placeholder(h, rawChild)
  52014. } else if (mode === 'in-out') {
  52015. if (isAsyncPlaceholder(child)) {
  52016. return oldRawChild
  52017. }
  52018. var delayedLeave;
  52019. var performLeave = function () { delayedLeave(); };
  52020. mergeVNodeHook(data, 'afterEnter', performLeave);
  52021. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52022. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52023. }
  52024. }
  52025. return rawChild
  52026. }
  52027. };
  52028. /* */
  52029. var props = extend({
  52030. tag: String,
  52031. moveClass: String
  52032. }, transitionProps);
  52033. delete props.mode;
  52034. var TransitionGroup = {
  52035. props: props,
  52036. beforeMount: function beforeMount () {
  52037. var this$1 = this;
  52038. var update = this._update;
  52039. this._update = function (vnode, hydrating) {
  52040. var restoreActiveInstance = setActiveInstance(this$1);
  52041. // force removing pass
  52042. this$1.__patch__(
  52043. this$1._vnode,
  52044. this$1.kept,
  52045. false, // hydrating
  52046. true // removeOnly (!important, avoids unnecessary moves)
  52047. );
  52048. this$1._vnode = this$1.kept;
  52049. restoreActiveInstance();
  52050. update.call(this$1, vnode, hydrating);
  52051. };
  52052. },
  52053. render: function render (h) {
  52054. var tag = this.tag || this.$vnode.data.tag || 'span';
  52055. var map = Object.create(null);
  52056. var prevChildren = this.prevChildren = this.children;
  52057. var rawChildren = this.$slots.default || [];
  52058. var children = this.children = [];
  52059. var transitionData = extractTransitionData(this);
  52060. for (var i = 0; i < rawChildren.length; i++) {
  52061. var c = rawChildren[i];
  52062. if (c.tag) {
  52063. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52064. children.push(c);
  52065. map[c.key] = c
  52066. ;(c.data || (c.data = {})).transition = transitionData;
  52067. } else {
  52068. var opts = c.componentOptions;
  52069. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52070. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52071. }
  52072. }
  52073. }
  52074. if (prevChildren) {
  52075. var kept = [];
  52076. var removed = [];
  52077. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52078. var c$1 = prevChildren[i$1];
  52079. c$1.data.transition = transitionData;
  52080. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52081. if (map[c$1.key]) {
  52082. kept.push(c$1);
  52083. } else {
  52084. removed.push(c$1);
  52085. }
  52086. }
  52087. this.kept = h(tag, null, kept);
  52088. this.removed = removed;
  52089. }
  52090. return h(tag, null, children)
  52091. },
  52092. updated: function updated () {
  52093. var children = this.prevChildren;
  52094. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52095. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52096. return
  52097. }
  52098. // we divide the work into three loops to avoid mixing DOM reads and writes
  52099. // in each iteration - which helps prevent layout thrashing.
  52100. children.forEach(callPendingCbs);
  52101. children.forEach(recordPosition);
  52102. children.forEach(applyTranslation);
  52103. // force reflow to put everything in position
  52104. // assign to this to avoid being removed in tree-shaking
  52105. // $flow-disable-line
  52106. this._reflow = document.body.offsetHeight;
  52107. children.forEach(function (c) {
  52108. if (c.data.moved) {
  52109. var el = c.elm;
  52110. var s = el.style;
  52111. addTransitionClass(el, moveClass);
  52112. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52113. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52114. if (e && e.target !== el) {
  52115. return
  52116. }
  52117. if (!e || /transform$/.test(e.propertyName)) {
  52118. el.removeEventListener(transitionEndEvent, cb);
  52119. el._moveCb = null;
  52120. removeTransitionClass(el, moveClass);
  52121. }
  52122. });
  52123. }
  52124. });
  52125. },
  52126. methods: {
  52127. hasMove: function hasMove (el, moveClass) {
  52128. /* istanbul ignore if */
  52129. if (!hasTransition) {
  52130. return false
  52131. }
  52132. /* istanbul ignore if */
  52133. if (this._hasMove) {
  52134. return this._hasMove
  52135. }
  52136. // Detect whether an element with the move class applied has
  52137. // CSS transitions. Since the element may be inside an entering
  52138. // transition at this very moment, we make a clone of it and remove
  52139. // all other transition classes applied to ensure only the move class
  52140. // is applied.
  52141. var clone = el.cloneNode();
  52142. if (el._transitionClasses) {
  52143. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52144. }
  52145. addClass(clone, moveClass);
  52146. clone.style.display = 'none';
  52147. this.$el.appendChild(clone);
  52148. var info = getTransitionInfo(clone);
  52149. this.$el.removeChild(clone);
  52150. return (this._hasMove = info.hasTransform)
  52151. }
  52152. }
  52153. };
  52154. function callPendingCbs (c) {
  52155. /* istanbul ignore if */
  52156. if (c.elm._moveCb) {
  52157. c.elm._moveCb();
  52158. }
  52159. /* istanbul ignore if */
  52160. if (c.elm._enterCb) {
  52161. c.elm._enterCb();
  52162. }
  52163. }
  52164. function recordPosition (c) {
  52165. c.data.newPos = c.elm.getBoundingClientRect();
  52166. }
  52167. function applyTranslation (c) {
  52168. var oldPos = c.data.pos;
  52169. var newPos = c.data.newPos;
  52170. var dx = oldPos.left - newPos.left;
  52171. var dy = oldPos.top - newPos.top;
  52172. if (dx || dy) {
  52173. c.data.moved = true;
  52174. var s = c.elm.style;
  52175. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52176. s.transitionDuration = '0s';
  52177. }
  52178. }
  52179. var platformComponents = {
  52180. Transition: Transition,
  52181. TransitionGroup: TransitionGroup
  52182. };
  52183. /* */
  52184. // install platform specific utils
  52185. Vue.config.mustUseProp = mustUseProp;
  52186. Vue.config.isReservedTag = isReservedTag;
  52187. Vue.config.isReservedAttr = isReservedAttr;
  52188. Vue.config.getTagNamespace = getTagNamespace;
  52189. Vue.config.isUnknownElement = isUnknownElement;
  52190. // install platform runtime directives & components
  52191. extend(Vue.options.directives, platformDirectives);
  52192. extend(Vue.options.components, platformComponents);
  52193. // install platform patch function
  52194. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52195. // public mount method
  52196. Vue.prototype.$mount = function (
  52197. el,
  52198. hydrating
  52199. ) {
  52200. el = el && inBrowser ? query(el) : undefined;
  52201. return mountComponent(this, el, hydrating)
  52202. };
  52203. // devtools global hook
  52204. /* istanbul ignore next */
  52205. if (inBrowser) {
  52206. setTimeout(function () {
  52207. if (config.devtools) {
  52208. if (devtools) {
  52209. devtools.emit('init', Vue);
  52210. } else {
  52211. console[console.info ? 'info' : 'log'](
  52212. 'Download the Vue Devtools extension for a better development experience:\n' +
  52213. 'https://github.com/vuejs/vue-devtools'
  52214. );
  52215. }
  52216. }
  52217. if (config.productionTip !== false &&
  52218. typeof console !== 'undefined'
  52219. ) {
  52220. console[console.info ? 'info' : 'log'](
  52221. "You are running Vue in development mode.\n" +
  52222. "Make sure to turn on production mode when deploying for production.\n" +
  52223. "See more tips at https://vuejs.org/guide/deployment.html"
  52224. );
  52225. }
  52226. }, 0);
  52227. }
  52228. /* */
  52229. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52230. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52231. var buildRegex = cached(function (delimiters) {
  52232. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52233. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52234. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52235. });
  52236. function parseText (
  52237. text,
  52238. delimiters
  52239. ) {
  52240. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52241. if (!tagRE.test(text)) {
  52242. return
  52243. }
  52244. var tokens = [];
  52245. var rawTokens = [];
  52246. var lastIndex = tagRE.lastIndex = 0;
  52247. var match, index, tokenValue;
  52248. while ((match = tagRE.exec(text))) {
  52249. index = match.index;
  52250. // push text token
  52251. if (index > lastIndex) {
  52252. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52253. tokens.push(JSON.stringify(tokenValue));
  52254. }
  52255. // tag token
  52256. var exp = parseFilters(match[1].trim());
  52257. tokens.push(("_s(" + exp + ")"));
  52258. rawTokens.push({ '@binding': exp });
  52259. lastIndex = index + match[0].length;
  52260. }
  52261. if (lastIndex < text.length) {
  52262. rawTokens.push(tokenValue = text.slice(lastIndex));
  52263. tokens.push(JSON.stringify(tokenValue));
  52264. }
  52265. return {
  52266. expression: tokens.join('+'),
  52267. tokens: rawTokens
  52268. }
  52269. }
  52270. /* */
  52271. function transformNode (el, options) {
  52272. var warn = options.warn || baseWarn;
  52273. var staticClass = getAndRemoveAttr(el, 'class');
  52274. if (staticClass) {
  52275. var res = parseText(staticClass, options.delimiters);
  52276. if (res) {
  52277. warn(
  52278. "class=\"" + staticClass + "\": " +
  52279. 'Interpolation inside attributes has been removed. ' +
  52280. 'Use v-bind or the colon shorthand instead. For example, ' +
  52281. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52282. el.rawAttrsMap['class']
  52283. );
  52284. }
  52285. }
  52286. if (staticClass) {
  52287. el.staticClass = JSON.stringify(staticClass);
  52288. }
  52289. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52290. if (classBinding) {
  52291. el.classBinding = classBinding;
  52292. }
  52293. }
  52294. function genData (el) {
  52295. var data = '';
  52296. if (el.staticClass) {
  52297. data += "staticClass:" + (el.staticClass) + ",";
  52298. }
  52299. if (el.classBinding) {
  52300. data += "class:" + (el.classBinding) + ",";
  52301. }
  52302. return data
  52303. }
  52304. var klass$1 = {
  52305. staticKeys: ['staticClass'],
  52306. transformNode: transformNode,
  52307. genData: genData
  52308. };
  52309. /* */
  52310. function transformNode$1 (el, options) {
  52311. var warn = options.warn || baseWarn;
  52312. var staticStyle = getAndRemoveAttr(el, 'style');
  52313. if (staticStyle) {
  52314. /* istanbul ignore if */
  52315. {
  52316. var res = parseText(staticStyle, options.delimiters);
  52317. if (res) {
  52318. warn(
  52319. "style=\"" + staticStyle + "\": " +
  52320. 'Interpolation inside attributes has been removed. ' +
  52321. 'Use v-bind or the colon shorthand instead. For example, ' +
  52322. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52323. el.rawAttrsMap['style']
  52324. );
  52325. }
  52326. }
  52327. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52328. }
  52329. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52330. if (styleBinding) {
  52331. el.styleBinding = styleBinding;
  52332. }
  52333. }
  52334. function genData$1 (el) {
  52335. var data = '';
  52336. if (el.staticStyle) {
  52337. data += "staticStyle:" + (el.staticStyle) + ",";
  52338. }
  52339. if (el.styleBinding) {
  52340. data += "style:(" + (el.styleBinding) + "),";
  52341. }
  52342. return data
  52343. }
  52344. var style$1 = {
  52345. staticKeys: ['staticStyle'],
  52346. transformNode: transformNode$1,
  52347. genData: genData$1
  52348. };
  52349. /* */
  52350. var decoder;
  52351. var he = {
  52352. decode: function decode (html) {
  52353. decoder = decoder || document.createElement('div');
  52354. decoder.innerHTML = html;
  52355. return decoder.textContent
  52356. }
  52357. };
  52358. /* */
  52359. var isUnaryTag = makeMap(
  52360. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52361. 'link,meta,param,source,track,wbr'
  52362. );
  52363. // Elements that you can, intentionally, leave open
  52364. // (and which close themselves)
  52365. var canBeLeftOpenTag = makeMap(
  52366. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52367. );
  52368. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52369. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52370. var isNonPhrasingTag = makeMap(
  52371. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52372. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52373. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52374. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52375. 'title,tr,track'
  52376. );
  52377. /**
  52378. * Not type-checking this file because it's mostly vendor code.
  52379. */
  52380. // Regular Expressions for parsing tags and attributes
  52381. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52382. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52383. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52384. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52385. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52386. var startTagClose = /^\s*(\/?)>/;
  52387. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52388. var doctype = /^<!DOCTYPE [^>]+>/i;
  52389. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52390. var comment = /^<!\--/;
  52391. var conditionalComment = /^<!\[/;
  52392. // Special Elements (can contain anything)
  52393. var isPlainTextElement = makeMap('script,style,textarea', true);
  52394. var reCache = {};
  52395. var decodingMap = {
  52396. '&lt;': '<',
  52397. '&gt;': '>',
  52398. '&quot;': '"',
  52399. '&amp;': '&',
  52400. '&#10;': '\n',
  52401. '&#9;': '\t',
  52402. '&#39;': "'"
  52403. };
  52404. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52405. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52406. // #5992
  52407. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52408. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52409. function decodeAttr (value, shouldDecodeNewlines) {
  52410. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52411. return value.replace(re, function (match) { return decodingMap[match]; })
  52412. }
  52413. function parseHTML (html, options) {
  52414. var stack = [];
  52415. var expectHTML = options.expectHTML;
  52416. var isUnaryTag$$1 = options.isUnaryTag || no;
  52417. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52418. var index = 0;
  52419. var last, lastTag;
  52420. while (html) {
  52421. last = html;
  52422. // Make sure we're not in a plaintext content element like script/style
  52423. if (!lastTag || !isPlainTextElement(lastTag)) {
  52424. var textEnd = html.indexOf('<');
  52425. if (textEnd === 0) {
  52426. // Comment:
  52427. if (comment.test(html)) {
  52428. var commentEnd = html.indexOf('-->');
  52429. if (commentEnd >= 0) {
  52430. if (options.shouldKeepComment) {
  52431. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52432. }
  52433. advance(commentEnd + 3);
  52434. continue
  52435. }
  52436. }
  52437. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52438. if (conditionalComment.test(html)) {
  52439. var conditionalEnd = html.indexOf(']>');
  52440. if (conditionalEnd >= 0) {
  52441. advance(conditionalEnd + 2);
  52442. continue
  52443. }
  52444. }
  52445. // Doctype:
  52446. var doctypeMatch = html.match(doctype);
  52447. if (doctypeMatch) {
  52448. advance(doctypeMatch[0].length);
  52449. continue
  52450. }
  52451. // End tag:
  52452. var endTagMatch = html.match(endTag);
  52453. if (endTagMatch) {
  52454. var curIndex = index;
  52455. advance(endTagMatch[0].length);
  52456. parseEndTag(endTagMatch[1], curIndex, index);
  52457. continue
  52458. }
  52459. // Start tag:
  52460. var startTagMatch = parseStartTag();
  52461. if (startTagMatch) {
  52462. handleStartTag(startTagMatch);
  52463. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52464. advance(1);
  52465. }
  52466. continue
  52467. }
  52468. }
  52469. var text = (void 0), rest = (void 0), next = (void 0);
  52470. if (textEnd >= 0) {
  52471. rest = html.slice(textEnd);
  52472. while (
  52473. !endTag.test(rest) &&
  52474. !startTagOpen.test(rest) &&
  52475. !comment.test(rest) &&
  52476. !conditionalComment.test(rest)
  52477. ) {
  52478. // < in plain text, be forgiving and treat it as text
  52479. next = rest.indexOf('<', 1);
  52480. if (next < 0) { break }
  52481. textEnd += next;
  52482. rest = html.slice(textEnd);
  52483. }
  52484. text = html.substring(0, textEnd);
  52485. }
  52486. if (textEnd < 0) {
  52487. text = html;
  52488. }
  52489. if (text) {
  52490. advance(text.length);
  52491. }
  52492. if (options.chars && text) {
  52493. options.chars(text, index - text.length, index);
  52494. }
  52495. } else {
  52496. var endTagLength = 0;
  52497. var stackedTag = lastTag.toLowerCase();
  52498. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52499. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52500. endTagLength = endTag.length;
  52501. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52502. text = text
  52503. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52504. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52505. }
  52506. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52507. text = text.slice(1);
  52508. }
  52509. if (options.chars) {
  52510. options.chars(text);
  52511. }
  52512. return ''
  52513. });
  52514. index += html.length - rest$1.length;
  52515. html = rest$1;
  52516. parseEndTag(stackedTag, index - endTagLength, index);
  52517. }
  52518. if (html === last) {
  52519. options.chars && options.chars(html);
  52520. if (!stack.length && options.warn) {
  52521. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  52522. }
  52523. break
  52524. }
  52525. }
  52526. // Clean up any remaining tags
  52527. parseEndTag();
  52528. function advance (n) {
  52529. index += n;
  52530. html = html.substring(n);
  52531. }
  52532. function parseStartTag () {
  52533. var start = html.match(startTagOpen);
  52534. if (start) {
  52535. var match = {
  52536. tagName: start[1],
  52537. attrs: [],
  52538. start: index
  52539. };
  52540. advance(start[0].length);
  52541. var end, attr;
  52542. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  52543. attr.start = index;
  52544. advance(attr[0].length);
  52545. attr.end = index;
  52546. match.attrs.push(attr);
  52547. }
  52548. if (end) {
  52549. match.unarySlash = end[1];
  52550. advance(end[0].length);
  52551. match.end = index;
  52552. return match
  52553. }
  52554. }
  52555. }
  52556. function handleStartTag (match) {
  52557. var tagName = match.tagName;
  52558. var unarySlash = match.unarySlash;
  52559. if (expectHTML) {
  52560. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  52561. parseEndTag(lastTag);
  52562. }
  52563. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  52564. parseEndTag(tagName);
  52565. }
  52566. }
  52567. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  52568. var l = match.attrs.length;
  52569. var attrs = new Array(l);
  52570. for (var i = 0; i < l; i++) {
  52571. var args = match.attrs[i];
  52572. var value = args[3] || args[4] || args[5] || '';
  52573. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  52574. ? options.shouldDecodeNewlinesForHref
  52575. : options.shouldDecodeNewlines;
  52576. attrs[i] = {
  52577. name: args[1],
  52578. value: decodeAttr(value, shouldDecodeNewlines)
  52579. };
  52580. if (options.outputSourceRange) {
  52581. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  52582. attrs[i].end = args.end;
  52583. }
  52584. }
  52585. if (!unary) {
  52586. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  52587. lastTag = tagName;
  52588. }
  52589. if (options.start) {
  52590. options.start(tagName, attrs, unary, match.start, match.end);
  52591. }
  52592. }
  52593. function parseEndTag (tagName, start, end) {
  52594. var pos, lowerCasedTagName;
  52595. if (start == null) { start = index; }
  52596. if (end == null) { end = index; }
  52597. // Find the closest opened tag of the same type
  52598. if (tagName) {
  52599. lowerCasedTagName = tagName.toLowerCase();
  52600. for (pos = stack.length - 1; pos >= 0; pos--) {
  52601. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  52602. break
  52603. }
  52604. }
  52605. } else {
  52606. // If no tag name is provided, clean shop
  52607. pos = 0;
  52608. }
  52609. if (pos >= 0) {
  52610. // Close all the open elements, up the stack
  52611. for (var i = stack.length - 1; i >= pos; i--) {
  52612. if (i > pos || !tagName &&
  52613. options.warn
  52614. ) {
  52615. options.warn(
  52616. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  52617. { start: stack[i].start, end: stack[i].end }
  52618. );
  52619. }
  52620. if (options.end) {
  52621. options.end(stack[i].tag, start, end);
  52622. }
  52623. }
  52624. // Remove the open elements from the stack
  52625. stack.length = pos;
  52626. lastTag = pos && stack[pos - 1].tag;
  52627. } else if (lowerCasedTagName === 'br') {
  52628. if (options.start) {
  52629. options.start(tagName, [], true, start, end);
  52630. }
  52631. } else if (lowerCasedTagName === 'p') {
  52632. if (options.start) {
  52633. options.start(tagName, [], false, start, end);
  52634. }
  52635. if (options.end) {
  52636. options.end(tagName, start, end);
  52637. }
  52638. }
  52639. }
  52640. }
  52641. /* */
  52642. var onRE = /^@|^v-on:/;
  52643. var dirRE = /^v-|^@|^:|^#/;
  52644. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  52645. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  52646. var stripParensRE = /^\(|\)$/g;
  52647. var dynamicArgRE = /^\[.*\]$/;
  52648. var argRE = /:(.*)$/;
  52649. var bindRE = /^:|^\.|^v-bind:/;
  52650. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  52651. var slotRE = /^v-slot(:|$)|^#/;
  52652. var lineBreakRE = /[\r\n]/;
  52653. var whitespaceRE$1 = /\s+/g;
  52654. var invalidAttributeRE = /[\s"'<>\/=]/;
  52655. var decodeHTMLCached = cached(he.decode);
  52656. var emptySlotScopeToken = "_empty_";
  52657. // configurable state
  52658. var warn$2;
  52659. var delimiters;
  52660. var transforms;
  52661. var preTransforms;
  52662. var postTransforms;
  52663. var platformIsPreTag;
  52664. var platformMustUseProp;
  52665. var platformGetTagNamespace;
  52666. var maybeComponent;
  52667. function createASTElement (
  52668. tag,
  52669. attrs,
  52670. parent
  52671. ) {
  52672. return {
  52673. type: 1,
  52674. tag: tag,
  52675. attrsList: attrs,
  52676. attrsMap: makeAttrsMap(attrs),
  52677. rawAttrsMap: {},
  52678. parent: parent,
  52679. children: []
  52680. }
  52681. }
  52682. /**
  52683. * Convert HTML string to AST.
  52684. */
  52685. function parse (
  52686. template,
  52687. options
  52688. ) {
  52689. warn$2 = options.warn || baseWarn;
  52690. platformIsPreTag = options.isPreTag || no;
  52691. platformMustUseProp = options.mustUseProp || no;
  52692. platformGetTagNamespace = options.getTagNamespace || no;
  52693. var isReservedTag = options.isReservedTag || no;
  52694. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  52695. transforms = pluckModuleFunction(options.modules, 'transformNode');
  52696. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  52697. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  52698. delimiters = options.delimiters;
  52699. var stack = [];
  52700. var preserveWhitespace = options.preserveWhitespace !== false;
  52701. var whitespaceOption = options.whitespace;
  52702. var root;
  52703. var currentParent;
  52704. var inVPre = false;
  52705. var inPre = false;
  52706. var warned = false;
  52707. function warnOnce (msg, range) {
  52708. if (!warned) {
  52709. warned = true;
  52710. warn$2(msg, range);
  52711. }
  52712. }
  52713. function closeElement (element) {
  52714. trimEndingWhitespace(element);
  52715. if (!inVPre && !element.processed) {
  52716. element = processElement(element, options);
  52717. }
  52718. // tree management
  52719. if (!stack.length && element !== root) {
  52720. // allow root elements with v-if, v-else-if and v-else
  52721. if (root.if && (element.elseif || element.else)) {
  52722. {
  52723. checkRootConstraints(element);
  52724. }
  52725. addIfCondition(root, {
  52726. exp: element.elseif,
  52727. block: element
  52728. });
  52729. } else {
  52730. warnOnce(
  52731. "Component template should contain exactly one root element. " +
  52732. "If you are using v-if on multiple elements, " +
  52733. "use v-else-if to chain them instead.",
  52734. { start: element.start }
  52735. );
  52736. }
  52737. }
  52738. if (currentParent && !element.forbidden) {
  52739. if (element.elseif || element.else) {
  52740. processIfConditions(element, currentParent);
  52741. } else {
  52742. if (element.slotScope) {
  52743. // scoped slot
  52744. // keep it in the children list so that v-else(-if) conditions can
  52745. // find it as the prev node.
  52746. var name = element.slotTarget || '"default"'
  52747. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  52748. }
  52749. currentParent.children.push(element);
  52750. element.parent = currentParent;
  52751. }
  52752. }
  52753. // final children cleanup
  52754. // filter out scoped slots
  52755. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  52756. // remove trailing whitespace node again
  52757. trimEndingWhitespace(element);
  52758. // check pre state
  52759. if (element.pre) {
  52760. inVPre = false;
  52761. }
  52762. if (platformIsPreTag(element.tag)) {
  52763. inPre = false;
  52764. }
  52765. // apply post-transforms
  52766. for (var i = 0; i < postTransforms.length; i++) {
  52767. postTransforms[i](element, options);
  52768. }
  52769. }
  52770. function trimEndingWhitespace (el) {
  52771. // remove trailing whitespace node
  52772. if (!inPre) {
  52773. var lastNode;
  52774. while (
  52775. (lastNode = el.children[el.children.length - 1]) &&
  52776. lastNode.type === 3 &&
  52777. lastNode.text === ' '
  52778. ) {
  52779. el.children.pop();
  52780. }
  52781. }
  52782. }
  52783. function checkRootConstraints (el) {
  52784. if (el.tag === 'slot' || el.tag === 'template') {
  52785. warnOnce(
  52786. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  52787. 'contain multiple nodes.',
  52788. { start: el.start }
  52789. );
  52790. }
  52791. if (el.attrsMap.hasOwnProperty('v-for')) {
  52792. warnOnce(
  52793. 'Cannot use v-for on stateful component root element because ' +
  52794. 'it renders multiple elements.',
  52795. el.rawAttrsMap['v-for']
  52796. );
  52797. }
  52798. }
  52799. parseHTML(template, {
  52800. warn: warn$2,
  52801. expectHTML: options.expectHTML,
  52802. isUnaryTag: options.isUnaryTag,
  52803. canBeLeftOpenTag: options.canBeLeftOpenTag,
  52804. shouldDecodeNewlines: options.shouldDecodeNewlines,
  52805. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  52806. shouldKeepComment: options.comments,
  52807. outputSourceRange: options.outputSourceRange,
  52808. start: function start (tag, attrs, unary, start$1, end) {
  52809. // check namespace.
  52810. // inherit parent ns if there is one
  52811. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  52812. // handle IE svg bug
  52813. /* istanbul ignore if */
  52814. if (isIE && ns === 'svg') {
  52815. attrs = guardIESVGBug(attrs);
  52816. }
  52817. var element = createASTElement(tag, attrs, currentParent);
  52818. if (ns) {
  52819. element.ns = ns;
  52820. }
  52821. {
  52822. if (options.outputSourceRange) {
  52823. element.start = start$1;
  52824. element.end = end;
  52825. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  52826. cumulated[attr.name] = attr;
  52827. return cumulated
  52828. }, {});
  52829. }
  52830. attrs.forEach(function (attr) {
  52831. if (invalidAttributeRE.test(attr.name)) {
  52832. warn$2(
  52833. "Invalid dynamic argument expression: attribute names cannot contain " +
  52834. "spaces, quotes, <, >, / or =.",
  52835. {
  52836. start: attr.start + attr.name.indexOf("["),
  52837. end: attr.start + attr.name.length
  52838. }
  52839. );
  52840. }
  52841. });
  52842. }
  52843. if (isForbiddenTag(element) && !isServerRendering()) {
  52844. element.forbidden = true;
  52845. warn$2(
  52846. 'Templates should only be responsible for mapping the state to the ' +
  52847. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  52848. "<" + tag + ">" + ', as they will not be parsed.',
  52849. { start: element.start }
  52850. );
  52851. }
  52852. // apply pre-transforms
  52853. for (var i = 0; i < preTransforms.length; i++) {
  52854. element = preTransforms[i](element, options) || element;
  52855. }
  52856. if (!inVPre) {
  52857. processPre(element);
  52858. if (element.pre) {
  52859. inVPre = true;
  52860. }
  52861. }
  52862. if (platformIsPreTag(element.tag)) {
  52863. inPre = true;
  52864. }
  52865. if (inVPre) {
  52866. processRawAttrs(element);
  52867. } else if (!element.processed) {
  52868. // structural directives
  52869. processFor(element);
  52870. processIf(element);
  52871. processOnce(element);
  52872. }
  52873. if (!root) {
  52874. root = element;
  52875. {
  52876. checkRootConstraints(root);
  52877. }
  52878. }
  52879. if (!unary) {
  52880. currentParent = element;
  52881. stack.push(element);
  52882. } else {
  52883. closeElement(element);
  52884. }
  52885. },
  52886. end: function end (tag, start, end$1) {
  52887. var element = stack[stack.length - 1];
  52888. // pop stack
  52889. stack.length -= 1;
  52890. currentParent = stack[stack.length - 1];
  52891. if (options.outputSourceRange) {
  52892. element.end = end$1;
  52893. }
  52894. closeElement(element);
  52895. },
  52896. chars: function chars (text, start, end) {
  52897. if (!currentParent) {
  52898. {
  52899. if (text === template) {
  52900. warnOnce(
  52901. 'Component template requires a root element, rather than just text.',
  52902. { start: start }
  52903. );
  52904. } else if ((text = text.trim())) {
  52905. warnOnce(
  52906. ("text \"" + text + "\" outside root element will be ignored."),
  52907. { start: start }
  52908. );
  52909. }
  52910. }
  52911. return
  52912. }
  52913. // IE textarea placeholder bug
  52914. /* istanbul ignore if */
  52915. if (isIE &&
  52916. currentParent.tag === 'textarea' &&
  52917. currentParent.attrsMap.placeholder === text
  52918. ) {
  52919. return
  52920. }
  52921. var children = currentParent.children;
  52922. if (inPre || text.trim()) {
  52923. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  52924. } else if (!children.length) {
  52925. // remove the whitespace-only node right after an opening tag
  52926. text = '';
  52927. } else if (whitespaceOption) {
  52928. if (whitespaceOption === 'condense') {
  52929. // in condense mode, remove the whitespace node if it contains
  52930. // line break, otherwise condense to a single space
  52931. text = lineBreakRE.test(text) ? '' : ' ';
  52932. } else {
  52933. text = ' ';
  52934. }
  52935. } else {
  52936. text = preserveWhitespace ? ' ' : '';
  52937. }
  52938. if (text) {
  52939. if (!inPre && whitespaceOption === 'condense') {
  52940. // condense consecutive whitespaces into single space
  52941. text = text.replace(whitespaceRE$1, ' ');
  52942. }
  52943. var res;
  52944. var child;
  52945. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  52946. child = {
  52947. type: 2,
  52948. expression: res.expression,
  52949. tokens: res.tokens,
  52950. text: text
  52951. };
  52952. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  52953. child = {
  52954. type: 3,
  52955. text: text
  52956. };
  52957. }
  52958. if (child) {
  52959. if (options.outputSourceRange) {
  52960. child.start = start;
  52961. child.end = end;
  52962. }
  52963. children.push(child);
  52964. }
  52965. }
  52966. },
  52967. comment: function comment (text, start, end) {
  52968. // adding anyting as a sibling to the root node is forbidden
  52969. // comments should still be allowed, but ignored
  52970. if (currentParent) {
  52971. var child = {
  52972. type: 3,
  52973. text: text,
  52974. isComment: true
  52975. };
  52976. if (options.outputSourceRange) {
  52977. child.start = start;
  52978. child.end = end;
  52979. }
  52980. currentParent.children.push(child);
  52981. }
  52982. }
  52983. });
  52984. return root
  52985. }
  52986. function processPre (el) {
  52987. if (getAndRemoveAttr(el, 'v-pre') != null) {
  52988. el.pre = true;
  52989. }
  52990. }
  52991. function processRawAttrs (el) {
  52992. var list = el.attrsList;
  52993. var len = list.length;
  52994. if (len) {
  52995. var attrs = el.attrs = new Array(len);
  52996. for (var i = 0; i < len; i++) {
  52997. attrs[i] = {
  52998. name: list[i].name,
  52999. value: JSON.stringify(list[i].value)
  53000. };
  53001. if (list[i].start != null) {
  53002. attrs[i].start = list[i].start;
  53003. attrs[i].end = list[i].end;
  53004. }
  53005. }
  53006. } else if (!el.pre) {
  53007. // non root node in pre blocks with no attributes
  53008. el.plain = true;
  53009. }
  53010. }
  53011. function processElement (
  53012. element,
  53013. options
  53014. ) {
  53015. processKey(element);
  53016. // determine whether this is a plain element after
  53017. // removing structural attributes
  53018. element.plain = (
  53019. !element.key &&
  53020. !element.scopedSlots &&
  53021. !element.attrsList.length
  53022. );
  53023. processRef(element);
  53024. processSlotContent(element);
  53025. processSlotOutlet(element);
  53026. processComponent(element);
  53027. for (var i = 0; i < transforms.length; i++) {
  53028. element = transforms[i](element, options) || element;
  53029. }
  53030. processAttrs(element);
  53031. return element
  53032. }
  53033. function processKey (el) {
  53034. var exp = getBindingAttr(el, 'key');
  53035. if (exp) {
  53036. {
  53037. if (el.tag === 'template') {
  53038. warn$2(
  53039. "<template> cannot be keyed. Place the key on real elements instead.",
  53040. getRawBindingAttr(el, 'key')
  53041. );
  53042. }
  53043. if (el.for) {
  53044. var iterator = el.iterator2 || el.iterator1;
  53045. var parent = el.parent;
  53046. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53047. warn$2(
  53048. "Do not use v-for index as key on <transition-group> children, " +
  53049. "this is the same as not using keys.",
  53050. getRawBindingAttr(el, 'key'),
  53051. true /* tip */
  53052. );
  53053. }
  53054. }
  53055. }
  53056. el.key = exp;
  53057. }
  53058. }
  53059. function processRef (el) {
  53060. var ref = getBindingAttr(el, 'ref');
  53061. if (ref) {
  53062. el.ref = ref;
  53063. el.refInFor = checkInFor(el);
  53064. }
  53065. }
  53066. function processFor (el) {
  53067. var exp;
  53068. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53069. var res = parseFor(exp);
  53070. if (res) {
  53071. extend(el, res);
  53072. } else {
  53073. warn$2(
  53074. ("Invalid v-for expression: " + exp),
  53075. el.rawAttrsMap['v-for']
  53076. );
  53077. }
  53078. }
  53079. }
  53080. function parseFor (exp) {
  53081. var inMatch = exp.match(forAliasRE);
  53082. if (!inMatch) { return }
  53083. var res = {};
  53084. res.for = inMatch[2].trim();
  53085. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53086. var iteratorMatch = alias.match(forIteratorRE);
  53087. if (iteratorMatch) {
  53088. res.alias = alias.replace(forIteratorRE, '').trim();
  53089. res.iterator1 = iteratorMatch[1].trim();
  53090. if (iteratorMatch[2]) {
  53091. res.iterator2 = iteratorMatch[2].trim();
  53092. }
  53093. } else {
  53094. res.alias = alias;
  53095. }
  53096. return res
  53097. }
  53098. function processIf (el) {
  53099. var exp = getAndRemoveAttr(el, 'v-if');
  53100. if (exp) {
  53101. el.if = exp;
  53102. addIfCondition(el, {
  53103. exp: exp,
  53104. block: el
  53105. });
  53106. } else {
  53107. if (getAndRemoveAttr(el, 'v-else') != null) {
  53108. el.else = true;
  53109. }
  53110. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53111. if (elseif) {
  53112. el.elseif = elseif;
  53113. }
  53114. }
  53115. }
  53116. function processIfConditions (el, parent) {
  53117. var prev = findPrevElement(parent.children);
  53118. if (prev && prev.if) {
  53119. addIfCondition(prev, {
  53120. exp: el.elseif,
  53121. block: el
  53122. });
  53123. } else {
  53124. warn$2(
  53125. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53126. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53127. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53128. );
  53129. }
  53130. }
  53131. function findPrevElement (children) {
  53132. var i = children.length;
  53133. while (i--) {
  53134. if (children[i].type === 1) {
  53135. return children[i]
  53136. } else {
  53137. if (children[i].text !== ' ') {
  53138. warn$2(
  53139. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53140. "will be ignored.",
  53141. children[i]
  53142. );
  53143. }
  53144. children.pop();
  53145. }
  53146. }
  53147. }
  53148. function addIfCondition (el, condition) {
  53149. if (!el.ifConditions) {
  53150. el.ifConditions = [];
  53151. }
  53152. el.ifConditions.push(condition);
  53153. }
  53154. function processOnce (el) {
  53155. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53156. if (once$$1 != null) {
  53157. el.once = true;
  53158. }
  53159. }
  53160. // handle content being passed to a component as slot,
  53161. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53162. function processSlotContent (el) {
  53163. var slotScope;
  53164. if (el.tag === 'template') {
  53165. slotScope = getAndRemoveAttr(el, 'scope');
  53166. /* istanbul ignore if */
  53167. if (slotScope) {
  53168. warn$2(
  53169. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53170. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53171. "can also be used on plain elements in addition to <template> to " +
  53172. "denote scoped slots.",
  53173. el.rawAttrsMap['scope'],
  53174. true
  53175. );
  53176. }
  53177. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53178. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53179. /* istanbul ignore if */
  53180. if (el.attrsMap['v-for']) {
  53181. warn$2(
  53182. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53183. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53184. "scoped slot to make it clearer.",
  53185. el.rawAttrsMap['slot-scope'],
  53186. true
  53187. );
  53188. }
  53189. el.slotScope = slotScope;
  53190. }
  53191. // slot="xxx"
  53192. var slotTarget = getBindingAttr(el, 'slot');
  53193. if (slotTarget) {
  53194. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53195. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53196. // preserve slot as an attribute for native shadow DOM compat
  53197. // only for non-scoped slots.
  53198. if (el.tag !== 'template' && !el.slotScope) {
  53199. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53200. }
  53201. }
  53202. // 2.6 v-slot syntax
  53203. {
  53204. if (el.tag === 'template') {
  53205. // v-slot on <template>
  53206. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53207. if (slotBinding) {
  53208. {
  53209. if (el.slotTarget || el.slotScope) {
  53210. warn$2(
  53211. "Unexpected mixed usage of different slot syntaxes.",
  53212. el
  53213. );
  53214. }
  53215. if (el.parent && !maybeComponent(el.parent)) {
  53216. warn$2(
  53217. "<template v-slot> can only appear at the root level inside " +
  53218. "the receiving component",
  53219. el
  53220. );
  53221. }
  53222. }
  53223. var ref = getSlotName(slotBinding);
  53224. var name = ref.name;
  53225. var dynamic = ref.dynamic;
  53226. el.slotTarget = name;
  53227. el.slotTargetDynamic = dynamic;
  53228. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53229. }
  53230. } else {
  53231. // v-slot on component, denotes default slot
  53232. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53233. if (slotBinding$1) {
  53234. {
  53235. if (!maybeComponent(el)) {
  53236. warn$2(
  53237. "v-slot can only be used on components or <template>.",
  53238. slotBinding$1
  53239. );
  53240. }
  53241. if (el.slotScope || el.slotTarget) {
  53242. warn$2(
  53243. "Unexpected mixed usage of different slot syntaxes.",
  53244. el
  53245. );
  53246. }
  53247. if (el.scopedSlots) {
  53248. warn$2(
  53249. "To avoid scope ambiguity, the default slot should also use " +
  53250. "<template> syntax when there are other named slots.",
  53251. slotBinding$1
  53252. );
  53253. }
  53254. }
  53255. // add the component's children to its default slot
  53256. var slots = el.scopedSlots || (el.scopedSlots = {});
  53257. var ref$1 = getSlotName(slotBinding$1);
  53258. var name$1 = ref$1.name;
  53259. var dynamic$1 = ref$1.dynamic;
  53260. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53261. slotContainer.slotTarget = name$1;
  53262. slotContainer.slotTargetDynamic = dynamic$1;
  53263. slotContainer.children = el.children.filter(function (c) {
  53264. if (!c.slotScope) {
  53265. c.parent = slotContainer;
  53266. return true
  53267. }
  53268. });
  53269. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53270. // remove children as they are returned from scopedSlots now
  53271. el.children = [];
  53272. // mark el non-plain so data gets generated
  53273. el.plain = false;
  53274. }
  53275. }
  53276. }
  53277. }
  53278. function getSlotName (binding) {
  53279. var name = binding.name.replace(slotRE, '');
  53280. if (!name) {
  53281. if (binding.name[0] !== '#') {
  53282. name = 'default';
  53283. } else {
  53284. warn$2(
  53285. "v-slot shorthand syntax requires a slot name.",
  53286. binding
  53287. );
  53288. }
  53289. }
  53290. return dynamicArgRE.test(name)
  53291. // dynamic [name]
  53292. ? { name: name.slice(1, -1), dynamic: true }
  53293. // static name
  53294. : { name: ("\"" + name + "\""), dynamic: false }
  53295. }
  53296. // handle <slot/> outlets
  53297. function processSlotOutlet (el) {
  53298. if (el.tag === 'slot') {
  53299. el.slotName = getBindingAttr(el, 'name');
  53300. if (el.key) {
  53301. warn$2(
  53302. "`key` does not work on <slot> because slots are abstract outlets " +
  53303. "and can possibly expand into multiple elements. " +
  53304. "Use the key on a wrapping element instead.",
  53305. getRawBindingAttr(el, 'key')
  53306. );
  53307. }
  53308. }
  53309. }
  53310. function processComponent (el) {
  53311. var binding;
  53312. if ((binding = getBindingAttr(el, 'is'))) {
  53313. el.component = binding;
  53314. }
  53315. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53316. el.inlineTemplate = true;
  53317. }
  53318. }
  53319. function processAttrs (el) {
  53320. var list = el.attrsList;
  53321. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53322. for (i = 0, l = list.length; i < l; i++) {
  53323. name = rawName = list[i].name;
  53324. value = list[i].value;
  53325. if (dirRE.test(name)) {
  53326. // mark element as dynamic
  53327. el.hasBindings = true;
  53328. // modifiers
  53329. modifiers = parseModifiers(name.replace(dirRE, ''));
  53330. // support .foo shorthand syntax for the .prop modifier
  53331. if (modifiers) {
  53332. name = name.replace(modifierRE, '');
  53333. }
  53334. if (bindRE.test(name)) { // v-bind
  53335. name = name.replace(bindRE, '');
  53336. value = parseFilters(value);
  53337. isDynamic = dynamicArgRE.test(name);
  53338. if (isDynamic) {
  53339. name = name.slice(1, -1);
  53340. }
  53341. if (
  53342. value.trim().length === 0
  53343. ) {
  53344. warn$2(
  53345. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53346. );
  53347. }
  53348. if (modifiers) {
  53349. if (modifiers.prop && !isDynamic) {
  53350. name = camelize(name);
  53351. if (name === 'innerHtml') { name = 'innerHTML'; }
  53352. }
  53353. if (modifiers.camel && !isDynamic) {
  53354. name = camelize(name);
  53355. }
  53356. if (modifiers.sync) {
  53357. syncGen = genAssignmentCode(value, "$event");
  53358. if (!isDynamic) {
  53359. addHandler(
  53360. el,
  53361. ("update:" + (camelize(name))),
  53362. syncGen,
  53363. null,
  53364. false,
  53365. warn$2,
  53366. list[i]
  53367. );
  53368. if (hyphenate(name) !== camelize(name)) {
  53369. addHandler(
  53370. el,
  53371. ("update:" + (hyphenate(name))),
  53372. syncGen,
  53373. null,
  53374. false,
  53375. warn$2,
  53376. list[i]
  53377. );
  53378. }
  53379. } else {
  53380. // handler w/ dynamic event name
  53381. addHandler(
  53382. el,
  53383. ("\"update:\"+(" + name + ")"),
  53384. syncGen,
  53385. null,
  53386. false,
  53387. warn$2,
  53388. list[i],
  53389. true // dynamic
  53390. );
  53391. }
  53392. }
  53393. }
  53394. if ((modifiers && modifiers.prop) || (
  53395. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53396. )) {
  53397. addProp(el, name, value, list[i], isDynamic);
  53398. } else {
  53399. addAttr(el, name, value, list[i], isDynamic);
  53400. }
  53401. } else if (onRE.test(name)) { // v-on
  53402. name = name.replace(onRE, '');
  53403. isDynamic = dynamicArgRE.test(name);
  53404. if (isDynamic) {
  53405. name = name.slice(1, -1);
  53406. }
  53407. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53408. } else { // normal directives
  53409. name = name.replace(dirRE, '');
  53410. // parse arg
  53411. var argMatch = name.match(argRE);
  53412. var arg = argMatch && argMatch[1];
  53413. isDynamic = false;
  53414. if (arg) {
  53415. name = name.slice(0, -(arg.length + 1));
  53416. if (dynamicArgRE.test(arg)) {
  53417. arg = arg.slice(1, -1);
  53418. isDynamic = true;
  53419. }
  53420. }
  53421. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53422. if (name === 'model') {
  53423. checkForAliasModel(el, value);
  53424. }
  53425. }
  53426. } else {
  53427. // literal attribute
  53428. {
  53429. var res = parseText(value, delimiters);
  53430. if (res) {
  53431. warn$2(
  53432. name + "=\"" + value + "\": " +
  53433. 'Interpolation inside attributes has been removed. ' +
  53434. 'Use v-bind or the colon shorthand instead. For example, ' +
  53435. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53436. list[i]
  53437. );
  53438. }
  53439. }
  53440. addAttr(el, name, JSON.stringify(value), list[i]);
  53441. // #6887 firefox doesn't update muted state if set via attribute
  53442. // even immediately after element creation
  53443. if (!el.component &&
  53444. name === 'muted' &&
  53445. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53446. addProp(el, name, 'true', list[i]);
  53447. }
  53448. }
  53449. }
  53450. }
  53451. function checkInFor (el) {
  53452. var parent = el;
  53453. while (parent) {
  53454. if (parent.for !== undefined) {
  53455. return true
  53456. }
  53457. parent = parent.parent;
  53458. }
  53459. return false
  53460. }
  53461. function parseModifiers (name) {
  53462. var match = name.match(modifierRE);
  53463. if (match) {
  53464. var ret = {};
  53465. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53466. return ret
  53467. }
  53468. }
  53469. function makeAttrsMap (attrs) {
  53470. var map = {};
  53471. for (var i = 0, l = attrs.length; i < l; i++) {
  53472. if (
  53473. map[attrs[i].name] && !isIE && !isEdge
  53474. ) {
  53475. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53476. }
  53477. map[attrs[i].name] = attrs[i].value;
  53478. }
  53479. return map
  53480. }
  53481. // for script (e.g. type="x/template") or style, do not decode content
  53482. function isTextTag (el) {
  53483. return el.tag === 'script' || el.tag === 'style'
  53484. }
  53485. function isForbiddenTag (el) {
  53486. return (
  53487. el.tag === 'style' ||
  53488. (el.tag === 'script' && (
  53489. !el.attrsMap.type ||
  53490. el.attrsMap.type === 'text/javascript'
  53491. ))
  53492. )
  53493. }
  53494. var ieNSBug = /^xmlns:NS\d+/;
  53495. var ieNSPrefix = /^NS\d+:/;
  53496. /* istanbul ignore next */
  53497. function guardIESVGBug (attrs) {
  53498. var res = [];
  53499. for (var i = 0; i < attrs.length; i++) {
  53500. var attr = attrs[i];
  53501. if (!ieNSBug.test(attr.name)) {
  53502. attr.name = attr.name.replace(ieNSPrefix, '');
  53503. res.push(attr);
  53504. }
  53505. }
  53506. return res
  53507. }
  53508. function checkForAliasModel (el, value) {
  53509. var _el = el;
  53510. while (_el) {
  53511. if (_el.for && _el.alias === value) {
  53512. warn$2(
  53513. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53514. "You are binding v-model directly to a v-for iteration alias. " +
  53515. "This will not be able to modify the v-for source array because " +
  53516. "writing to the alias is like modifying a function local variable. " +
  53517. "Consider using an array of objects and use v-model on an object property instead.",
  53518. el.rawAttrsMap['v-model']
  53519. );
  53520. }
  53521. _el = _el.parent;
  53522. }
  53523. }
  53524. /* */
  53525. function preTransformNode (el, options) {
  53526. if (el.tag === 'input') {
  53527. var map = el.attrsMap;
  53528. if (!map['v-model']) {
  53529. return
  53530. }
  53531. var typeBinding;
  53532. if (map[':type'] || map['v-bind:type']) {
  53533. typeBinding = getBindingAttr(el, 'type');
  53534. }
  53535. if (!map.type && !typeBinding && map['v-bind']) {
  53536. typeBinding = "(" + (map['v-bind']) + ").type";
  53537. }
  53538. if (typeBinding) {
  53539. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  53540. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  53541. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  53542. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  53543. // 1. checkbox
  53544. var branch0 = cloneASTElement(el);
  53545. // process for on the main node
  53546. processFor(branch0);
  53547. addRawAttr(branch0, 'type', 'checkbox');
  53548. processElement(branch0, options);
  53549. branch0.processed = true; // prevent it from double-processed
  53550. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  53551. addIfCondition(branch0, {
  53552. exp: branch0.if,
  53553. block: branch0
  53554. });
  53555. // 2. add radio else-if condition
  53556. var branch1 = cloneASTElement(el);
  53557. getAndRemoveAttr(branch1, 'v-for', true);
  53558. addRawAttr(branch1, 'type', 'radio');
  53559. processElement(branch1, options);
  53560. addIfCondition(branch0, {
  53561. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  53562. block: branch1
  53563. });
  53564. // 3. other
  53565. var branch2 = cloneASTElement(el);
  53566. getAndRemoveAttr(branch2, 'v-for', true);
  53567. addRawAttr(branch2, ':type', typeBinding);
  53568. processElement(branch2, options);
  53569. addIfCondition(branch0, {
  53570. exp: ifCondition,
  53571. block: branch2
  53572. });
  53573. if (hasElse) {
  53574. branch0.else = true;
  53575. } else if (elseIfCondition) {
  53576. branch0.elseif = elseIfCondition;
  53577. }
  53578. return branch0
  53579. }
  53580. }
  53581. }
  53582. function cloneASTElement (el) {
  53583. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  53584. }
  53585. var model$1 = {
  53586. preTransformNode: preTransformNode
  53587. };
  53588. var modules$1 = [
  53589. klass$1,
  53590. style$1,
  53591. model$1
  53592. ];
  53593. /* */
  53594. function text (el, dir) {
  53595. if (dir.value) {
  53596. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  53597. }
  53598. }
  53599. /* */
  53600. function html (el, dir) {
  53601. if (dir.value) {
  53602. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  53603. }
  53604. }
  53605. var directives$1 = {
  53606. model: model,
  53607. text: text,
  53608. html: html
  53609. };
  53610. /* */
  53611. var baseOptions = {
  53612. expectHTML: true,
  53613. modules: modules$1,
  53614. directives: directives$1,
  53615. isPreTag: isPreTag,
  53616. isUnaryTag: isUnaryTag,
  53617. mustUseProp: mustUseProp,
  53618. canBeLeftOpenTag: canBeLeftOpenTag,
  53619. isReservedTag: isReservedTag,
  53620. getTagNamespace: getTagNamespace,
  53621. staticKeys: genStaticKeys(modules$1)
  53622. };
  53623. /* */
  53624. var isStaticKey;
  53625. var isPlatformReservedTag;
  53626. var genStaticKeysCached = cached(genStaticKeys$1);
  53627. /**
  53628. * Goal of the optimizer: walk the generated template AST tree
  53629. * and detect sub-trees that are purely static, i.e. parts of
  53630. * the DOM that never needs to change.
  53631. *
  53632. * Once we detect these sub-trees, we can:
  53633. *
  53634. * 1. Hoist them into constants, so that we no longer need to
  53635. * create fresh nodes for them on each re-render;
  53636. * 2. Completely skip them in the patching process.
  53637. */
  53638. function optimize (root, options) {
  53639. if (!root) { return }
  53640. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  53641. isPlatformReservedTag = options.isReservedTag || no;
  53642. // first pass: mark all non-static nodes.
  53643. markStatic$1(root);
  53644. // second pass: mark static roots.
  53645. markStaticRoots(root, false);
  53646. }
  53647. function genStaticKeys$1 (keys) {
  53648. return makeMap(
  53649. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  53650. (keys ? ',' + keys : '')
  53651. )
  53652. }
  53653. function markStatic$1 (node) {
  53654. node.static = isStatic(node);
  53655. if (node.type === 1) {
  53656. // do not make component slot content static. this avoids
  53657. // 1. components not able to mutate slot nodes
  53658. // 2. static slot content fails for hot-reloading
  53659. if (
  53660. !isPlatformReservedTag(node.tag) &&
  53661. node.tag !== 'slot' &&
  53662. node.attrsMap['inline-template'] == null
  53663. ) {
  53664. return
  53665. }
  53666. for (var i = 0, l = node.children.length; i < l; i++) {
  53667. var child = node.children[i];
  53668. markStatic$1(child);
  53669. if (!child.static) {
  53670. node.static = false;
  53671. }
  53672. }
  53673. if (node.ifConditions) {
  53674. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53675. var block = node.ifConditions[i$1].block;
  53676. markStatic$1(block);
  53677. if (!block.static) {
  53678. node.static = false;
  53679. }
  53680. }
  53681. }
  53682. }
  53683. }
  53684. function markStaticRoots (node, isInFor) {
  53685. if (node.type === 1) {
  53686. if (node.static || node.once) {
  53687. node.staticInFor = isInFor;
  53688. }
  53689. // For a node to qualify as a static root, it should have children that
  53690. // are not just static text. Otherwise the cost of hoisting out will
  53691. // outweigh the benefits and it's better off to just always render it fresh.
  53692. if (node.static && node.children.length && !(
  53693. node.children.length === 1 &&
  53694. node.children[0].type === 3
  53695. )) {
  53696. node.staticRoot = true;
  53697. return
  53698. } else {
  53699. node.staticRoot = false;
  53700. }
  53701. if (node.children) {
  53702. for (var i = 0, l = node.children.length; i < l; i++) {
  53703. markStaticRoots(node.children[i], isInFor || !!node.for);
  53704. }
  53705. }
  53706. if (node.ifConditions) {
  53707. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53708. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  53709. }
  53710. }
  53711. }
  53712. }
  53713. function isStatic (node) {
  53714. if (node.type === 2) { // expression
  53715. return false
  53716. }
  53717. if (node.type === 3) { // text
  53718. return true
  53719. }
  53720. return !!(node.pre || (
  53721. !node.hasBindings && // no dynamic bindings
  53722. !node.if && !node.for && // not v-if or v-for or v-else
  53723. !isBuiltInTag(node.tag) && // not a built-in
  53724. isPlatformReservedTag(node.tag) && // not a component
  53725. !isDirectChildOfTemplateFor(node) &&
  53726. Object.keys(node).every(isStaticKey)
  53727. ))
  53728. }
  53729. function isDirectChildOfTemplateFor (node) {
  53730. while (node.parent) {
  53731. node = node.parent;
  53732. if (node.tag !== 'template') {
  53733. return false
  53734. }
  53735. if (node.for) {
  53736. return true
  53737. }
  53738. }
  53739. return false
  53740. }
  53741. /* */
  53742. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  53743. var fnInvokeRE = /\([^)]*?\);*$/;
  53744. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  53745. // KeyboardEvent.keyCode aliases
  53746. var keyCodes = {
  53747. esc: 27,
  53748. tab: 9,
  53749. enter: 13,
  53750. space: 32,
  53751. up: 38,
  53752. left: 37,
  53753. right: 39,
  53754. down: 40,
  53755. 'delete': [8, 46]
  53756. };
  53757. // KeyboardEvent.key aliases
  53758. var keyNames = {
  53759. // #7880: IE11 and Edge use `Esc` for Escape key name.
  53760. esc: ['Esc', 'Escape'],
  53761. tab: 'Tab',
  53762. enter: 'Enter',
  53763. // #9112: IE11 uses `Spacebar` for Space key name.
  53764. space: [' ', 'Spacebar'],
  53765. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  53766. up: ['Up', 'ArrowUp'],
  53767. left: ['Left', 'ArrowLeft'],
  53768. right: ['Right', 'ArrowRight'],
  53769. down: ['Down', 'ArrowDown'],
  53770. // #9112: IE11 uses `Del` for Delete key name.
  53771. 'delete': ['Backspace', 'Delete', 'Del']
  53772. };
  53773. // #4868: modifiers that prevent the execution of the listener
  53774. // need to explicitly return null so that we can determine whether to remove
  53775. // the listener for .once
  53776. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  53777. var modifierCode = {
  53778. stop: '$event.stopPropagation();',
  53779. prevent: '$event.preventDefault();',
  53780. self: genGuard("$event.target !== $event.currentTarget"),
  53781. ctrl: genGuard("!$event.ctrlKey"),
  53782. shift: genGuard("!$event.shiftKey"),
  53783. alt: genGuard("!$event.altKey"),
  53784. meta: genGuard("!$event.metaKey"),
  53785. left: genGuard("'button' in $event && $event.button !== 0"),
  53786. middle: genGuard("'button' in $event && $event.button !== 1"),
  53787. right: genGuard("'button' in $event && $event.button !== 2")
  53788. };
  53789. function genHandlers (
  53790. events,
  53791. isNative
  53792. ) {
  53793. var prefix = isNative ? 'nativeOn:' : 'on:';
  53794. var staticHandlers = "";
  53795. var dynamicHandlers = "";
  53796. for (var name in events) {
  53797. var handlerCode = genHandler(events[name]);
  53798. if (events[name] && events[name].dynamic) {
  53799. dynamicHandlers += name + "," + handlerCode + ",";
  53800. } else {
  53801. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  53802. }
  53803. }
  53804. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  53805. if (dynamicHandlers) {
  53806. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  53807. } else {
  53808. return prefix + staticHandlers
  53809. }
  53810. }
  53811. function genHandler (handler) {
  53812. if (!handler) {
  53813. return 'function(){}'
  53814. }
  53815. if (Array.isArray(handler)) {
  53816. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  53817. }
  53818. var isMethodPath = simplePathRE.test(handler.value);
  53819. var isFunctionExpression = fnExpRE.test(handler.value);
  53820. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  53821. if (!handler.modifiers) {
  53822. if (isMethodPath || isFunctionExpression) {
  53823. return handler.value
  53824. }
  53825. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  53826. } else {
  53827. var code = '';
  53828. var genModifierCode = '';
  53829. var keys = [];
  53830. for (var key in handler.modifiers) {
  53831. if (modifierCode[key]) {
  53832. genModifierCode += modifierCode[key];
  53833. // left/right
  53834. if (keyCodes[key]) {
  53835. keys.push(key);
  53836. }
  53837. } else if (key === 'exact') {
  53838. var modifiers = (handler.modifiers);
  53839. genModifierCode += genGuard(
  53840. ['ctrl', 'shift', 'alt', 'meta']
  53841. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  53842. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  53843. .join('||')
  53844. );
  53845. } else {
  53846. keys.push(key);
  53847. }
  53848. }
  53849. if (keys.length) {
  53850. code += genKeyFilter(keys);
  53851. }
  53852. // Make sure modifiers like prevent and stop get executed after key filtering
  53853. if (genModifierCode) {
  53854. code += genModifierCode;
  53855. }
  53856. var handlerCode = isMethodPath
  53857. ? ("return " + (handler.value) + "($event)")
  53858. : isFunctionExpression
  53859. ? ("return (" + (handler.value) + ")($event)")
  53860. : isFunctionInvocation
  53861. ? ("return " + (handler.value))
  53862. : handler.value;
  53863. return ("function($event){" + code + handlerCode + "}")
  53864. }
  53865. }
  53866. function genKeyFilter (keys) {
  53867. return (
  53868. // make sure the key filters only apply to KeyboardEvents
  53869. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  53870. // key events that do not have keyCode property...
  53871. "if(!$event.type.indexOf('key')&&" +
  53872. (keys.map(genFilterCode).join('&&')) + ")return null;"
  53873. )
  53874. }
  53875. function genFilterCode (key) {
  53876. var keyVal = parseInt(key, 10);
  53877. if (keyVal) {
  53878. return ("$event.keyCode!==" + keyVal)
  53879. }
  53880. var keyCode = keyCodes[key];
  53881. var keyName = keyNames[key];
  53882. return (
  53883. "_k($event.keyCode," +
  53884. (JSON.stringify(key)) + "," +
  53885. (JSON.stringify(keyCode)) + "," +
  53886. "$event.key," +
  53887. "" + (JSON.stringify(keyName)) +
  53888. ")"
  53889. )
  53890. }
  53891. /* */
  53892. function on (el, dir) {
  53893. if (dir.modifiers) {
  53894. warn("v-on without argument does not support modifiers.");
  53895. }
  53896. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  53897. }
  53898. /* */
  53899. function bind$1 (el, dir) {
  53900. el.wrapData = function (code) {
  53901. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  53902. };
  53903. }
  53904. /* */
  53905. var baseDirectives = {
  53906. on: on,
  53907. bind: bind$1,
  53908. cloak: noop
  53909. };
  53910. /* */
  53911. var CodegenState = function CodegenState (options) {
  53912. this.options = options;
  53913. this.warn = options.warn || baseWarn;
  53914. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  53915. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  53916. this.directives = extend(extend({}, baseDirectives), options.directives);
  53917. var isReservedTag = options.isReservedTag || no;
  53918. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53919. this.onceId = 0;
  53920. this.staticRenderFns = [];
  53921. this.pre = false;
  53922. };
  53923. function generate (
  53924. ast,
  53925. options
  53926. ) {
  53927. var state = new CodegenState(options);
  53928. var code = ast ? genElement(ast, state) : '_c("div")';
  53929. return {
  53930. render: ("with(this){return " + code + "}"),
  53931. staticRenderFns: state.staticRenderFns
  53932. }
  53933. }
  53934. function genElement (el, state) {
  53935. if (el.parent) {
  53936. el.pre = el.pre || el.parent.pre;
  53937. }
  53938. if (el.staticRoot && !el.staticProcessed) {
  53939. return genStatic(el, state)
  53940. } else if (el.once && !el.onceProcessed) {
  53941. return genOnce(el, state)
  53942. } else if (el.for && !el.forProcessed) {
  53943. return genFor(el, state)
  53944. } else if (el.if && !el.ifProcessed) {
  53945. return genIf(el, state)
  53946. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  53947. return genChildren(el, state) || 'void 0'
  53948. } else if (el.tag === 'slot') {
  53949. return genSlot(el, state)
  53950. } else {
  53951. // component or element
  53952. var code;
  53953. if (el.component) {
  53954. code = genComponent(el.component, el, state);
  53955. } else {
  53956. var data;
  53957. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  53958. data = genData$2(el, state);
  53959. }
  53960. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  53961. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  53962. }
  53963. // module transforms
  53964. for (var i = 0; i < state.transforms.length; i++) {
  53965. code = state.transforms[i](el, code);
  53966. }
  53967. return code
  53968. }
  53969. }
  53970. // hoist static sub-trees out
  53971. function genStatic (el, state) {
  53972. el.staticProcessed = true;
  53973. // Some elements (templates) need to behave differently inside of a v-pre
  53974. // node. All pre nodes are static roots, so we can use this as a location to
  53975. // wrap a state change and reset it upon exiting the pre node.
  53976. var originalPreState = state.pre;
  53977. if (el.pre) {
  53978. state.pre = el.pre;
  53979. }
  53980. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  53981. state.pre = originalPreState;
  53982. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  53983. }
  53984. // v-once
  53985. function genOnce (el, state) {
  53986. el.onceProcessed = true;
  53987. if (el.if && !el.ifProcessed) {
  53988. return genIf(el, state)
  53989. } else if (el.staticInFor) {
  53990. var key = '';
  53991. var parent = el.parent;
  53992. while (parent) {
  53993. if (parent.for) {
  53994. key = parent.key;
  53995. break
  53996. }
  53997. parent = parent.parent;
  53998. }
  53999. if (!key) {
  54000. state.warn(
  54001. "v-once can only be used inside v-for that is keyed. ",
  54002. el.rawAttrsMap['v-once']
  54003. );
  54004. return genElement(el, state)
  54005. }
  54006. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54007. } else {
  54008. return genStatic(el, state)
  54009. }
  54010. }
  54011. function genIf (
  54012. el,
  54013. state,
  54014. altGen,
  54015. altEmpty
  54016. ) {
  54017. el.ifProcessed = true; // avoid recursion
  54018. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54019. }
  54020. function genIfConditions (
  54021. conditions,
  54022. state,
  54023. altGen,
  54024. altEmpty
  54025. ) {
  54026. if (!conditions.length) {
  54027. return altEmpty || '_e()'
  54028. }
  54029. var condition = conditions.shift();
  54030. if (condition.exp) {
  54031. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54032. } else {
  54033. return ("" + (genTernaryExp(condition.block)))
  54034. }
  54035. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54036. function genTernaryExp (el) {
  54037. return altGen
  54038. ? altGen(el, state)
  54039. : el.once
  54040. ? genOnce(el, state)
  54041. : genElement(el, state)
  54042. }
  54043. }
  54044. function genFor (
  54045. el,
  54046. state,
  54047. altGen,
  54048. altHelper
  54049. ) {
  54050. var exp = el.for;
  54051. var alias = el.alias;
  54052. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54053. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54054. if (state.maybeComponent(el) &&
  54055. el.tag !== 'slot' &&
  54056. el.tag !== 'template' &&
  54057. !el.key
  54058. ) {
  54059. state.warn(
  54060. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54061. "v-for should have explicit keys. " +
  54062. "See https://vuejs.org/guide/list.html#key for more info.",
  54063. el.rawAttrsMap['v-for'],
  54064. true /* tip */
  54065. );
  54066. }
  54067. el.forProcessed = true; // avoid recursion
  54068. return (altHelper || '_l') + "((" + exp + ")," +
  54069. "function(" + alias + iterator1 + iterator2 + "){" +
  54070. "return " + ((altGen || genElement)(el, state)) +
  54071. '})'
  54072. }
  54073. function genData$2 (el, state) {
  54074. var data = '{';
  54075. // directives first.
  54076. // directives may mutate the el's other properties before they are generated.
  54077. var dirs = genDirectives(el, state);
  54078. if (dirs) { data += dirs + ','; }
  54079. // key
  54080. if (el.key) {
  54081. data += "key:" + (el.key) + ",";
  54082. }
  54083. // ref
  54084. if (el.ref) {
  54085. data += "ref:" + (el.ref) + ",";
  54086. }
  54087. if (el.refInFor) {
  54088. data += "refInFor:true,";
  54089. }
  54090. // pre
  54091. if (el.pre) {
  54092. data += "pre:true,";
  54093. }
  54094. // record original tag name for components using "is" attribute
  54095. if (el.component) {
  54096. data += "tag:\"" + (el.tag) + "\",";
  54097. }
  54098. // module data generation functions
  54099. for (var i = 0; i < state.dataGenFns.length; i++) {
  54100. data += state.dataGenFns[i](el);
  54101. }
  54102. // attributes
  54103. if (el.attrs) {
  54104. data += "attrs:" + (genProps(el.attrs)) + ",";
  54105. }
  54106. // DOM props
  54107. if (el.props) {
  54108. data += "domProps:" + (genProps(el.props)) + ",";
  54109. }
  54110. // event handlers
  54111. if (el.events) {
  54112. data += (genHandlers(el.events, false)) + ",";
  54113. }
  54114. if (el.nativeEvents) {
  54115. data += (genHandlers(el.nativeEvents, true)) + ",";
  54116. }
  54117. // slot target
  54118. // only for non-scoped slots
  54119. if (el.slotTarget && !el.slotScope) {
  54120. data += "slot:" + (el.slotTarget) + ",";
  54121. }
  54122. // scoped slots
  54123. if (el.scopedSlots) {
  54124. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54125. }
  54126. // component v-model
  54127. if (el.model) {
  54128. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54129. }
  54130. // inline-template
  54131. if (el.inlineTemplate) {
  54132. var inlineTemplate = genInlineTemplate(el, state);
  54133. if (inlineTemplate) {
  54134. data += inlineTemplate + ",";
  54135. }
  54136. }
  54137. data = data.replace(/,$/, '') + '}';
  54138. // v-bind dynamic argument wrap
  54139. // v-bind with dynamic arguments must be applied using the same v-bind object
  54140. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54141. if (el.dynamicAttrs) {
  54142. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54143. }
  54144. // v-bind data wrap
  54145. if (el.wrapData) {
  54146. data = el.wrapData(data);
  54147. }
  54148. // v-on data wrap
  54149. if (el.wrapListeners) {
  54150. data = el.wrapListeners(data);
  54151. }
  54152. return data
  54153. }
  54154. function genDirectives (el, state) {
  54155. var dirs = el.directives;
  54156. if (!dirs) { return }
  54157. var res = 'directives:[';
  54158. var hasRuntime = false;
  54159. var i, l, dir, needRuntime;
  54160. for (i = 0, l = dirs.length; i < l; i++) {
  54161. dir = dirs[i];
  54162. needRuntime = true;
  54163. var gen = state.directives[dir.name];
  54164. if (gen) {
  54165. // compile-time directive that manipulates AST.
  54166. // returns true if it also needs a runtime counterpart.
  54167. needRuntime = !!gen(el, dir, state.warn);
  54168. }
  54169. if (needRuntime) {
  54170. hasRuntime = true;
  54171. 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))) : '') + "},";
  54172. }
  54173. }
  54174. if (hasRuntime) {
  54175. return res.slice(0, -1) + ']'
  54176. }
  54177. }
  54178. function genInlineTemplate (el, state) {
  54179. var ast = el.children[0];
  54180. if (el.children.length !== 1 || ast.type !== 1) {
  54181. state.warn(
  54182. 'Inline-template components must have exactly one child element.',
  54183. { start: el.start }
  54184. );
  54185. }
  54186. if (ast && ast.type === 1) {
  54187. var inlineRenderFns = generate(ast, state.options);
  54188. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54189. }
  54190. }
  54191. function genScopedSlots (
  54192. el,
  54193. slots,
  54194. state
  54195. ) {
  54196. // by default scoped slots are considered "stable", this allows child
  54197. // components with only scoped slots to skip forced updates from parent.
  54198. // but in some cases we have to bail-out of this optimization
  54199. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54200. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54201. var slot = slots[key];
  54202. return (
  54203. slot.slotTargetDynamic ||
  54204. slot.if ||
  54205. slot.for ||
  54206. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54207. )
  54208. });
  54209. // #9534: if a component with scoped slots is inside a conditional branch,
  54210. // it's possible for the same component to be reused but with different
  54211. // compiled slot content. To avoid that, we generate a unique key based on
  54212. // the generated code of all the slot contents.
  54213. var needsKey = !!el.if;
  54214. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54215. // disconnected due to the intermediate scope variable)
  54216. // #9438, #9506
  54217. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54218. // and skip force updating ones that do not actually use scope variables.
  54219. if (!needsForceUpdate) {
  54220. var parent = el.parent;
  54221. while (parent) {
  54222. if (
  54223. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54224. parent.for
  54225. ) {
  54226. needsForceUpdate = true;
  54227. break
  54228. }
  54229. if (parent.if) {
  54230. needsKey = true;
  54231. }
  54232. parent = parent.parent;
  54233. }
  54234. }
  54235. var generatedSlots = Object.keys(slots)
  54236. .map(function (key) { return genScopedSlot(slots[key], state); })
  54237. .join(',');
  54238. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54239. }
  54240. function hash(str) {
  54241. var hash = 5381;
  54242. var i = str.length;
  54243. while(i) {
  54244. hash = (hash * 33) ^ str.charCodeAt(--i);
  54245. }
  54246. return hash >>> 0
  54247. }
  54248. function containsSlotChild (el) {
  54249. if (el.type === 1) {
  54250. if (el.tag === 'slot') {
  54251. return true
  54252. }
  54253. return el.children.some(containsSlotChild)
  54254. }
  54255. return false
  54256. }
  54257. function genScopedSlot (
  54258. el,
  54259. state
  54260. ) {
  54261. var isLegacySyntax = el.attrsMap['slot-scope'];
  54262. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54263. return genIf(el, state, genScopedSlot, "null")
  54264. }
  54265. if (el.for && !el.forProcessed) {
  54266. return genFor(el, state, genScopedSlot)
  54267. }
  54268. var slotScope = el.slotScope === emptySlotScopeToken
  54269. ? ""
  54270. : String(el.slotScope);
  54271. var fn = "function(" + slotScope + "){" +
  54272. "return " + (el.tag === 'template'
  54273. ? el.if && isLegacySyntax
  54274. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54275. : genChildren(el, state) || 'undefined'
  54276. : genElement(el, state)) + "}";
  54277. // reverse proxy v-slot without scope on this.$slots
  54278. var reverseProxy = slotScope ? "" : ",proxy:true";
  54279. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54280. }
  54281. function genChildren (
  54282. el,
  54283. state,
  54284. checkSkip,
  54285. altGenElement,
  54286. altGenNode
  54287. ) {
  54288. var children = el.children;
  54289. if (children.length) {
  54290. var el$1 = children[0];
  54291. // optimize single v-for
  54292. if (children.length === 1 &&
  54293. el$1.for &&
  54294. el$1.tag !== 'template' &&
  54295. el$1.tag !== 'slot'
  54296. ) {
  54297. var normalizationType = checkSkip
  54298. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54299. : "";
  54300. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54301. }
  54302. var normalizationType$1 = checkSkip
  54303. ? getNormalizationType(children, state.maybeComponent)
  54304. : 0;
  54305. var gen = altGenNode || genNode;
  54306. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54307. }
  54308. }
  54309. // determine the normalization needed for the children array.
  54310. // 0: no normalization needed
  54311. // 1: simple normalization needed (possible 1-level deep nested array)
  54312. // 2: full normalization needed
  54313. function getNormalizationType (
  54314. children,
  54315. maybeComponent
  54316. ) {
  54317. var res = 0;
  54318. for (var i = 0; i < children.length; i++) {
  54319. var el = children[i];
  54320. if (el.type !== 1) {
  54321. continue
  54322. }
  54323. if (needsNormalization(el) ||
  54324. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54325. res = 2;
  54326. break
  54327. }
  54328. if (maybeComponent(el) ||
  54329. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54330. res = 1;
  54331. }
  54332. }
  54333. return res
  54334. }
  54335. function needsNormalization (el) {
  54336. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54337. }
  54338. function genNode (node, state) {
  54339. if (node.type === 1) {
  54340. return genElement(node, state)
  54341. } else if (node.type === 3 && node.isComment) {
  54342. return genComment(node)
  54343. } else {
  54344. return genText(node)
  54345. }
  54346. }
  54347. function genText (text) {
  54348. return ("_v(" + (text.type === 2
  54349. ? text.expression // no need for () because already wrapped in _s()
  54350. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54351. }
  54352. function genComment (comment) {
  54353. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54354. }
  54355. function genSlot (el, state) {
  54356. var slotName = el.slotName || '"default"';
  54357. var children = genChildren(el, state);
  54358. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54359. var attrs = el.attrs || el.dynamicAttrs
  54360. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54361. // slot props are camelized
  54362. name: camelize(attr.name),
  54363. value: attr.value,
  54364. dynamic: attr.dynamic
  54365. }); }))
  54366. : null;
  54367. var bind$$1 = el.attrsMap['v-bind'];
  54368. if ((attrs || bind$$1) && !children) {
  54369. res += ",null";
  54370. }
  54371. if (attrs) {
  54372. res += "," + attrs;
  54373. }
  54374. if (bind$$1) {
  54375. res += (attrs ? '' : ',null') + "," + bind$$1;
  54376. }
  54377. return res + ')'
  54378. }
  54379. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54380. function genComponent (
  54381. componentName,
  54382. el,
  54383. state
  54384. ) {
  54385. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54386. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54387. }
  54388. function genProps (props) {
  54389. var staticProps = "";
  54390. var dynamicProps = "";
  54391. for (var i = 0; i < props.length; i++) {
  54392. var prop = props[i];
  54393. var value = transformSpecialNewlines(prop.value);
  54394. if (prop.dynamic) {
  54395. dynamicProps += (prop.name) + "," + value + ",";
  54396. } else {
  54397. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54398. }
  54399. }
  54400. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54401. if (dynamicProps) {
  54402. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54403. } else {
  54404. return staticProps
  54405. }
  54406. }
  54407. // #3895, #4268
  54408. function transformSpecialNewlines (text) {
  54409. return text
  54410. .replace(/\u2028/g, '\\u2028')
  54411. .replace(/\u2029/g, '\\u2029')
  54412. }
  54413. /* */
  54414. // these keywords should not appear inside expressions, but operators like
  54415. // typeof, instanceof and in are allowed
  54416. var prohibitedKeywordRE = new RegExp('\\b' + (
  54417. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54418. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54419. 'extends,finally,continue,debugger,function,arguments'
  54420. ).split(',').join('\\b|\\b') + '\\b');
  54421. // these unary operators should not be used as property/method names
  54422. var unaryOperatorsRE = new RegExp('\\b' + (
  54423. 'delete,typeof,void'
  54424. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54425. // strip strings in expressions
  54426. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54427. // detect problematic expressions in a template
  54428. function detectErrors (ast, warn) {
  54429. if (ast) {
  54430. checkNode(ast, warn);
  54431. }
  54432. }
  54433. function checkNode (node, warn) {
  54434. if (node.type === 1) {
  54435. for (var name in node.attrsMap) {
  54436. if (dirRE.test(name)) {
  54437. var value = node.attrsMap[name];
  54438. if (value) {
  54439. var range = node.rawAttrsMap[name];
  54440. if (name === 'v-for') {
  54441. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54442. } else if (name === 'v-slot' || name[0] === '#') {
  54443. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54444. } else if (onRE.test(name)) {
  54445. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54446. } else {
  54447. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54448. }
  54449. }
  54450. }
  54451. }
  54452. if (node.children) {
  54453. for (var i = 0; i < node.children.length; i++) {
  54454. checkNode(node.children[i], warn);
  54455. }
  54456. }
  54457. } else if (node.type === 2) {
  54458. checkExpression(node.expression, node.text, warn, node);
  54459. }
  54460. }
  54461. function checkEvent (exp, text, warn, range) {
  54462. var stripped = exp.replace(stripStringRE, '');
  54463. var keywordMatch = stripped.match(unaryOperatorsRE);
  54464. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54465. warn(
  54466. "avoid using JavaScript unary operator as property name: " +
  54467. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54468. range
  54469. );
  54470. }
  54471. checkExpression(exp, text, warn, range);
  54472. }
  54473. function checkFor (node, text, warn, range) {
  54474. checkExpression(node.for || '', text, warn, range);
  54475. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54476. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54477. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54478. }
  54479. function checkIdentifier (
  54480. ident,
  54481. type,
  54482. text,
  54483. warn,
  54484. range
  54485. ) {
  54486. if (typeof ident === 'string') {
  54487. try {
  54488. new Function(("var " + ident + "=_"));
  54489. } catch (e) {
  54490. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54491. }
  54492. }
  54493. }
  54494. function checkExpression (exp, text, warn, range) {
  54495. try {
  54496. new Function(("return " + exp));
  54497. } catch (e) {
  54498. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54499. if (keywordMatch) {
  54500. warn(
  54501. "avoid using JavaScript keyword as property name: " +
  54502. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54503. range
  54504. );
  54505. } else {
  54506. warn(
  54507. "invalid expression: " + (e.message) + " in\n\n" +
  54508. " " + exp + "\n\n" +
  54509. " Raw expression: " + (text.trim()) + "\n",
  54510. range
  54511. );
  54512. }
  54513. }
  54514. }
  54515. function checkFunctionParameterExpression (exp, text, warn, range) {
  54516. try {
  54517. new Function(exp, '');
  54518. } catch (e) {
  54519. warn(
  54520. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  54521. " " + exp + "\n\n" +
  54522. " Raw expression: " + (text.trim()) + "\n",
  54523. range
  54524. );
  54525. }
  54526. }
  54527. /* */
  54528. var range = 2;
  54529. function generateCodeFrame (
  54530. source,
  54531. start,
  54532. end
  54533. ) {
  54534. if ( start === void 0 ) start = 0;
  54535. if ( end === void 0 ) end = source.length;
  54536. var lines = source.split(/\r?\n/);
  54537. var count = 0;
  54538. var res = [];
  54539. for (var i = 0; i < lines.length; i++) {
  54540. count += lines[i].length + 1;
  54541. if (count >= start) {
  54542. for (var j = i - range; j <= i + range || end > count; j++) {
  54543. if (j < 0 || j >= lines.length) { continue }
  54544. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  54545. var lineLength = lines[j].length;
  54546. if (j === i) {
  54547. // push underline
  54548. var pad = start - (count - lineLength) + 1;
  54549. var length = end > count ? lineLength - pad : end - start;
  54550. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  54551. } else if (j > i) {
  54552. if (end > count) {
  54553. var length$1 = Math.min(end - count, lineLength);
  54554. res.push(" | " + repeat$1("^", length$1));
  54555. }
  54556. count += lineLength + 1;
  54557. }
  54558. }
  54559. break
  54560. }
  54561. }
  54562. return res.join('\n')
  54563. }
  54564. function repeat$1 (str, n) {
  54565. var result = '';
  54566. if (n > 0) {
  54567. while (true) { // eslint-disable-line
  54568. if (n & 1) { result += str; }
  54569. n >>>= 1;
  54570. if (n <= 0) { break }
  54571. str += str;
  54572. }
  54573. }
  54574. return result
  54575. }
  54576. /* */
  54577. function createFunction (code, errors) {
  54578. try {
  54579. return new Function(code)
  54580. } catch (err) {
  54581. errors.push({ err: err, code: code });
  54582. return noop
  54583. }
  54584. }
  54585. function createCompileToFunctionFn (compile) {
  54586. var cache = Object.create(null);
  54587. return function compileToFunctions (
  54588. template,
  54589. options,
  54590. vm
  54591. ) {
  54592. options = extend({}, options);
  54593. var warn$$1 = options.warn || warn;
  54594. delete options.warn;
  54595. /* istanbul ignore if */
  54596. {
  54597. // detect possible CSP restriction
  54598. try {
  54599. new Function('return 1');
  54600. } catch (e) {
  54601. if (e.toString().match(/unsafe-eval|CSP/)) {
  54602. warn$$1(
  54603. 'It seems you are using the standalone build of Vue.js in an ' +
  54604. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  54605. 'The template compiler cannot work in this environment. Consider ' +
  54606. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  54607. 'templates into render functions.'
  54608. );
  54609. }
  54610. }
  54611. }
  54612. // check cache
  54613. var key = options.delimiters
  54614. ? String(options.delimiters) + template
  54615. : template;
  54616. if (cache[key]) {
  54617. return cache[key]
  54618. }
  54619. // compile
  54620. var compiled = compile(template, options);
  54621. // check compilation errors/tips
  54622. {
  54623. if (compiled.errors && compiled.errors.length) {
  54624. if (options.outputSourceRange) {
  54625. compiled.errors.forEach(function (e) {
  54626. warn$$1(
  54627. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  54628. generateCodeFrame(template, e.start, e.end),
  54629. vm
  54630. );
  54631. });
  54632. } else {
  54633. warn$$1(
  54634. "Error compiling template:\n\n" + template + "\n\n" +
  54635. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  54636. vm
  54637. );
  54638. }
  54639. }
  54640. if (compiled.tips && compiled.tips.length) {
  54641. if (options.outputSourceRange) {
  54642. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  54643. } else {
  54644. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  54645. }
  54646. }
  54647. }
  54648. // turn code into functions
  54649. var res = {};
  54650. var fnGenErrors = [];
  54651. res.render = createFunction(compiled.render, fnGenErrors);
  54652. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  54653. return createFunction(code, fnGenErrors)
  54654. });
  54655. // check function generation errors.
  54656. // this should only happen if there is a bug in the compiler itself.
  54657. // mostly for codegen development use
  54658. /* istanbul ignore if */
  54659. {
  54660. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  54661. warn$$1(
  54662. "Failed to generate render function:\n\n" +
  54663. fnGenErrors.map(function (ref) {
  54664. var err = ref.err;
  54665. var code = ref.code;
  54666. return ((err.toString()) + " in\n\n" + code + "\n");
  54667. }).join('\n'),
  54668. vm
  54669. );
  54670. }
  54671. }
  54672. return (cache[key] = res)
  54673. }
  54674. }
  54675. /* */
  54676. function createCompilerCreator (baseCompile) {
  54677. return function createCompiler (baseOptions) {
  54678. function compile (
  54679. template,
  54680. options
  54681. ) {
  54682. var finalOptions = Object.create(baseOptions);
  54683. var errors = [];
  54684. var tips = [];
  54685. var warn = function (msg, range, tip) {
  54686. (tip ? tips : errors).push(msg);
  54687. };
  54688. if (options) {
  54689. if (options.outputSourceRange) {
  54690. // $flow-disable-line
  54691. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  54692. warn = function (msg, range, tip) {
  54693. var data = { msg: msg };
  54694. if (range) {
  54695. if (range.start != null) {
  54696. data.start = range.start + leadingSpaceLength;
  54697. }
  54698. if (range.end != null) {
  54699. data.end = range.end + leadingSpaceLength;
  54700. }
  54701. }
  54702. (tip ? tips : errors).push(data);
  54703. };
  54704. }
  54705. // merge custom modules
  54706. if (options.modules) {
  54707. finalOptions.modules =
  54708. (baseOptions.modules || []).concat(options.modules);
  54709. }
  54710. // merge custom directives
  54711. if (options.directives) {
  54712. finalOptions.directives = extend(
  54713. Object.create(baseOptions.directives || null),
  54714. options.directives
  54715. );
  54716. }
  54717. // copy other options
  54718. for (var key in options) {
  54719. if (key !== 'modules' && key !== 'directives') {
  54720. finalOptions[key] = options[key];
  54721. }
  54722. }
  54723. }
  54724. finalOptions.warn = warn;
  54725. var compiled = baseCompile(template.trim(), finalOptions);
  54726. {
  54727. detectErrors(compiled.ast, warn);
  54728. }
  54729. compiled.errors = errors;
  54730. compiled.tips = tips;
  54731. return compiled
  54732. }
  54733. return {
  54734. compile: compile,
  54735. compileToFunctions: createCompileToFunctionFn(compile)
  54736. }
  54737. }
  54738. }
  54739. /* */
  54740. // `createCompilerCreator` allows creating compilers that use alternative
  54741. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  54742. // Here we just export a default compiler using the default parts.
  54743. var createCompiler = createCompilerCreator(function baseCompile (
  54744. template,
  54745. options
  54746. ) {
  54747. var ast = parse(template.trim(), options);
  54748. if (options.optimize !== false) {
  54749. optimize(ast, options);
  54750. }
  54751. var code = generate(ast, options);
  54752. return {
  54753. ast: ast,
  54754. render: code.render,
  54755. staticRenderFns: code.staticRenderFns
  54756. }
  54757. });
  54758. /* */
  54759. var ref$1 = createCompiler(baseOptions);
  54760. var compile = ref$1.compile;
  54761. var compileToFunctions = ref$1.compileToFunctions;
  54762. /* */
  54763. // check whether current browser encodes a char inside attribute values
  54764. var div;
  54765. function getShouldDecode (href) {
  54766. div = div || document.createElement('div');
  54767. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  54768. return div.innerHTML.indexOf('&#10;') > 0
  54769. }
  54770. // #3663: IE encodes newlines inside attribute values while other browsers don't
  54771. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  54772. // #6828: chrome encodes content in a[href]
  54773. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  54774. /* */
  54775. var idToTemplate = cached(function (id) {
  54776. var el = query(id);
  54777. return el && el.innerHTML
  54778. });
  54779. var mount = Vue.prototype.$mount;
  54780. Vue.prototype.$mount = function (
  54781. el,
  54782. hydrating
  54783. ) {
  54784. el = el && query(el);
  54785. /* istanbul ignore if */
  54786. if (el === document.body || el === document.documentElement) {
  54787. warn(
  54788. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  54789. );
  54790. return this
  54791. }
  54792. var options = this.$options;
  54793. // resolve template/el and convert to render function
  54794. if (!options.render) {
  54795. var template = options.template;
  54796. if (template) {
  54797. if (typeof template === 'string') {
  54798. if (template.charAt(0) === '#') {
  54799. template = idToTemplate(template);
  54800. /* istanbul ignore if */
  54801. if (!template) {
  54802. warn(
  54803. ("Template element not found or is empty: " + (options.template)),
  54804. this
  54805. );
  54806. }
  54807. }
  54808. } else if (template.nodeType) {
  54809. template = template.innerHTML;
  54810. } else {
  54811. {
  54812. warn('invalid template option:' + template, this);
  54813. }
  54814. return this
  54815. }
  54816. } else if (el) {
  54817. template = getOuterHTML(el);
  54818. }
  54819. if (template) {
  54820. /* istanbul ignore if */
  54821. if (config.performance && mark) {
  54822. mark('compile');
  54823. }
  54824. var ref = compileToFunctions(template, {
  54825. outputSourceRange: "development" !== 'production',
  54826. shouldDecodeNewlines: shouldDecodeNewlines,
  54827. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  54828. delimiters: options.delimiters,
  54829. comments: options.comments
  54830. }, this);
  54831. var render = ref.render;
  54832. var staticRenderFns = ref.staticRenderFns;
  54833. options.render = render;
  54834. options.staticRenderFns = staticRenderFns;
  54835. /* istanbul ignore if */
  54836. if (config.performance && mark) {
  54837. mark('compile end');
  54838. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  54839. }
  54840. }
  54841. }
  54842. return mount.call(this, el, hydrating)
  54843. };
  54844. /**
  54845. * Get outerHTML of elements, taking care
  54846. * of SVG elements in IE as well.
  54847. */
  54848. function getOuterHTML (el) {
  54849. if (el.outerHTML) {
  54850. return el.outerHTML
  54851. } else {
  54852. var container = document.createElement('div');
  54853. container.appendChild(el.cloneNode(true));
  54854. return container.innerHTML
  54855. }
  54856. }
  54857. Vue.compile = compileToFunctions;
  54858. module.exports = Vue;
  54859. /* 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))
  54860. /***/ }),
  54861. /***/ "./node_modules/vue/dist/vue.common.js":
  54862. /*!*********************************************!*\
  54863. !*** ./node_modules/vue/dist/vue.common.js ***!
  54864. \*********************************************/
  54865. /*! no static exports found */
  54866. /***/ (function(module, exports, __webpack_require__) {
  54867. if (false) {} else {
  54868. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  54869. }
  54870. /***/ }),
  54871. /***/ "./node_modules/webpack/buildin/global.js":
  54872. /*!***********************************!*\
  54873. !*** (webpack)/buildin/global.js ***!
  54874. \***********************************/
  54875. /*! no static exports found */
  54876. /***/ (function(module, exports) {
  54877. var g;
  54878. // This works in non-strict mode
  54879. g = (function() {
  54880. return this;
  54881. })();
  54882. try {
  54883. // This works if eval is allowed (see CSP)
  54884. g = g || new Function("return this")();
  54885. } catch (e) {
  54886. // This works if the window reference is available
  54887. if (typeof window === "object") g = window;
  54888. }
  54889. // g can still be undefined, but nothing to do about it...
  54890. // We return undefined, instead of nothing here, so it's
  54891. // easier to handle this case. if(!global) { ...}
  54892. module.exports = g;
  54893. /***/ }),
  54894. /***/ "./node_modules/webpack/buildin/module.js":
  54895. /*!***********************************!*\
  54896. !*** (webpack)/buildin/module.js ***!
  54897. \***********************************/
  54898. /*! no static exports found */
  54899. /***/ (function(module, exports) {
  54900. module.exports = function(module) {
  54901. if (!module.webpackPolyfill) {
  54902. module.deprecate = function() {};
  54903. module.paths = [];
  54904. // module.parent = undefined by default
  54905. if (!module.children) module.children = [];
  54906. Object.defineProperty(module, "loaded", {
  54907. enumerable: true,
  54908. get: function() {
  54909. return module.l;
  54910. }
  54911. });
  54912. Object.defineProperty(module, "id", {
  54913. enumerable: true,
  54914. get: function() {
  54915. return module.i;
  54916. }
  54917. });
  54918. module.webpackPolyfill = 1;
  54919. }
  54920. return module;
  54921. };
  54922. /***/ }),
  54923. /***/ "./resources/js/app.js":
  54924. /*!*****************************!*\
  54925. !*** ./resources/js/app.js ***!
  54926. \*****************************/
  54927. /*! no static exports found */
  54928. /***/ (function(module, exports, __webpack_require__) {
  54929. /**
  54930. * First we will load all of this project's JavaScript dependencies which
  54931. * includes Vue and other libraries. It is a great starting point when
  54932. * building robust, powerful web applications using Vue and Laravel.
  54933. */
  54934. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  54935. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  54936. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  54937. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  54938. /**
  54939. * The following block of code may be used to automatically register your
  54940. * Vue components. It will recursively scan this directory for the Vue
  54941. * components and automatically register them with their "basename".
  54942. *
  54943. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  54944. */
  54945. // const files = require.context('./', true, /\.vue$/i)
  54946. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  54947. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  54948. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  54949. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  54950. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  54951. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  54952. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  54953. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  54954. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  54955. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  54956. /**
  54957. * Next, we will create a fresh Vue application instance and attach it to
  54958. * the page. Then, you may begin adding components to this application
  54959. * or customize the JavaScript scaffolding to fit your unique needs.
  54960. */
  54961. var app = new Vue({
  54962. el: '#app'
  54963. });
  54964. $(function () {
  54965. $('[data-toggle="tooltip"]').tooltip();
  54966. });
  54967. var clipboard = new Clipboard('.btn-clip');
  54968. clipboard.on('success', function (e) {
  54969. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  54970. position: "right",
  54971. className: 'success'
  54972. });
  54973. e.clearSelection();
  54974. });
  54975. /***/ }),
  54976. /***/ "./resources/js/bootstrap.js":
  54977. /*!***********************************!*\
  54978. !*** ./resources/js/bootstrap.js ***!
  54979. \***********************************/
  54980. /*! no exports provided */
  54981. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54982. "use strict";
  54983. __webpack_require__.r(__webpack_exports__);
  54984. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  54985. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  54986. /**
  54987. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  54988. * for JavaScript based Bootstrap features such as modals and tabs. This
  54989. * code may be modified to fit the specific needs of your application.
  54990. */
  54991. try {
  54992. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  54993. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  54994. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  54995. } catch (e) {}
  54996. /**
  54997. * We'll load the axios HTTP library which allows us to easily issue requests
  54998. * to our Laravel back-end. This library automatically handles sending the
  54999. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55000. */
  55001. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55002. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55003. /**
  55004. * Echo exposes an expressive API for subscribing to channels and listening
  55005. * for events that are broadcast by Laravel. Echo and event broadcasting
  55006. * allows your team to easily build robust real-time web applications.
  55007. */
  55008. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55009. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55010. broadcaster: 'pusher',
  55011. key: "upccrt",
  55012. wsHost: window.location.hostname,
  55013. wsPort: 6001,
  55014. disableStats: true
  55015. });
  55016. /***/ }),
  55017. /***/ "./resources/js/components/ExampleComponent.vue":
  55018. /*!******************************************************!*\
  55019. !*** ./resources/js/components/ExampleComponent.vue ***!
  55020. \******************************************************/
  55021. /*! exports provided: default */
  55022. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55023. "use strict";
  55024. __webpack_require__.r(__webpack_exports__);
  55025. /* 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&");
  55026. /* 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&");
  55027. /* 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");
  55028. /* normalize component */
  55029. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55030. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55031. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55032. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55033. false,
  55034. null,
  55035. null,
  55036. null
  55037. )
  55038. /* hot reload */
  55039. if (false) { var api; }
  55040. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55041. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55042. /***/ }),
  55043. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55044. /*!*******************************************************************************!*\
  55045. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55046. \*******************************************************************************/
  55047. /*! exports provided: default */
  55048. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55049. "use strict";
  55050. __webpack_require__.r(__webpack_exports__);
  55051. /* 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&");
  55052. /* 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"]);
  55053. /***/ }),
  55054. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55055. /*!*************************************************************************************!*\
  55056. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55057. \*************************************************************************************/
  55058. /*! exports provided: render, staticRenderFns */
  55059. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55060. "use strict";
  55061. __webpack_require__.r(__webpack_exports__);
  55062. /* 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&");
  55063. /* 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"]; });
  55064. /* 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"]; });
  55065. /***/ }),
  55066. /***/ "./resources/js/components/assetinfo.vue":
  55067. /*!***********************************************!*\
  55068. !*** ./resources/js/components/assetinfo.vue ***!
  55069. \***********************************************/
  55070. /*! exports provided: default */
  55071. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55072. "use strict";
  55073. __webpack_require__.r(__webpack_exports__);
  55074. /* 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&");
  55075. /* 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&");
  55076. /* 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");
  55077. /* normalize component */
  55078. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55079. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55080. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55081. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55082. false,
  55083. null,
  55084. null,
  55085. null
  55086. )
  55087. /* hot reload */
  55088. if (false) { var api; }
  55089. component.options.__file = "resources/js/components/assetinfo.vue"
  55090. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55091. /***/ }),
  55092. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55093. /*!************************************************************************!*\
  55094. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55095. \************************************************************************/
  55096. /*! exports provided: default */
  55097. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55098. "use strict";
  55099. __webpack_require__.r(__webpack_exports__);
  55100. /* 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&");
  55101. /* 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"]);
  55102. /***/ }),
  55103. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55104. /*!******************************************************************************!*\
  55105. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55106. \******************************************************************************/
  55107. /*! exports provided: render, staticRenderFns */
  55108. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55109. "use strict";
  55110. __webpack_require__.r(__webpack_exports__);
  55111. /* 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&");
  55112. /* 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"]; });
  55113. /* 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"]; });
  55114. /***/ }),
  55115. /***/ "./resources/js/components/credential-form-modal.vue":
  55116. /*!***********************************************************!*\
  55117. !*** ./resources/js/components/credential-form-modal.vue ***!
  55118. \***********************************************************/
  55119. /*! exports provided: default */
  55120. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55121. "use strict";
  55122. __webpack_require__.r(__webpack_exports__);
  55123. /* 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&");
  55124. /* 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&");
  55125. /* 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");
  55126. /* normalize component */
  55127. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55128. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55129. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55130. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55131. false,
  55132. null,
  55133. null,
  55134. null
  55135. )
  55136. /* hot reload */
  55137. if (false) { var api; }
  55138. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55139. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55140. /***/ }),
  55141. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55142. /*!************************************************************************************!*\
  55143. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55144. \************************************************************************************/
  55145. /*! exports provided: default */
  55146. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55147. "use strict";
  55148. __webpack_require__.r(__webpack_exports__);
  55149. /* 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&");
  55150. /* 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"]);
  55151. /***/ }),
  55152. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55153. /*!******************************************************************************************!*\
  55154. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55155. \******************************************************************************************/
  55156. /*! exports provided: render, staticRenderFns */
  55157. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55158. "use strict";
  55159. __webpack_require__.r(__webpack_exports__);
  55160. /* 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&");
  55161. /* 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"]; });
  55162. /* 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"]; });
  55163. /***/ }),
  55164. /***/ "./resources/js/components/credential.vue":
  55165. /*!************************************************!*\
  55166. !*** ./resources/js/components/credential.vue ***!
  55167. \************************************************/
  55168. /*! exports provided: default */
  55169. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55170. "use strict";
  55171. __webpack_require__.r(__webpack_exports__);
  55172. /* 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&");
  55173. /* 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&");
  55174. /* 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");
  55175. /* normalize component */
  55176. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55177. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55178. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55179. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55180. false,
  55181. null,
  55182. null,
  55183. null
  55184. )
  55185. /* hot reload */
  55186. if (false) { var api; }
  55187. component.options.__file = "resources/js/components/credential.vue"
  55188. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55189. /***/ }),
  55190. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55191. /*!*************************************************************************!*\
  55192. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55193. \*************************************************************************/
  55194. /*! exports provided: default */
  55195. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55196. "use strict";
  55197. __webpack_require__.r(__webpack_exports__);
  55198. /* 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&");
  55199. /* 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"]);
  55200. /***/ }),
  55201. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55202. /*!*******************************************************************************!*\
  55203. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55204. \*******************************************************************************/
  55205. /*! exports provided: render, staticRenderFns */
  55206. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55207. "use strict";
  55208. __webpack_require__.r(__webpack_exports__);
  55209. /* 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&");
  55210. /* 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"]; });
  55211. /* 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"]; });
  55212. /***/ }),
  55213. /***/ "./resources/js/components/errorlist.vue":
  55214. /*!***********************************************!*\
  55215. !*** ./resources/js/components/errorlist.vue ***!
  55216. \***********************************************/
  55217. /*! exports provided: default */
  55218. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55219. "use strict";
  55220. __webpack_require__.r(__webpack_exports__);
  55221. /* 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&");
  55222. /* 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&");
  55223. /* 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");
  55224. /* normalize component */
  55225. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55226. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55227. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55228. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55229. false,
  55230. null,
  55231. null,
  55232. null
  55233. )
  55234. /* hot reload */
  55235. if (false) { var api; }
  55236. component.options.__file = "resources/js/components/errorlist.vue"
  55237. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55238. /***/ }),
  55239. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55240. /*!************************************************************************!*\
  55241. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55242. \************************************************************************/
  55243. /*! exports provided: default */
  55244. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55245. "use strict";
  55246. __webpack_require__.r(__webpack_exports__);
  55247. /* 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&");
  55248. /* 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"]);
  55249. /***/ }),
  55250. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55251. /*!******************************************************************************!*\
  55252. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55253. \******************************************************************************/
  55254. /*! exports provided: render, staticRenderFns */
  55255. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55256. "use strict";
  55257. __webpack_require__.r(__webpack_exports__);
  55258. /* 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&");
  55259. /* 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"]; });
  55260. /* 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"]; });
  55261. /***/ }),
  55262. /***/ "./resources/js/components/modal.vue":
  55263. /*!*******************************************!*\
  55264. !*** ./resources/js/components/modal.vue ***!
  55265. \*******************************************/
  55266. /*! exports provided: default */
  55267. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55268. "use strict";
  55269. __webpack_require__.r(__webpack_exports__);
  55270. /* 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&");
  55271. /* 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");
  55272. var script = {}
  55273. /* normalize component */
  55274. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55275. script,
  55276. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55277. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55278. false,
  55279. null,
  55280. null,
  55281. null
  55282. )
  55283. /* hot reload */
  55284. if (false) { var api; }
  55285. component.options.__file = "resources/js/components/modal.vue"
  55286. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55287. /***/ }),
  55288. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  55289. /*!**************************************************************************!*\
  55290. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  55291. \**************************************************************************/
  55292. /*! exports provided: render, staticRenderFns */
  55293. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55294. "use strict";
  55295. __webpack_require__.r(__webpack_exports__);
  55296. /* 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&");
  55297. /* 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"]; });
  55298. /* 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"]; });
  55299. /***/ }),
  55300. /***/ "./resources/js/components/notes.vue":
  55301. /*!*******************************************!*\
  55302. !*** ./resources/js/components/notes.vue ***!
  55303. \*******************************************/
  55304. /*! exports provided: default */
  55305. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55306. "use strict";
  55307. __webpack_require__.r(__webpack_exports__);
  55308. /* 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&");
  55309. /* 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&");
  55310. /* 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");
  55311. /* normalize component */
  55312. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55313. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55314. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55315. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55316. false,
  55317. null,
  55318. null,
  55319. null
  55320. )
  55321. /* hot reload */
  55322. if (false) { var api; }
  55323. component.options.__file = "resources/js/components/notes.vue"
  55324. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55325. /***/ }),
  55326. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  55327. /*!********************************************************************!*\
  55328. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  55329. \********************************************************************/
  55330. /*! exports provided: default */
  55331. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55332. "use strict";
  55333. __webpack_require__.r(__webpack_exports__);
  55334. /* 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&");
  55335. /* 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"]);
  55336. /***/ }),
  55337. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  55338. /*!**************************************************************************!*\
  55339. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  55340. \**************************************************************************/
  55341. /*! exports provided: render, staticRenderFns */
  55342. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55343. "use strict";
  55344. __webpack_require__.r(__webpack_exports__);
  55345. /* 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&");
  55346. /* 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"]; });
  55347. /* 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"]; });
  55348. /***/ }),
  55349. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  55350. /*!*******************************************************!*\
  55351. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  55352. \*******************************************************/
  55353. /*! exports provided: default */
  55354. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55355. "use strict";
  55356. __webpack_require__.r(__webpack_exports__);
  55357. /* 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&");
  55358. /* 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&");
  55359. /* 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");
  55360. /* normalize component */
  55361. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55362. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55363. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55364. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55365. false,
  55366. null,
  55367. null,
  55368. null
  55369. )
  55370. /* hot reload */
  55371. if (false) { var api; }
  55372. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  55373. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55374. /***/ }),
  55375. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  55376. /*!********************************************************************************!*\
  55377. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  55378. \********************************************************************************/
  55379. /*! exports provided: default */
  55380. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55381. "use strict";
  55382. __webpack_require__.r(__webpack_exports__);
  55383. /* 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&");
  55384. /* 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"]);
  55385. /***/ }),
  55386. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  55387. /*!**************************************************************************************!*\
  55388. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  55389. \**************************************************************************************/
  55390. /*! exports provided: render, staticRenderFns */
  55391. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55392. "use strict";
  55393. __webpack_require__.r(__webpack_exports__);
  55394. /* 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&");
  55395. /* 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"]; });
  55396. /* 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"]; });
  55397. /***/ }),
  55398. /***/ "./resources/js/components/woinfo.vue":
  55399. /*!********************************************!*\
  55400. !*** ./resources/js/components/woinfo.vue ***!
  55401. \********************************************/
  55402. /*! exports provided: default */
  55403. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55404. "use strict";
  55405. __webpack_require__.r(__webpack_exports__);
  55406. /* 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&");
  55407. /* 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&");
  55408. /* 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");
  55409. /* normalize component */
  55410. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55411. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55412. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  55413. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55414. false,
  55415. null,
  55416. null,
  55417. null
  55418. )
  55419. /* hot reload */
  55420. if (false) { var api; }
  55421. component.options.__file = "resources/js/components/woinfo.vue"
  55422. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55423. /***/ }),
  55424. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  55425. /*!*********************************************************************!*\
  55426. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  55427. \*********************************************************************/
  55428. /*! exports provided: default */
  55429. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55430. "use strict";
  55431. __webpack_require__.r(__webpack_exports__);
  55432. /* 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&");
  55433. /* 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"]);
  55434. /***/ }),
  55435. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  55436. /*!***************************************************************************!*\
  55437. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  55438. \***************************************************************************/
  55439. /*! exports provided: render, staticRenderFns */
  55440. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55441. "use strict";
  55442. __webpack_require__.r(__webpack_exports__);
  55443. /* 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&");
  55444. /* 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"]; });
  55445. /* 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"]; });
  55446. /***/ }),
  55447. /***/ "./resources/js/mixins/dateMixin.js":
  55448. /*!******************************************!*\
  55449. !*** ./resources/js/mixins/dateMixin.js ***!
  55450. \******************************************/
  55451. /*! exports provided: default */
  55452. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55453. "use strict";
  55454. __webpack_require__.r(__webpack_exports__);
  55455. /* harmony default export */ __webpack_exports__["default"] = ({
  55456. methods: {
  55457. treatAsUTC: function treatAsUTC(date) {
  55458. var result = new Date(date);
  55459. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  55460. return result;
  55461. },
  55462. daysSinceToday: function daysSinceToday(date) {
  55463. var currentDate = new Date();
  55464. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  55465. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  55466. },
  55467. getHRDate: function getHRDate(dateString) {
  55468. var date = new Date(dateString);
  55469. return date.toLocaleString('default', {
  55470. month: 'short',
  55471. day: 'numeric',
  55472. year: 'numeric',
  55473. hour: 'numeric',
  55474. minute: 'numeric'
  55475. });
  55476. },
  55477. isZero: function isZero(dateString) {
  55478. return dateString === '0000-00-00 00:00:00';
  55479. }
  55480. }
  55481. });
  55482. /***/ }),
  55483. /***/ "./resources/js/notify.min.js":
  55484. /*!************************************!*\
  55485. !*** ./resources/js/notify.min.js ***!
  55486. \************************************/
  55487. /*! no static exports found */
  55488. /***/ (function(module, exports, __webpack_require__) {
  55489. 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); }
  55490. (function (e) {
  55491. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  55492. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  55493. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  55494. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  55495. })(function (e) {
  55496. function A(t, n, i) {
  55497. typeof i == "string" && (i = {
  55498. className: i
  55499. }), 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);
  55500. }
  55501. var t = [].indexOf || function (e) {
  55502. for (var t = 0, n = this.length; t < n; t++) {
  55503. if (t in this && this[t] === e) return t;
  55504. }
  55505. return -1;
  55506. },
  55507. n = "notify",
  55508. r = n + "js",
  55509. i = n + "!blank",
  55510. s = {
  55511. t: "top",
  55512. m: "middle",
  55513. b: "bottom",
  55514. l: "left",
  55515. c: "center",
  55516. r: "right"
  55517. },
  55518. o = ["l", "c", "r"],
  55519. u = ["t", "m", "b"],
  55520. a = ["t", "b", "l", "r"],
  55521. f = {
  55522. t: "b",
  55523. m: null,
  55524. b: "t",
  55525. l: "r",
  55526. c: null,
  55527. r: "l"
  55528. },
  55529. l = function l(t) {
  55530. var n;
  55531. return n = [], e.each(t.split(/\W+/), function (e, t) {
  55532. var r;
  55533. r = t.toLowerCase().charAt(0);
  55534. if (s[r]) return n.push(r);
  55535. }), n;
  55536. },
  55537. c = {},
  55538. h = {
  55539. name: "core",
  55540. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  55541. 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}"
  55542. },
  55543. p = {
  55544. "border-radius": ["-webkit-", "-moz-"]
  55545. },
  55546. d = function d(e) {
  55547. return c[e];
  55548. },
  55549. v = function v(e) {
  55550. if (!e) throw "Missing Style name";
  55551. c[e] && delete c[e];
  55552. },
  55553. m = function m(t, i) {
  55554. if (!t) throw "Missing Style name";
  55555. if (!i) throw "Missing Style definition";
  55556. if (!i.html) throw "Missing Style HTML";
  55557. var s = c[t];
  55558. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  55559. var o = "";
  55560. i.classes && e.each(i.classes, function (t, n) {
  55561. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  55562. return p[t] && e.each(p[t], function (e, r) {
  55563. return o += " " + r + t + ": " + n + ";\n";
  55564. }), o += " " + t + ": " + n + ";\n";
  55565. }), o += "}\n";
  55566. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  55567. var u = {},
  55568. a = e(i.html);
  55569. y("html", a, u), y("text", a, u), i.fields = u;
  55570. },
  55571. g = function g(t) {
  55572. var n, r, i;
  55573. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  55574. try {
  55575. r.html(t);
  55576. } catch (s) {
  55577. r[0].styleSheet.cssText = t;
  55578. }
  55579. return r;
  55580. },
  55581. y = function y(t, n, r) {
  55582. var s;
  55583. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  55584. var n;
  55585. n = e(this).attr(s), n || (n = i), r[n] = t;
  55586. });
  55587. },
  55588. b = function b(e, t) {
  55589. return e.is(t) ? e : e.find(t);
  55590. },
  55591. w = {
  55592. clickToHide: !0,
  55593. autoHide: !0,
  55594. autoHideDelay: 5e3,
  55595. arrowShow: !0,
  55596. arrowSize: 5,
  55597. breakNewLines: !0,
  55598. elementPosition: "bottom",
  55599. globalPosition: "top right",
  55600. style: "bootstrap",
  55601. className: "error",
  55602. showAnimation: "slideDown",
  55603. showDuration: 400,
  55604. hideAnimation: "slideUp",
  55605. hideDuration: 200,
  55606. gap: 5
  55607. },
  55608. E = function E(t, n) {
  55609. var r;
  55610. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  55611. },
  55612. S = function S(t) {
  55613. return e.extend(w, t);
  55614. },
  55615. x = function x(t) {
  55616. return e("<" + t + "></" + t + ">");
  55617. },
  55618. T = {},
  55619. N = function N(t) {
  55620. var n;
  55621. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  55622. return e(r).attr("name") === t.attr("name");
  55623. }), t = n.first()), t;
  55624. },
  55625. C = function C(e, t, n) {
  55626. var r, i;
  55627. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  55628. if (isNaN(n)) return;
  55629. 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;
  55630. },
  55631. k = function k(e, t, n) {
  55632. if (e === "l" || e === "t") return 0;
  55633. if (e === "c" || e === "m") return n / 2 - t / 2;
  55634. if (e === "r" || e === "b") return n - t;
  55635. throw "Invalid alignment";
  55636. },
  55637. L = function L(e) {
  55638. return L.e = L.e || x("div"), L.e.text(e).html();
  55639. };
  55640. A.prototype.loadHTML = function () {
  55641. var t;
  55642. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  55643. }, A.prototype.show = function (e, t) {
  55644. var n, r, i, s, o;
  55645. r = function (n) {
  55646. return function () {
  55647. !e && !n.elem && n.destroy();
  55648. if (t) return t();
  55649. };
  55650. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  55651. 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 {
  55652. if (!!o || !!e) return r();
  55653. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  55654. }
  55655. return n.push(r), i[s].apply(i, n);
  55656. }, A.prototype.setGlobalPosition = function () {
  55657. var t = this.getPosition(),
  55658. n = t[0],
  55659. i = t[1],
  55660. o = s[n],
  55661. u = s[i],
  55662. a = n + "|" + i,
  55663. f = T[a];
  55664. if (!f || !document.body.contains(f[0])) {
  55665. f = T[a] = x("div");
  55666. var l = {};
  55667. 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);
  55668. }
  55669. return f.prepend(this.wrapper);
  55670. }, A.prototype.setElementPosition = function () {
  55671. 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;
  55672. 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"];
  55673. for (w = 0, S = B.length; w < S; w++) {
  55674. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  55675. }
  55676. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  55677. if (!this.options.arrowShow) this.arrow.hide();else {
  55678. 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";
  55679. for (E = 0, x = a.length; E < x; E++) {
  55680. D = a[E], P = s[D];
  55681. if (D === L) continue;
  55682. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  55683. }
  55684. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  55685. }
  55686. 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);
  55687. if (r) return this.arrow.removeAttr("style").css(r);
  55688. }, A.prototype.getPosition = function () {
  55689. var e, n, r, i, s, f, c, h;
  55690. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  55691. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  55692. 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";
  55693. return e.length === 2 && (e[2] = e[1]), e;
  55694. }, A.prototype.getStyle = function (e) {
  55695. var t;
  55696. e || (e = this.options.style), e || (e = "default"), t = c[e];
  55697. if (!t) throw "Missing style: " + e;
  55698. return t;
  55699. }, A.prototype.updateClasses = function () {
  55700. var t, n;
  55701. 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) {
  55702. return r + "-" + n.name + "-" + e;
  55703. }).join(" "), this.userContainer.attr("class", t);
  55704. }, A.prototype.run = function (t, n) {
  55705. var r, s, o, u, a;
  55706. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  55707. if (this.container && !t) {
  55708. this.show(!1);
  55709. return;
  55710. }
  55711. if (!this.container && !t) return;
  55712. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  55713. for (o in s) {
  55714. r = s[o], u = this.userFields[o];
  55715. if (!u) continue;
  55716. 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);
  55717. }
  55718. 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));
  55719. }, A.prototype.destroy = function () {
  55720. this.wrapper.data(r, null), this.wrapper.remove();
  55721. }, e[n] = function (t, r, i) {
  55722. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  55723. }, e.fn[n] = function (t, n) {
  55724. return e(this).each(function () {
  55725. var i = N(e(this)).data(r);
  55726. i && i.destroy();
  55727. var s = new A(e(this), t, n);
  55728. }), this;
  55729. }, e.extend(e[n], {
  55730. defaults: S,
  55731. addStyle: m,
  55732. removeStyle: v,
  55733. pluginOptions: w,
  55734. getStyle: d,
  55735. insertCSS: g
  55736. }), m("bootstrap", {
  55737. html: "<div>\n<span data-notify-text></span>\n</div>",
  55738. classes: {
  55739. base: {
  55740. "font-weight": "bold",
  55741. padding: "8px 15px 8px 14px",
  55742. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  55743. "background-color": "#fcf8e3",
  55744. border: "1px solid #fbeed5",
  55745. "border-radius": "4px",
  55746. "white-space": "nowrap",
  55747. "padding-left": "25px",
  55748. "background-repeat": "no-repeat",
  55749. "background-position": "3px 7px"
  55750. },
  55751. error: {
  55752. color: "#B94A48",
  55753. "background-color": "#F2DEDE",
  55754. "border-color": "#EED3D7",
  55755. "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=)"
  55756. },
  55757. success: {
  55758. color: "#468847",
  55759. "background-color": "#DFF0D8",
  55760. "border-color": "#D6E9C6",
  55761. "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==)"
  55762. },
  55763. info: {
  55764. color: "#3A87AD",
  55765. "background-color": "#D9EDF7",
  55766. "border-color": "#BCE8F1",
  55767. "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=)"
  55768. },
  55769. warn: {
  55770. color: "#C09853",
  55771. "background-color": "#FCF8E3",
  55772. "border-color": "#FBEED5",
  55773. "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)"
  55774. }
  55775. }
  55776. }), e(function () {
  55777. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  55778. e(this).trigger("notify-hide");
  55779. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  55780. var n = e(this).data(r);
  55781. n && n.show(!1);
  55782. });
  55783. });
  55784. });
  55785. /***/ }),
  55786. /***/ "./resources/sass/app.scss":
  55787. /*!*********************************!*\
  55788. !*** ./resources/sass/app.scss ***!
  55789. \*********************************/
  55790. /*! no static exports found */
  55791. /***/ (function(module, exports) {
  55792. // removed by extract-text-webpack-plugin
  55793. /***/ }),
  55794. /***/ 0:
  55795. /*!*************************************************************!*\
  55796. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  55797. \*************************************************************/
  55798. /*! no static exports found */
  55799. /***/ (function(module, exports, __webpack_require__) {
  55800. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  55801. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  55802. /***/ })
  55803. /******/ });