app.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998
  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.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.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. //
  1723. //
  1724. //
  1725. //
  1726. //
  1727. //
  1728. //
  1729. //
  1730. //
  1731. //
  1732. //
  1733. //
  1734. //
  1735. //
  1736. //
  1737. //
  1738. //
  1739. //
  1740. //
  1741. //
  1742. //
  1743. //
  1744. //
  1745. //
  1746. //
  1747. //
  1748. //
  1749. //
  1750. /* harmony default export */ __webpack_exports__["default"] = ({
  1751. props: ['credential'],
  1752. data: function data() {
  1753. return {
  1754. data: JSON.parse(this.credential)
  1755. };
  1756. },
  1757. mounted: function mounted() {
  1758. var _this = this;
  1759. console.log(this.$refs);
  1760. Echo.channel('credentials').listen('CredentialUpdated', function (e) {
  1761. // This part could potentially use a refactor.
  1762. // Probably needs a credential list component to listen for this
  1763. // even and update the corresponding credential. Currently every
  1764. // credential on the page receives this event and checks whether it was intended
  1765. // for its credential or not. I would imagine this could cause a problem
  1766. // on the group page, which will potentially have a lot more credentials from
  1767. // various assets. Better solution may be to have a credentials list component
  1768. // That listens for credential update events and updates the appropriate credential.
  1769. // There would still be multiples of those on the group credentials page, but an
  1770. // order of magnitude less of those than of individual credentials.
  1771. // It also may not be a big deal performance wise to do it like this, not sure.
  1772. var eData = JSON.parse(e.data);
  1773. if (_this.data.credid === eData.credid) {
  1774. _this.data = eData;
  1775. }
  1776. });
  1777. },
  1778. methods: {
  1779. rndStr: function rndStr(len) {
  1780. var text = "";
  1781. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  1782. for (var i = 0; i < len; i++) {
  1783. text += chars.charAt(Math.floor(Math.random() * chars.length));
  1784. }
  1785. return text;
  1786. },
  1787. getRandomPassword: function getRandomPassword(id) {
  1788. this.$refs['newpassword' + id].value = this.rndStr(16);
  1789. },
  1790. updateCredential: function updateCredential() {
  1791. this.data.credpass = this.$refs['newpassword' + this.data.credid].value;
  1792. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {})["catch"](function (error) {
  1793. console.error(error);
  1794. });
  1795. $('#credential' + this.data.credid + 'editModal').modal('hide');
  1796. }
  1797. }
  1798. });
  1799. /***/ }),
  1800. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  1801. /*!********************************************************************************************************************************************************************!*\
  1802. !*** ./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& ***!
  1803. \********************************************************************************************************************************************************************/
  1804. /*! exports provided: default */
  1805. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1806. "use strict";
  1807. __webpack_require__.r(__webpack_exports__);
  1808. //
  1809. //
  1810. //
  1811. //
  1812. //
  1813. /* harmony default export */ __webpack_exports__["default"] = ({
  1814. props: ['errors'],
  1815. data: function data() {
  1816. return {
  1817. errorList: this.errors
  1818. };
  1819. },
  1820. watch: {
  1821. errors: function errors(newErrors) {
  1822. this.errorList = newErrors;
  1823. }
  1824. }
  1825. });
  1826. /***/ }),
  1827. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  1828. /*!****************************************************************************************************************************************************************!*\
  1829. !*** ./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& ***!
  1830. \****************************************************************************************************************************************************************/
  1831. /*! exports provided: default */
  1832. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1833. "use strict";
  1834. __webpack_require__.r(__webpack_exports__);
  1835. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1836. //
  1837. //
  1838. //
  1839. //
  1840. //
  1841. //
  1842. //
  1843. //
  1844. //
  1845. //
  1846. //
  1847. //
  1848. //
  1849. //
  1850. //
  1851. //
  1852. //
  1853. //
  1854. //
  1855. //
  1856. //
  1857. //
  1858. //
  1859. //
  1860. //
  1861. //
  1862. //
  1863. //
  1864. //
  1865. //
  1866. //
  1867. //
  1868. //
  1869. //
  1870. //
  1871. //
  1872. //
  1873. //
  1874. //
  1875. /* harmony default export */ __webpack_exports__["default"] = ({
  1876. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1877. props: ['initialnotes', 'authusername'],
  1878. data: function data() {
  1879. return {
  1880. notes: this.initialnotes
  1881. };
  1882. }
  1883. });
  1884. /***/ }),
  1885. /***/ "./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&":
  1886. /*!****************************************************************************************************************************************************************************!*\
  1887. !*** ./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& ***!
  1888. \****************************************************************************************************************************************************************************/
  1889. /*! exports provided: default */
  1890. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1891. "use strict";
  1892. __webpack_require__.r(__webpack_exports__);
  1893. //
  1894. //
  1895. //
  1896. //
  1897. //
  1898. //
  1899. //
  1900. //
  1901. //
  1902. //
  1903. //
  1904. //
  1905. //
  1906. //
  1907. //
  1908. //
  1909. //
  1910. //
  1911. //
  1912. //
  1913. //
  1914. //
  1915. //
  1916. //
  1917. //
  1918. //
  1919. //
  1920. //
  1921. //
  1922. //
  1923. //
  1924. //
  1925. /* harmony default export */ __webpack_exports__["default"] = ({
  1926. props: ['populateWith', 'storeList', 'modalId'],
  1927. data: function data() {
  1928. return {
  1929. // Copies object from prop, so it doesn't mutate the object
  1930. // from the parent component. Parent component will be updated via
  1931. // Websocket if updateWorkOrder is successful.
  1932. data: JSON.parse(JSON.stringify(this.populateWith)),
  1933. storeArray: this.storeList,
  1934. id: this.modalId,
  1935. errors: []
  1936. };
  1937. },
  1938. methods: {
  1939. updateWorkOrder: function updateWorkOrder() {
  1940. var _this = this;
  1941. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  1942. $('#workordereditModal').modal('hide');
  1943. })["catch"](function (error) {
  1944. _this.errors = JSON.parse(error.response.request.response).errors;
  1945. });
  1946. }
  1947. }
  1948. });
  1949. /***/ }),
  1950. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  1951. /*!*****************************************************************************************************************************************************************!*\
  1952. !*** ./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& ***!
  1953. \*****************************************************************************************************************************************************************/
  1954. /*! exports provided: default */
  1955. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1956. "use strict";
  1957. __webpack_require__.r(__webpack_exports__);
  1958. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1959. //
  1960. //
  1961. //
  1962. //
  1963. //
  1964. //
  1965. //
  1966. //
  1967. //
  1968. //
  1969. //
  1970. //
  1971. //
  1972. //
  1973. //
  1974. //
  1975. //
  1976. //
  1977. //
  1978. //
  1979. /* harmony default export */ __webpack_exports__["default"] = ({
  1980. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1981. props: ['workOrder'],
  1982. data: function data() {
  1983. return {
  1984. data: JSON.parse(this.workOrder),
  1985. storeList: null
  1986. };
  1987. },
  1988. mounted: function mounted() {
  1989. var _this = this;
  1990. Echo.channel('work-orders').listen('WorkOrderUpdated', function (e) {
  1991. _this.data = JSON.parse(e.data);
  1992. });
  1993. axios.get('/api/stores').then(function (response) {
  1994. _this.storeList = {};
  1995. response.data.map(function (val) {
  1996. _this.storeList[val.storeid] = val;
  1997. });
  1998. })["catch"](function (error) {
  1999. console.error(error);
  2000. });
  2001. }
  2002. });
  2003. /***/ }),
  2004. /***/ "./node_modules/base64-js/index.js":
  2005. /*!*****************************************!*\
  2006. !*** ./node_modules/base64-js/index.js ***!
  2007. \*****************************************/
  2008. /*! no static exports found */
  2009. /***/ (function(module, exports, __webpack_require__) {
  2010. "use strict";
  2011. exports.byteLength = byteLength
  2012. exports.toByteArray = toByteArray
  2013. exports.fromByteArray = fromByteArray
  2014. var lookup = []
  2015. var revLookup = []
  2016. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2017. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2018. for (var i = 0, len = code.length; i < len; ++i) {
  2019. lookup[i] = code[i]
  2020. revLookup[code.charCodeAt(i)] = i
  2021. }
  2022. // Support decoding URL-safe base64 strings, as Node.js does.
  2023. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2024. revLookup['-'.charCodeAt(0)] = 62
  2025. revLookup['_'.charCodeAt(0)] = 63
  2026. function getLens (b64) {
  2027. var len = b64.length
  2028. if (len % 4 > 0) {
  2029. throw new Error('Invalid string. Length must be a multiple of 4')
  2030. }
  2031. // Trim off extra bytes after placeholder bytes are found
  2032. // See: https://github.com/beatgammit/base64-js/issues/42
  2033. var validLen = b64.indexOf('=')
  2034. if (validLen === -1) validLen = len
  2035. var placeHoldersLen = validLen === len
  2036. ? 0
  2037. : 4 - (validLen % 4)
  2038. return [validLen, placeHoldersLen]
  2039. }
  2040. // base64 is 4/3 + up to two characters of the original data
  2041. function byteLength (b64) {
  2042. var lens = getLens(b64)
  2043. var validLen = lens[0]
  2044. var placeHoldersLen = lens[1]
  2045. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2046. }
  2047. function _byteLength (b64, validLen, placeHoldersLen) {
  2048. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2049. }
  2050. function toByteArray (b64) {
  2051. var tmp
  2052. var lens = getLens(b64)
  2053. var validLen = lens[0]
  2054. var placeHoldersLen = lens[1]
  2055. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2056. var curByte = 0
  2057. // if there are placeholders, only get up to the last complete 4 chars
  2058. var len = placeHoldersLen > 0
  2059. ? validLen - 4
  2060. : validLen
  2061. var i
  2062. for (i = 0; i < len; i += 4) {
  2063. tmp =
  2064. (revLookup[b64.charCodeAt(i)] << 18) |
  2065. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2066. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2067. revLookup[b64.charCodeAt(i + 3)]
  2068. arr[curByte++] = (tmp >> 16) & 0xFF
  2069. arr[curByte++] = (tmp >> 8) & 0xFF
  2070. arr[curByte++] = tmp & 0xFF
  2071. }
  2072. if (placeHoldersLen === 2) {
  2073. tmp =
  2074. (revLookup[b64.charCodeAt(i)] << 2) |
  2075. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2076. arr[curByte++] = tmp & 0xFF
  2077. }
  2078. if (placeHoldersLen === 1) {
  2079. tmp =
  2080. (revLookup[b64.charCodeAt(i)] << 10) |
  2081. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2082. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2083. arr[curByte++] = (tmp >> 8) & 0xFF
  2084. arr[curByte++] = tmp & 0xFF
  2085. }
  2086. return arr
  2087. }
  2088. function tripletToBase64 (num) {
  2089. return lookup[num >> 18 & 0x3F] +
  2090. lookup[num >> 12 & 0x3F] +
  2091. lookup[num >> 6 & 0x3F] +
  2092. lookup[num & 0x3F]
  2093. }
  2094. function encodeChunk (uint8, start, end) {
  2095. var tmp
  2096. var output = []
  2097. for (var i = start; i < end; i += 3) {
  2098. tmp =
  2099. ((uint8[i] << 16) & 0xFF0000) +
  2100. ((uint8[i + 1] << 8) & 0xFF00) +
  2101. (uint8[i + 2] & 0xFF)
  2102. output.push(tripletToBase64(tmp))
  2103. }
  2104. return output.join('')
  2105. }
  2106. function fromByteArray (uint8) {
  2107. var tmp
  2108. var len = uint8.length
  2109. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2110. var parts = []
  2111. var maxChunkLength = 16383 // must be multiple of 3
  2112. // go through the array every three bytes, we'll deal with trailing stuff later
  2113. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2114. parts.push(encodeChunk(
  2115. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2116. ))
  2117. }
  2118. // pad the end with zeros, but make sure to not forget the extra bytes
  2119. if (extraBytes === 1) {
  2120. tmp = uint8[len - 1]
  2121. parts.push(
  2122. lookup[tmp >> 2] +
  2123. lookup[(tmp << 4) & 0x3F] +
  2124. '=='
  2125. )
  2126. } else if (extraBytes === 2) {
  2127. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2128. parts.push(
  2129. lookup[tmp >> 10] +
  2130. lookup[(tmp >> 4) & 0x3F] +
  2131. lookup[(tmp << 2) & 0x3F] +
  2132. '='
  2133. )
  2134. }
  2135. return parts.join('')
  2136. }
  2137. /***/ }),
  2138. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2139. /*!*****************************************************!*\
  2140. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2141. \*****************************************************/
  2142. /*! no static exports found */
  2143. /***/ (function(module, exports, __webpack_require__) {
  2144. /*!
  2145. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2146. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2147. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2148. */
  2149. (function (global, factory) {
  2150. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2151. undefined;
  2152. }(this, (function (exports, $, Popper) { 'use strict';
  2153. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2154. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2155. function _defineProperties(target, props) {
  2156. for (var i = 0; i < props.length; i++) {
  2157. var descriptor = props[i];
  2158. descriptor.enumerable = descriptor.enumerable || false;
  2159. descriptor.configurable = true;
  2160. if ("value" in descriptor) descriptor.writable = true;
  2161. Object.defineProperty(target, descriptor.key, descriptor);
  2162. }
  2163. }
  2164. function _createClass(Constructor, protoProps, staticProps) {
  2165. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2166. if (staticProps) _defineProperties(Constructor, staticProps);
  2167. return Constructor;
  2168. }
  2169. function _defineProperty(obj, key, value) {
  2170. if (key in obj) {
  2171. Object.defineProperty(obj, key, {
  2172. value: value,
  2173. enumerable: true,
  2174. configurable: true,
  2175. writable: true
  2176. });
  2177. } else {
  2178. obj[key] = value;
  2179. }
  2180. return obj;
  2181. }
  2182. function ownKeys(object, enumerableOnly) {
  2183. var keys = Object.keys(object);
  2184. if (Object.getOwnPropertySymbols) {
  2185. var symbols = Object.getOwnPropertySymbols(object);
  2186. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2187. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2188. });
  2189. keys.push.apply(keys, symbols);
  2190. }
  2191. return keys;
  2192. }
  2193. function _objectSpread2(target) {
  2194. for (var i = 1; i < arguments.length; i++) {
  2195. var source = arguments[i] != null ? arguments[i] : {};
  2196. if (i % 2) {
  2197. ownKeys(Object(source), true).forEach(function (key) {
  2198. _defineProperty(target, key, source[key]);
  2199. });
  2200. } else if (Object.getOwnPropertyDescriptors) {
  2201. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2202. } else {
  2203. ownKeys(Object(source)).forEach(function (key) {
  2204. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2205. });
  2206. }
  2207. }
  2208. return target;
  2209. }
  2210. function _inheritsLoose(subClass, superClass) {
  2211. subClass.prototype = Object.create(superClass.prototype);
  2212. subClass.prototype.constructor = subClass;
  2213. subClass.__proto__ = superClass;
  2214. }
  2215. /**
  2216. * --------------------------------------------------------------------------
  2217. * Bootstrap (v4.4.1): util.js
  2218. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2219. * --------------------------------------------------------------------------
  2220. */
  2221. /**
  2222. * ------------------------------------------------------------------------
  2223. * Private TransitionEnd Helpers
  2224. * ------------------------------------------------------------------------
  2225. */
  2226. var TRANSITION_END = 'transitionend';
  2227. var MAX_UID = 1000000;
  2228. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2229. function toType(obj) {
  2230. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2231. }
  2232. function getSpecialTransitionEndEvent() {
  2233. return {
  2234. bindType: TRANSITION_END,
  2235. delegateType: TRANSITION_END,
  2236. handle: function handle(event) {
  2237. if ($(event.target).is(this)) {
  2238. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2239. }
  2240. return undefined; // eslint-disable-line no-undefined
  2241. }
  2242. };
  2243. }
  2244. function transitionEndEmulator(duration) {
  2245. var _this = this;
  2246. var called = false;
  2247. $(this).one(Util.TRANSITION_END, function () {
  2248. called = true;
  2249. });
  2250. setTimeout(function () {
  2251. if (!called) {
  2252. Util.triggerTransitionEnd(_this);
  2253. }
  2254. }, duration);
  2255. return this;
  2256. }
  2257. function setTransitionEndSupport() {
  2258. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2259. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2260. }
  2261. /**
  2262. * --------------------------------------------------------------------------
  2263. * Public Util Api
  2264. * --------------------------------------------------------------------------
  2265. */
  2266. var Util = {
  2267. TRANSITION_END: 'bsTransitionEnd',
  2268. getUID: function getUID(prefix) {
  2269. do {
  2270. // eslint-disable-next-line no-bitwise
  2271. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2272. } while (document.getElementById(prefix));
  2273. return prefix;
  2274. },
  2275. getSelectorFromElement: function getSelectorFromElement(element) {
  2276. var selector = element.getAttribute('data-target');
  2277. if (!selector || selector === '#') {
  2278. var hrefAttr = element.getAttribute('href');
  2279. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2280. }
  2281. try {
  2282. return document.querySelector(selector) ? selector : null;
  2283. } catch (err) {
  2284. return null;
  2285. }
  2286. },
  2287. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2288. if (!element) {
  2289. return 0;
  2290. } // Get transition-duration of the element
  2291. var transitionDuration = $(element).css('transition-duration');
  2292. var transitionDelay = $(element).css('transition-delay');
  2293. var floatTransitionDuration = parseFloat(transitionDuration);
  2294. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2295. if (!floatTransitionDuration && !floatTransitionDelay) {
  2296. return 0;
  2297. } // If multiple durations are defined, take the first
  2298. transitionDuration = transitionDuration.split(',')[0];
  2299. transitionDelay = transitionDelay.split(',')[0];
  2300. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2301. },
  2302. reflow: function reflow(element) {
  2303. return element.offsetHeight;
  2304. },
  2305. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2306. $(element).trigger(TRANSITION_END);
  2307. },
  2308. // TODO: Remove in v5
  2309. supportsTransitionEnd: function supportsTransitionEnd() {
  2310. return Boolean(TRANSITION_END);
  2311. },
  2312. isElement: function isElement(obj) {
  2313. return (obj[0] || obj).nodeType;
  2314. },
  2315. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2316. for (var property in configTypes) {
  2317. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2318. var expectedTypes = configTypes[property];
  2319. var value = config[property];
  2320. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2321. if (!new RegExp(expectedTypes).test(valueType)) {
  2322. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2323. }
  2324. }
  2325. }
  2326. },
  2327. findShadowRoot: function findShadowRoot(element) {
  2328. if (!document.documentElement.attachShadow) {
  2329. return null;
  2330. } // Can find the shadow root otherwise it'll return the document
  2331. if (typeof element.getRootNode === 'function') {
  2332. var root = element.getRootNode();
  2333. return root instanceof ShadowRoot ? root : null;
  2334. }
  2335. if (element instanceof ShadowRoot) {
  2336. return element;
  2337. } // when we don't find a shadow root
  2338. if (!element.parentNode) {
  2339. return null;
  2340. }
  2341. return Util.findShadowRoot(element.parentNode);
  2342. },
  2343. jQueryDetection: function jQueryDetection() {
  2344. if (typeof $ === 'undefined') {
  2345. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2346. }
  2347. var version = $.fn.jquery.split(' ')[0].split('.');
  2348. var minMajor = 1;
  2349. var ltMajor = 2;
  2350. var minMinor = 9;
  2351. var minPatch = 1;
  2352. var maxMajor = 4;
  2353. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2354. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2355. }
  2356. }
  2357. };
  2358. Util.jQueryDetection();
  2359. setTransitionEndSupport();
  2360. /**
  2361. * ------------------------------------------------------------------------
  2362. * Constants
  2363. * ------------------------------------------------------------------------
  2364. */
  2365. var NAME = 'alert';
  2366. var VERSION = '4.4.1';
  2367. var DATA_KEY = 'bs.alert';
  2368. var EVENT_KEY = "." + DATA_KEY;
  2369. var DATA_API_KEY = '.data-api';
  2370. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2371. var Selector = {
  2372. DISMISS: '[data-dismiss="alert"]'
  2373. };
  2374. var Event = {
  2375. CLOSE: "close" + EVENT_KEY,
  2376. CLOSED: "closed" + EVENT_KEY,
  2377. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2378. };
  2379. var ClassName = {
  2380. ALERT: 'alert',
  2381. FADE: 'fade',
  2382. SHOW: 'show'
  2383. };
  2384. /**
  2385. * ------------------------------------------------------------------------
  2386. * Class Definition
  2387. * ------------------------------------------------------------------------
  2388. */
  2389. var Alert =
  2390. /*#__PURE__*/
  2391. function () {
  2392. function Alert(element) {
  2393. this._element = element;
  2394. } // Getters
  2395. var _proto = Alert.prototype;
  2396. // Public
  2397. _proto.close = function close(element) {
  2398. var rootElement = this._element;
  2399. if (element) {
  2400. rootElement = this._getRootElement(element);
  2401. }
  2402. var customEvent = this._triggerCloseEvent(rootElement);
  2403. if (customEvent.isDefaultPrevented()) {
  2404. return;
  2405. }
  2406. this._removeElement(rootElement);
  2407. };
  2408. _proto.dispose = function dispose() {
  2409. $.removeData(this._element, DATA_KEY);
  2410. this._element = null;
  2411. } // Private
  2412. ;
  2413. _proto._getRootElement = function _getRootElement(element) {
  2414. var selector = Util.getSelectorFromElement(element);
  2415. var parent = false;
  2416. if (selector) {
  2417. parent = document.querySelector(selector);
  2418. }
  2419. if (!parent) {
  2420. parent = $(element).closest("." + ClassName.ALERT)[0];
  2421. }
  2422. return parent;
  2423. };
  2424. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2425. var closeEvent = $.Event(Event.CLOSE);
  2426. $(element).trigger(closeEvent);
  2427. return closeEvent;
  2428. };
  2429. _proto._removeElement = function _removeElement(element) {
  2430. var _this = this;
  2431. $(element).removeClass(ClassName.SHOW);
  2432. if (!$(element).hasClass(ClassName.FADE)) {
  2433. this._destroyElement(element);
  2434. return;
  2435. }
  2436. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2437. $(element).one(Util.TRANSITION_END, function (event) {
  2438. return _this._destroyElement(element, event);
  2439. }).emulateTransitionEnd(transitionDuration);
  2440. };
  2441. _proto._destroyElement = function _destroyElement(element) {
  2442. $(element).detach().trigger(Event.CLOSED).remove();
  2443. } // Static
  2444. ;
  2445. Alert._jQueryInterface = function _jQueryInterface(config) {
  2446. return this.each(function () {
  2447. var $element = $(this);
  2448. var data = $element.data(DATA_KEY);
  2449. if (!data) {
  2450. data = new Alert(this);
  2451. $element.data(DATA_KEY, data);
  2452. }
  2453. if (config === 'close') {
  2454. data[config](this);
  2455. }
  2456. });
  2457. };
  2458. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2459. return function (event) {
  2460. if (event) {
  2461. event.preventDefault();
  2462. }
  2463. alertInstance.close(this);
  2464. };
  2465. };
  2466. _createClass(Alert, null, [{
  2467. key: "VERSION",
  2468. get: function get() {
  2469. return VERSION;
  2470. }
  2471. }]);
  2472. return Alert;
  2473. }();
  2474. /**
  2475. * ------------------------------------------------------------------------
  2476. * Data Api implementation
  2477. * ------------------------------------------------------------------------
  2478. */
  2479. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2480. /**
  2481. * ------------------------------------------------------------------------
  2482. * jQuery
  2483. * ------------------------------------------------------------------------
  2484. */
  2485. $.fn[NAME] = Alert._jQueryInterface;
  2486. $.fn[NAME].Constructor = Alert;
  2487. $.fn[NAME].noConflict = function () {
  2488. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2489. return Alert._jQueryInterface;
  2490. };
  2491. /**
  2492. * ------------------------------------------------------------------------
  2493. * Constants
  2494. * ------------------------------------------------------------------------
  2495. */
  2496. var NAME$1 = 'button';
  2497. var VERSION$1 = '4.4.1';
  2498. var DATA_KEY$1 = 'bs.button';
  2499. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2500. var DATA_API_KEY$1 = '.data-api';
  2501. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2502. var ClassName$1 = {
  2503. ACTIVE: 'active',
  2504. BUTTON: 'btn',
  2505. FOCUS: 'focus'
  2506. };
  2507. var Selector$1 = {
  2508. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2509. DATA_TOGGLES: '[data-toggle="buttons"]',
  2510. DATA_TOGGLE: '[data-toggle="button"]',
  2511. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2512. INPUT: 'input:not([type="hidden"])',
  2513. ACTIVE: '.active',
  2514. BUTTON: '.btn'
  2515. };
  2516. var Event$1 = {
  2517. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2518. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2519. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2520. };
  2521. /**
  2522. * ------------------------------------------------------------------------
  2523. * Class Definition
  2524. * ------------------------------------------------------------------------
  2525. */
  2526. var Button =
  2527. /*#__PURE__*/
  2528. function () {
  2529. function Button(element) {
  2530. this._element = element;
  2531. } // Getters
  2532. var _proto = Button.prototype;
  2533. // Public
  2534. _proto.toggle = function toggle() {
  2535. var triggerChangeEvent = true;
  2536. var addAriaPressed = true;
  2537. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2538. if (rootElement) {
  2539. var input = this._element.querySelector(Selector$1.INPUT);
  2540. if (input) {
  2541. if (input.type === 'radio') {
  2542. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2543. triggerChangeEvent = false;
  2544. } else {
  2545. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2546. if (activeElement) {
  2547. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2548. }
  2549. }
  2550. } else if (input.type === 'checkbox') {
  2551. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2552. triggerChangeEvent = false;
  2553. }
  2554. } else {
  2555. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2556. triggerChangeEvent = false;
  2557. }
  2558. if (triggerChangeEvent) {
  2559. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2560. $(input).trigger('change');
  2561. }
  2562. input.focus();
  2563. addAriaPressed = false;
  2564. }
  2565. }
  2566. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2567. if (addAriaPressed) {
  2568. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2569. }
  2570. if (triggerChangeEvent) {
  2571. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2572. }
  2573. }
  2574. };
  2575. _proto.dispose = function dispose() {
  2576. $.removeData(this._element, DATA_KEY$1);
  2577. this._element = null;
  2578. } // Static
  2579. ;
  2580. Button._jQueryInterface = function _jQueryInterface(config) {
  2581. return this.each(function () {
  2582. var data = $(this).data(DATA_KEY$1);
  2583. if (!data) {
  2584. data = new Button(this);
  2585. $(this).data(DATA_KEY$1, data);
  2586. }
  2587. if (config === 'toggle') {
  2588. data[config]();
  2589. }
  2590. });
  2591. };
  2592. _createClass(Button, null, [{
  2593. key: "VERSION",
  2594. get: function get() {
  2595. return VERSION$1;
  2596. }
  2597. }]);
  2598. return Button;
  2599. }();
  2600. /**
  2601. * ------------------------------------------------------------------------
  2602. * Data Api implementation
  2603. * ------------------------------------------------------------------------
  2604. */
  2605. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2606. var button = event.target;
  2607. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2608. button = $(button).closest(Selector$1.BUTTON)[0];
  2609. }
  2610. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2611. event.preventDefault(); // work around Firefox bug #1540995
  2612. } else {
  2613. var inputBtn = button.querySelector(Selector$1.INPUT);
  2614. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2615. event.preventDefault(); // work around Firefox bug #1540995
  2616. return;
  2617. }
  2618. Button._jQueryInterface.call($(button), 'toggle');
  2619. }
  2620. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2621. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2622. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2623. });
  2624. $(window).on(Event$1.LOAD_DATA_API, function () {
  2625. // ensure correct active class is set to match the controls' actual values/states
  2626. // find all checkboxes/readio buttons inside data-toggle groups
  2627. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2628. for (var i = 0, len = buttons.length; i < len; i++) {
  2629. var button = buttons[i];
  2630. var input = button.querySelector(Selector$1.INPUT);
  2631. if (input.checked || input.hasAttribute('checked')) {
  2632. button.classList.add(ClassName$1.ACTIVE);
  2633. } else {
  2634. button.classList.remove(ClassName$1.ACTIVE);
  2635. }
  2636. } // find all button toggles
  2637. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2638. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2639. var _button = buttons[_i];
  2640. if (_button.getAttribute('aria-pressed') === 'true') {
  2641. _button.classList.add(ClassName$1.ACTIVE);
  2642. } else {
  2643. _button.classList.remove(ClassName$1.ACTIVE);
  2644. }
  2645. }
  2646. });
  2647. /**
  2648. * ------------------------------------------------------------------------
  2649. * jQuery
  2650. * ------------------------------------------------------------------------
  2651. */
  2652. $.fn[NAME$1] = Button._jQueryInterface;
  2653. $.fn[NAME$1].Constructor = Button;
  2654. $.fn[NAME$1].noConflict = function () {
  2655. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2656. return Button._jQueryInterface;
  2657. };
  2658. /**
  2659. * ------------------------------------------------------------------------
  2660. * Constants
  2661. * ------------------------------------------------------------------------
  2662. */
  2663. var NAME$2 = 'carousel';
  2664. var VERSION$2 = '4.4.1';
  2665. var DATA_KEY$2 = 'bs.carousel';
  2666. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2667. var DATA_API_KEY$2 = '.data-api';
  2668. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2669. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2670. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2671. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2672. var SWIPE_THRESHOLD = 40;
  2673. var Default = {
  2674. interval: 5000,
  2675. keyboard: true,
  2676. slide: false,
  2677. pause: 'hover',
  2678. wrap: true,
  2679. touch: true
  2680. };
  2681. var DefaultType = {
  2682. interval: '(number|boolean)',
  2683. keyboard: 'boolean',
  2684. slide: '(boolean|string)',
  2685. pause: '(string|boolean)',
  2686. wrap: 'boolean',
  2687. touch: 'boolean'
  2688. };
  2689. var Direction = {
  2690. NEXT: 'next',
  2691. PREV: 'prev',
  2692. LEFT: 'left',
  2693. RIGHT: 'right'
  2694. };
  2695. var Event$2 = {
  2696. SLIDE: "slide" + EVENT_KEY$2,
  2697. SLID: "slid" + EVENT_KEY$2,
  2698. KEYDOWN: "keydown" + EVENT_KEY$2,
  2699. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2700. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2701. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2702. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2703. TOUCHEND: "touchend" + EVENT_KEY$2,
  2704. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2705. POINTERUP: "pointerup" + EVENT_KEY$2,
  2706. DRAG_START: "dragstart" + EVENT_KEY$2,
  2707. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2708. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2709. };
  2710. var ClassName$2 = {
  2711. CAROUSEL: 'carousel',
  2712. ACTIVE: 'active',
  2713. SLIDE: 'slide',
  2714. RIGHT: 'carousel-item-right',
  2715. LEFT: 'carousel-item-left',
  2716. NEXT: 'carousel-item-next',
  2717. PREV: 'carousel-item-prev',
  2718. ITEM: 'carousel-item',
  2719. POINTER_EVENT: 'pointer-event'
  2720. };
  2721. var Selector$2 = {
  2722. ACTIVE: '.active',
  2723. ACTIVE_ITEM: '.active.carousel-item',
  2724. ITEM: '.carousel-item',
  2725. ITEM_IMG: '.carousel-item img',
  2726. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2727. INDICATORS: '.carousel-indicators',
  2728. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2729. DATA_RIDE: '[data-ride="carousel"]'
  2730. };
  2731. var PointerType = {
  2732. TOUCH: 'touch',
  2733. PEN: 'pen'
  2734. };
  2735. /**
  2736. * ------------------------------------------------------------------------
  2737. * Class Definition
  2738. * ------------------------------------------------------------------------
  2739. */
  2740. var Carousel =
  2741. /*#__PURE__*/
  2742. function () {
  2743. function Carousel(element, config) {
  2744. this._items = null;
  2745. this._interval = null;
  2746. this._activeElement = null;
  2747. this._isPaused = false;
  2748. this._isSliding = false;
  2749. this.touchTimeout = null;
  2750. this.touchStartX = 0;
  2751. this.touchDeltaX = 0;
  2752. this._config = this._getConfig(config);
  2753. this._element = element;
  2754. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2755. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2756. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2757. this._addEventListeners();
  2758. } // Getters
  2759. var _proto = Carousel.prototype;
  2760. // Public
  2761. _proto.next = function next() {
  2762. if (!this._isSliding) {
  2763. this._slide(Direction.NEXT);
  2764. }
  2765. };
  2766. _proto.nextWhenVisible = function nextWhenVisible() {
  2767. // Don't call next when the page isn't visible
  2768. // or the carousel or its parent isn't visible
  2769. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2770. this.next();
  2771. }
  2772. };
  2773. _proto.prev = function prev() {
  2774. if (!this._isSliding) {
  2775. this._slide(Direction.PREV);
  2776. }
  2777. };
  2778. _proto.pause = function pause(event) {
  2779. if (!event) {
  2780. this._isPaused = true;
  2781. }
  2782. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2783. Util.triggerTransitionEnd(this._element);
  2784. this.cycle(true);
  2785. }
  2786. clearInterval(this._interval);
  2787. this._interval = null;
  2788. };
  2789. _proto.cycle = function cycle(event) {
  2790. if (!event) {
  2791. this._isPaused = false;
  2792. }
  2793. if (this._interval) {
  2794. clearInterval(this._interval);
  2795. this._interval = null;
  2796. }
  2797. if (this._config.interval && !this._isPaused) {
  2798. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2799. }
  2800. };
  2801. _proto.to = function to(index) {
  2802. var _this = this;
  2803. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2804. var activeIndex = this._getItemIndex(this._activeElement);
  2805. if (index > this._items.length - 1 || index < 0) {
  2806. return;
  2807. }
  2808. if (this._isSliding) {
  2809. $(this._element).one(Event$2.SLID, function () {
  2810. return _this.to(index);
  2811. });
  2812. return;
  2813. }
  2814. if (activeIndex === index) {
  2815. this.pause();
  2816. this.cycle();
  2817. return;
  2818. }
  2819. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  2820. this._slide(direction, this._items[index]);
  2821. };
  2822. _proto.dispose = function dispose() {
  2823. $(this._element).off(EVENT_KEY$2);
  2824. $.removeData(this._element, DATA_KEY$2);
  2825. this._items = null;
  2826. this._config = null;
  2827. this._element = null;
  2828. this._interval = null;
  2829. this._isPaused = null;
  2830. this._isSliding = null;
  2831. this._activeElement = null;
  2832. this._indicatorsElement = null;
  2833. } // Private
  2834. ;
  2835. _proto._getConfig = function _getConfig(config) {
  2836. config = _objectSpread2({}, Default, {}, config);
  2837. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2838. return config;
  2839. };
  2840. _proto._handleSwipe = function _handleSwipe() {
  2841. var absDeltax = Math.abs(this.touchDeltaX);
  2842. if (absDeltax <= SWIPE_THRESHOLD) {
  2843. return;
  2844. }
  2845. var direction = absDeltax / this.touchDeltaX;
  2846. this.touchDeltaX = 0; // swipe left
  2847. if (direction > 0) {
  2848. this.prev();
  2849. } // swipe right
  2850. if (direction < 0) {
  2851. this.next();
  2852. }
  2853. };
  2854. _proto._addEventListeners = function _addEventListeners() {
  2855. var _this2 = this;
  2856. if (this._config.keyboard) {
  2857. $(this._element).on(Event$2.KEYDOWN, function (event) {
  2858. return _this2._keydown(event);
  2859. });
  2860. }
  2861. if (this._config.pause === 'hover') {
  2862. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  2863. return _this2.pause(event);
  2864. }).on(Event$2.MOUSELEAVE, function (event) {
  2865. return _this2.cycle(event);
  2866. });
  2867. }
  2868. if (this._config.touch) {
  2869. this._addTouchEventListeners();
  2870. }
  2871. };
  2872. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2873. var _this3 = this;
  2874. if (!this._touchSupported) {
  2875. return;
  2876. }
  2877. var start = function start(event) {
  2878. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2879. _this3.touchStartX = event.originalEvent.clientX;
  2880. } else if (!_this3._pointerEvent) {
  2881. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2882. }
  2883. };
  2884. var move = function move(event) {
  2885. // ensure swiping with one touch and not pinching
  2886. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2887. _this3.touchDeltaX = 0;
  2888. } else {
  2889. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2890. }
  2891. };
  2892. var end = function end(event) {
  2893. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2894. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2895. }
  2896. _this3._handleSwipe();
  2897. if (_this3._config.pause === 'hover') {
  2898. // If it's a touch-enabled device, mouseenter/leave are fired as
  2899. // part of the mouse compatibility events on first tap - the carousel
  2900. // would stop cycling until user tapped out of it;
  2901. // here, we listen for touchend, explicitly pause the carousel
  2902. // (as if it's the second time we tap on it, mouseenter compat event
  2903. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2904. // events to fire) we explicitly restart cycling
  2905. _this3.pause();
  2906. if (_this3.touchTimeout) {
  2907. clearTimeout(_this3.touchTimeout);
  2908. }
  2909. _this3.touchTimeout = setTimeout(function (event) {
  2910. return _this3.cycle(event);
  2911. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2912. }
  2913. };
  2914. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  2915. return e.preventDefault();
  2916. });
  2917. if (this._pointerEvent) {
  2918. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  2919. return start(event);
  2920. });
  2921. $(this._element).on(Event$2.POINTERUP, function (event) {
  2922. return end(event);
  2923. });
  2924. this._element.classList.add(ClassName$2.POINTER_EVENT);
  2925. } else {
  2926. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  2927. return start(event);
  2928. });
  2929. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  2930. return move(event);
  2931. });
  2932. $(this._element).on(Event$2.TOUCHEND, function (event) {
  2933. return end(event);
  2934. });
  2935. }
  2936. };
  2937. _proto._keydown = function _keydown(event) {
  2938. if (/input|textarea/i.test(event.target.tagName)) {
  2939. return;
  2940. }
  2941. switch (event.which) {
  2942. case ARROW_LEFT_KEYCODE:
  2943. event.preventDefault();
  2944. this.prev();
  2945. break;
  2946. case ARROW_RIGHT_KEYCODE:
  2947. event.preventDefault();
  2948. this.next();
  2949. break;
  2950. }
  2951. };
  2952. _proto._getItemIndex = function _getItemIndex(element) {
  2953. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  2954. return this._items.indexOf(element);
  2955. };
  2956. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2957. var isNextDirection = direction === Direction.NEXT;
  2958. var isPrevDirection = direction === Direction.PREV;
  2959. var activeIndex = this._getItemIndex(activeElement);
  2960. var lastItemIndex = this._items.length - 1;
  2961. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2962. if (isGoingToWrap && !this._config.wrap) {
  2963. return activeElement;
  2964. }
  2965. var delta = direction === Direction.PREV ? -1 : 1;
  2966. var itemIndex = (activeIndex + delta) % this._items.length;
  2967. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2968. };
  2969. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2970. var targetIndex = this._getItemIndex(relatedTarget);
  2971. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  2972. var slideEvent = $.Event(Event$2.SLIDE, {
  2973. relatedTarget: relatedTarget,
  2974. direction: eventDirectionName,
  2975. from: fromIndex,
  2976. to: targetIndex
  2977. });
  2978. $(this._element).trigger(slideEvent);
  2979. return slideEvent;
  2980. };
  2981. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2982. if (this._indicatorsElement) {
  2983. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  2984. $(indicators).removeClass(ClassName$2.ACTIVE);
  2985. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2986. if (nextIndicator) {
  2987. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  2988. }
  2989. }
  2990. };
  2991. _proto._slide = function _slide(direction, element) {
  2992. var _this4 = this;
  2993. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2994. var activeElementIndex = this._getItemIndex(activeElement);
  2995. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2996. var nextElementIndex = this._getItemIndex(nextElement);
  2997. var isCycling = Boolean(this._interval);
  2998. var directionalClassName;
  2999. var orderClassName;
  3000. var eventDirectionName;
  3001. if (direction === Direction.NEXT) {
  3002. directionalClassName = ClassName$2.LEFT;
  3003. orderClassName = ClassName$2.NEXT;
  3004. eventDirectionName = Direction.LEFT;
  3005. } else {
  3006. directionalClassName = ClassName$2.RIGHT;
  3007. orderClassName = ClassName$2.PREV;
  3008. eventDirectionName = Direction.RIGHT;
  3009. }
  3010. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3011. this._isSliding = false;
  3012. return;
  3013. }
  3014. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3015. if (slideEvent.isDefaultPrevented()) {
  3016. return;
  3017. }
  3018. if (!activeElement || !nextElement) {
  3019. // Some weirdness is happening, so we bail
  3020. return;
  3021. }
  3022. this._isSliding = true;
  3023. if (isCycling) {
  3024. this.pause();
  3025. }
  3026. this._setActiveIndicatorElement(nextElement);
  3027. var slidEvent = $.Event(Event$2.SLID, {
  3028. relatedTarget: nextElement,
  3029. direction: eventDirectionName,
  3030. from: activeElementIndex,
  3031. to: nextElementIndex
  3032. });
  3033. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3034. $(nextElement).addClass(orderClassName);
  3035. Util.reflow(nextElement);
  3036. $(activeElement).addClass(directionalClassName);
  3037. $(nextElement).addClass(directionalClassName);
  3038. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3039. if (nextElementInterval) {
  3040. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3041. this._config.interval = nextElementInterval;
  3042. } else {
  3043. this._config.interval = this._config.defaultInterval || this._config.interval;
  3044. }
  3045. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3046. $(activeElement).one(Util.TRANSITION_END, function () {
  3047. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3048. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3049. _this4._isSliding = false;
  3050. setTimeout(function () {
  3051. return $(_this4._element).trigger(slidEvent);
  3052. }, 0);
  3053. }).emulateTransitionEnd(transitionDuration);
  3054. } else {
  3055. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3056. $(nextElement).addClass(ClassName$2.ACTIVE);
  3057. this._isSliding = false;
  3058. $(this._element).trigger(slidEvent);
  3059. }
  3060. if (isCycling) {
  3061. this.cycle();
  3062. }
  3063. } // Static
  3064. ;
  3065. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3066. return this.each(function () {
  3067. var data = $(this).data(DATA_KEY$2);
  3068. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3069. if (typeof config === 'object') {
  3070. _config = _objectSpread2({}, _config, {}, config);
  3071. }
  3072. var action = typeof config === 'string' ? config : _config.slide;
  3073. if (!data) {
  3074. data = new Carousel(this, _config);
  3075. $(this).data(DATA_KEY$2, data);
  3076. }
  3077. if (typeof config === 'number') {
  3078. data.to(config);
  3079. } else if (typeof action === 'string') {
  3080. if (typeof data[action] === 'undefined') {
  3081. throw new TypeError("No method named \"" + action + "\"");
  3082. }
  3083. data[action]();
  3084. } else if (_config.interval && _config.ride) {
  3085. data.pause();
  3086. data.cycle();
  3087. }
  3088. });
  3089. };
  3090. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3091. var selector = Util.getSelectorFromElement(this);
  3092. if (!selector) {
  3093. return;
  3094. }
  3095. var target = $(selector)[0];
  3096. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3097. return;
  3098. }
  3099. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3100. var slideIndex = this.getAttribute('data-slide-to');
  3101. if (slideIndex) {
  3102. config.interval = false;
  3103. }
  3104. Carousel._jQueryInterface.call($(target), config);
  3105. if (slideIndex) {
  3106. $(target).data(DATA_KEY$2).to(slideIndex);
  3107. }
  3108. event.preventDefault();
  3109. };
  3110. _createClass(Carousel, null, [{
  3111. key: "VERSION",
  3112. get: function get() {
  3113. return VERSION$2;
  3114. }
  3115. }, {
  3116. key: "Default",
  3117. get: function get() {
  3118. return Default;
  3119. }
  3120. }]);
  3121. return Carousel;
  3122. }();
  3123. /**
  3124. * ------------------------------------------------------------------------
  3125. * Data Api implementation
  3126. * ------------------------------------------------------------------------
  3127. */
  3128. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3129. $(window).on(Event$2.LOAD_DATA_API, function () {
  3130. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3131. for (var i = 0, len = carousels.length; i < len; i++) {
  3132. var $carousel = $(carousels[i]);
  3133. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3134. }
  3135. });
  3136. /**
  3137. * ------------------------------------------------------------------------
  3138. * jQuery
  3139. * ------------------------------------------------------------------------
  3140. */
  3141. $.fn[NAME$2] = Carousel._jQueryInterface;
  3142. $.fn[NAME$2].Constructor = Carousel;
  3143. $.fn[NAME$2].noConflict = function () {
  3144. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3145. return Carousel._jQueryInterface;
  3146. };
  3147. /**
  3148. * ------------------------------------------------------------------------
  3149. * Constants
  3150. * ------------------------------------------------------------------------
  3151. */
  3152. var NAME$3 = 'collapse';
  3153. var VERSION$3 = '4.4.1';
  3154. var DATA_KEY$3 = 'bs.collapse';
  3155. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3156. var DATA_API_KEY$3 = '.data-api';
  3157. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3158. var Default$1 = {
  3159. toggle: true,
  3160. parent: ''
  3161. };
  3162. var DefaultType$1 = {
  3163. toggle: 'boolean',
  3164. parent: '(string|element)'
  3165. };
  3166. var Event$3 = {
  3167. SHOW: "show" + EVENT_KEY$3,
  3168. SHOWN: "shown" + EVENT_KEY$3,
  3169. HIDE: "hide" + EVENT_KEY$3,
  3170. HIDDEN: "hidden" + EVENT_KEY$3,
  3171. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3172. };
  3173. var ClassName$3 = {
  3174. SHOW: 'show',
  3175. COLLAPSE: 'collapse',
  3176. COLLAPSING: 'collapsing',
  3177. COLLAPSED: 'collapsed'
  3178. };
  3179. var Dimension = {
  3180. WIDTH: 'width',
  3181. HEIGHT: 'height'
  3182. };
  3183. var Selector$3 = {
  3184. ACTIVES: '.show, .collapsing',
  3185. DATA_TOGGLE: '[data-toggle="collapse"]'
  3186. };
  3187. /**
  3188. * ------------------------------------------------------------------------
  3189. * Class Definition
  3190. * ------------------------------------------------------------------------
  3191. */
  3192. var Collapse =
  3193. /*#__PURE__*/
  3194. function () {
  3195. function Collapse(element, config) {
  3196. this._isTransitioning = false;
  3197. this._element = element;
  3198. this._config = this._getConfig(config);
  3199. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3200. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3201. for (var i = 0, len = toggleList.length; i < len; i++) {
  3202. var elem = toggleList[i];
  3203. var selector = Util.getSelectorFromElement(elem);
  3204. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3205. return foundElem === element;
  3206. });
  3207. if (selector !== null && filterElement.length > 0) {
  3208. this._selector = selector;
  3209. this._triggerArray.push(elem);
  3210. }
  3211. }
  3212. this._parent = this._config.parent ? this._getParent() : null;
  3213. if (!this._config.parent) {
  3214. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3215. }
  3216. if (this._config.toggle) {
  3217. this.toggle();
  3218. }
  3219. } // Getters
  3220. var _proto = Collapse.prototype;
  3221. // Public
  3222. _proto.toggle = function toggle() {
  3223. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3224. this.hide();
  3225. } else {
  3226. this.show();
  3227. }
  3228. };
  3229. _proto.show = function show() {
  3230. var _this = this;
  3231. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3232. return;
  3233. }
  3234. var actives;
  3235. var activesData;
  3236. if (this._parent) {
  3237. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3238. if (typeof _this._config.parent === 'string') {
  3239. return elem.getAttribute('data-parent') === _this._config.parent;
  3240. }
  3241. return elem.classList.contains(ClassName$3.COLLAPSE);
  3242. });
  3243. if (actives.length === 0) {
  3244. actives = null;
  3245. }
  3246. }
  3247. if (actives) {
  3248. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3249. if (activesData && activesData._isTransitioning) {
  3250. return;
  3251. }
  3252. }
  3253. var startEvent = $.Event(Event$3.SHOW);
  3254. $(this._element).trigger(startEvent);
  3255. if (startEvent.isDefaultPrevented()) {
  3256. return;
  3257. }
  3258. if (actives) {
  3259. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3260. if (!activesData) {
  3261. $(actives).data(DATA_KEY$3, null);
  3262. }
  3263. }
  3264. var dimension = this._getDimension();
  3265. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3266. this._element.style[dimension] = 0;
  3267. if (this._triggerArray.length) {
  3268. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3269. }
  3270. this.setTransitioning(true);
  3271. var complete = function complete() {
  3272. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3273. _this._element.style[dimension] = '';
  3274. _this.setTransitioning(false);
  3275. $(_this._element).trigger(Event$3.SHOWN);
  3276. };
  3277. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3278. var scrollSize = "scroll" + capitalizedDimension;
  3279. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3280. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3281. this._element.style[dimension] = this._element[scrollSize] + "px";
  3282. };
  3283. _proto.hide = function hide() {
  3284. var _this2 = this;
  3285. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3286. return;
  3287. }
  3288. var startEvent = $.Event(Event$3.HIDE);
  3289. $(this._element).trigger(startEvent);
  3290. if (startEvent.isDefaultPrevented()) {
  3291. return;
  3292. }
  3293. var dimension = this._getDimension();
  3294. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3295. Util.reflow(this._element);
  3296. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3297. var triggerArrayLength = this._triggerArray.length;
  3298. if (triggerArrayLength > 0) {
  3299. for (var i = 0; i < triggerArrayLength; i++) {
  3300. var trigger = this._triggerArray[i];
  3301. var selector = Util.getSelectorFromElement(trigger);
  3302. if (selector !== null) {
  3303. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3304. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3305. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3306. }
  3307. }
  3308. }
  3309. }
  3310. this.setTransitioning(true);
  3311. var complete = function complete() {
  3312. _this2.setTransitioning(false);
  3313. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3314. };
  3315. this._element.style[dimension] = '';
  3316. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3317. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3318. };
  3319. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3320. this._isTransitioning = isTransitioning;
  3321. };
  3322. _proto.dispose = function dispose() {
  3323. $.removeData(this._element, DATA_KEY$3);
  3324. this._config = null;
  3325. this._parent = null;
  3326. this._element = null;
  3327. this._triggerArray = null;
  3328. this._isTransitioning = null;
  3329. } // Private
  3330. ;
  3331. _proto._getConfig = function _getConfig(config) {
  3332. config = _objectSpread2({}, Default$1, {}, config);
  3333. config.toggle = Boolean(config.toggle); // Coerce string values
  3334. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3335. return config;
  3336. };
  3337. _proto._getDimension = function _getDimension() {
  3338. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3339. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3340. };
  3341. _proto._getParent = function _getParent() {
  3342. var _this3 = this;
  3343. var parent;
  3344. if (Util.isElement(this._config.parent)) {
  3345. parent = this._config.parent; // It's a jQuery object
  3346. if (typeof this._config.parent.jquery !== 'undefined') {
  3347. parent = this._config.parent[0];
  3348. }
  3349. } else {
  3350. parent = document.querySelector(this._config.parent);
  3351. }
  3352. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3353. var children = [].slice.call(parent.querySelectorAll(selector));
  3354. $(children).each(function (i, element) {
  3355. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3356. });
  3357. return parent;
  3358. };
  3359. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3360. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3361. if (triggerArray.length) {
  3362. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3363. }
  3364. } // Static
  3365. ;
  3366. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3367. var selector = Util.getSelectorFromElement(element);
  3368. return selector ? document.querySelector(selector) : null;
  3369. };
  3370. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3371. return this.each(function () {
  3372. var $this = $(this);
  3373. var data = $this.data(DATA_KEY$3);
  3374. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3375. if (!data && _config.toggle && /show|hide/.test(config)) {
  3376. _config.toggle = false;
  3377. }
  3378. if (!data) {
  3379. data = new Collapse(this, _config);
  3380. $this.data(DATA_KEY$3, data);
  3381. }
  3382. if (typeof config === 'string') {
  3383. if (typeof data[config] === 'undefined') {
  3384. throw new TypeError("No method named \"" + config + "\"");
  3385. }
  3386. data[config]();
  3387. }
  3388. });
  3389. };
  3390. _createClass(Collapse, null, [{
  3391. key: "VERSION",
  3392. get: function get() {
  3393. return VERSION$3;
  3394. }
  3395. }, {
  3396. key: "Default",
  3397. get: function get() {
  3398. return Default$1;
  3399. }
  3400. }]);
  3401. return Collapse;
  3402. }();
  3403. /**
  3404. * ------------------------------------------------------------------------
  3405. * Data Api implementation
  3406. * ------------------------------------------------------------------------
  3407. */
  3408. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3409. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3410. if (event.currentTarget.tagName === 'A') {
  3411. event.preventDefault();
  3412. }
  3413. var $trigger = $(this);
  3414. var selector = Util.getSelectorFromElement(this);
  3415. var selectors = [].slice.call(document.querySelectorAll(selector));
  3416. $(selectors).each(function () {
  3417. var $target = $(this);
  3418. var data = $target.data(DATA_KEY$3);
  3419. var config = data ? 'toggle' : $trigger.data();
  3420. Collapse._jQueryInterface.call($target, config);
  3421. });
  3422. });
  3423. /**
  3424. * ------------------------------------------------------------------------
  3425. * jQuery
  3426. * ------------------------------------------------------------------------
  3427. */
  3428. $.fn[NAME$3] = Collapse._jQueryInterface;
  3429. $.fn[NAME$3].Constructor = Collapse;
  3430. $.fn[NAME$3].noConflict = function () {
  3431. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3432. return Collapse._jQueryInterface;
  3433. };
  3434. /**
  3435. * ------------------------------------------------------------------------
  3436. * Constants
  3437. * ------------------------------------------------------------------------
  3438. */
  3439. var NAME$4 = 'dropdown';
  3440. var VERSION$4 = '4.4.1';
  3441. var DATA_KEY$4 = 'bs.dropdown';
  3442. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3443. var DATA_API_KEY$4 = '.data-api';
  3444. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3445. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3446. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3447. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3448. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3449. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3450. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3451. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3452. var Event$4 = {
  3453. HIDE: "hide" + EVENT_KEY$4,
  3454. HIDDEN: "hidden" + EVENT_KEY$4,
  3455. SHOW: "show" + EVENT_KEY$4,
  3456. SHOWN: "shown" + EVENT_KEY$4,
  3457. CLICK: "click" + EVENT_KEY$4,
  3458. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3459. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3460. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3461. };
  3462. var ClassName$4 = {
  3463. DISABLED: 'disabled',
  3464. SHOW: 'show',
  3465. DROPUP: 'dropup',
  3466. DROPRIGHT: 'dropright',
  3467. DROPLEFT: 'dropleft',
  3468. MENURIGHT: 'dropdown-menu-right',
  3469. MENULEFT: 'dropdown-menu-left',
  3470. POSITION_STATIC: 'position-static'
  3471. };
  3472. var Selector$4 = {
  3473. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3474. FORM_CHILD: '.dropdown form',
  3475. MENU: '.dropdown-menu',
  3476. NAVBAR_NAV: '.navbar-nav',
  3477. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3478. };
  3479. var AttachmentMap = {
  3480. TOP: 'top-start',
  3481. TOPEND: 'top-end',
  3482. BOTTOM: 'bottom-start',
  3483. BOTTOMEND: 'bottom-end',
  3484. RIGHT: 'right-start',
  3485. RIGHTEND: 'right-end',
  3486. LEFT: 'left-start',
  3487. LEFTEND: 'left-end'
  3488. };
  3489. var Default$2 = {
  3490. offset: 0,
  3491. flip: true,
  3492. boundary: 'scrollParent',
  3493. reference: 'toggle',
  3494. display: 'dynamic',
  3495. popperConfig: null
  3496. };
  3497. var DefaultType$2 = {
  3498. offset: '(number|string|function)',
  3499. flip: 'boolean',
  3500. boundary: '(string|element)',
  3501. reference: '(string|element)',
  3502. display: 'string',
  3503. popperConfig: '(null|object)'
  3504. };
  3505. /**
  3506. * ------------------------------------------------------------------------
  3507. * Class Definition
  3508. * ------------------------------------------------------------------------
  3509. */
  3510. var Dropdown =
  3511. /*#__PURE__*/
  3512. function () {
  3513. function Dropdown(element, config) {
  3514. this._element = element;
  3515. this._popper = null;
  3516. this._config = this._getConfig(config);
  3517. this._menu = this._getMenuElement();
  3518. this._inNavbar = this._detectNavbar();
  3519. this._addEventListeners();
  3520. } // Getters
  3521. var _proto = Dropdown.prototype;
  3522. // Public
  3523. _proto.toggle = function toggle() {
  3524. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3525. return;
  3526. }
  3527. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3528. Dropdown._clearMenus();
  3529. if (isActive) {
  3530. return;
  3531. }
  3532. this.show(true);
  3533. };
  3534. _proto.show = function show(usePopper) {
  3535. if (usePopper === void 0) {
  3536. usePopper = false;
  3537. }
  3538. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3539. return;
  3540. }
  3541. var relatedTarget = {
  3542. relatedTarget: this._element
  3543. };
  3544. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3545. var parent = Dropdown._getParentFromElement(this._element);
  3546. $(parent).trigger(showEvent);
  3547. if (showEvent.isDefaultPrevented()) {
  3548. return;
  3549. } // Disable totally Popper.js for Dropdown in Navbar
  3550. if (!this._inNavbar && usePopper) {
  3551. /**
  3552. * Check for Popper dependency
  3553. * Popper - https://popper.js.org
  3554. */
  3555. if (typeof Popper === 'undefined') {
  3556. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3557. }
  3558. var referenceElement = this._element;
  3559. if (this._config.reference === 'parent') {
  3560. referenceElement = parent;
  3561. } else if (Util.isElement(this._config.reference)) {
  3562. referenceElement = this._config.reference; // Check if it's jQuery element
  3563. if (typeof this._config.reference.jquery !== 'undefined') {
  3564. referenceElement = this._config.reference[0];
  3565. }
  3566. } // If boundary is not `scrollParent`, then set position to `static`
  3567. // to allow the menu to "escape" the scroll parent's boundaries
  3568. // https://github.com/twbs/bootstrap/issues/24251
  3569. if (this._config.boundary !== 'scrollParent') {
  3570. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3571. }
  3572. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3573. } // If this is a touch-enabled device we add extra
  3574. // empty mouseover listeners to the body's immediate children;
  3575. // only needed because of broken event delegation on iOS
  3576. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3577. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3578. $(document.body).children().on('mouseover', null, $.noop);
  3579. }
  3580. this._element.focus();
  3581. this._element.setAttribute('aria-expanded', true);
  3582. $(this._menu).toggleClass(ClassName$4.SHOW);
  3583. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3584. };
  3585. _proto.hide = function hide() {
  3586. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3587. return;
  3588. }
  3589. var relatedTarget = {
  3590. relatedTarget: this._element
  3591. };
  3592. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3593. var parent = Dropdown._getParentFromElement(this._element);
  3594. $(parent).trigger(hideEvent);
  3595. if (hideEvent.isDefaultPrevented()) {
  3596. return;
  3597. }
  3598. if (this._popper) {
  3599. this._popper.destroy();
  3600. }
  3601. $(this._menu).toggleClass(ClassName$4.SHOW);
  3602. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3603. };
  3604. _proto.dispose = function dispose() {
  3605. $.removeData(this._element, DATA_KEY$4);
  3606. $(this._element).off(EVENT_KEY$4);
  3607. this._element = null;
  3608. this._menu = null;
  3609. if (this._popper !== null) {
  3610. this._popper.destroy();
  3611. this._popper = null;
  3612. }
  3613. };
  3614. _proto.update = function update() {
  3615. this._inNavbar = this._detectNavbar();
  3616. if (this._popper !== null) {
  3617. this._popper.scheduleUpdate();
  3618. }
  3619. } // Private
  3620. ;
  3621. _proto._addEventListeners = function _addEventListeners() {
  3622. var _this = this;
  3623. $(this._element).on(Event$4.CLICK, function (event) {
  3624. event.preventDefault();
  3625. event.stopPropagation();
  3626. _this.toggle();
  3627. });
  3628. };
  3629. _proto._getConfig = function _getConfig(config) {
  3630. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3631. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3632. return config;
  3633. };
  3634. _proto._getMenuElement = function _getMenuElement() {
  3635. if (!this._menu) {
  3636. var parent = Dropdown._getParentFromElement(this._element);
  3637. if (parent) {
  3638. this._menu = parent.querySelector(Selector$4.MENU);
  3639. }
  3640. }
  3641. return this._menu;
  3642. };
  3643. _proto._getPlacement = function _getPlacement() {
  3644. var $parentDropdown = $(this._element.parentNode);
  3645. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3646. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3647. placement = AttachmentMap.TOP;
  3648. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3649. placement = AttachmentMap.TOPEND;
  3650. }
  3651. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3652. placement = AttachmentMap.RIGHT;
  3653. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3654. placement = AttachmentMap.LEFT;
  3655. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3656. placement = AttachmentMap.BOTTOMEND;
  3657. }
  3658. return placement;
  3659. };
  3660. _proto._detectNavbar = function _detectNavbar() {
  3661. return $(this._element).closest('.navbar').length > 0;
  3662. };
  3663. _proto._getOffset = function _getOffset() {
  3664. var _this2 = this;
  3665. var offset = {};
  3666. if (typeof this._config.offset === 'function') {
  3667. offset.fn = function (data) {
  3668. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3669. return data;
  3670. };
  3671. } else {
  3672. offset.offset = this._config.offset;
  3673. }
  3674. return offset;
  3675. };
  3676. _proto._getPopperConfig = function _getPopperConfig() {
  3677. var popperConfig = {
  3678. placement: this._getPlacement(),
  3679. modifiers: {
  3680. offset: this._getOffset(),
  3681. flip: {
  3682. enabled: this._config.flip
  3683. },
  3684. preventOverflow: {
  3685. boundariesElement: this._config.boundary
  3686. }
  3687. }
  3688. }; // Disable Popper.js if we have a static display
  3689. if (this._config.display === 'static') {
  3690. popperConfig.modifiers.applyStyle = {
  3691. enabled: false
  3692. };
  3693. }
  3694. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3695. } // Static
  3696. ;
  3697. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3698. return this.each(function () {
  3699. var data = $(this).data(DATA_KEY$4);
  3700. var _config = typeof config === 'object' ? config : null;
  3701. if (!data) {
  3702. data = new Dropdown(this, _config);
  3703. $(this).data(DATA_KEY$4, data);
  3704. }
  3705. if (typeof config === 'string') {
  3706. if (typeof data[config] === 'undefined') {
  3707. throw new TypeError("No method named \"" + config + "\"");
  3708. }
  3709. data[config]();
  3710. }
  3711. });
  3712. };
  3713. Dropdown._clearMenus = function _clearMenus(event) {
  3714. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3715. return;
  3716. }
  3717. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3718. for (var i = 0, len = toggles.length; i < len; i++) {
  3719. var parent = Dropdown._getParentFromElement(toggles[i]);
  3720. var context = $(toggles[i]).data(DATA_KEY$4);
  3721. var relatedTarget = {
  3722. relatedTarget: toggles[i]
  3723. };
  3724. if (event && event.type === 'click') {
  3725. relatedTarget.clickEvent = event;
  3726. }
  3727. if (!context) {
  3728. continue;
  3729. }
  3730. var dropdownMenu = context._menu;
  3731. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3732. continue;
  3733. }
  3734. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3735. continue;
  3736. }
  3737. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3738. $(parent).trigger(hideEvent);
  3739. if (hideEvent.isDefaultPrevented()) {
  3740. continue;
  3741. } // If this is a touch-enabled device we remove the extra
  3742. // empty mouseover listeners we added for iOS support
  3743. if ('ontouchstart' in document.documentElement) {
  3744. $(document.body).children().off('mouseover', null, $.noop);
  3745. }
  3746. toggles[i].setAttribute('aria-expanded', 'false');
  3747. if (context._popper) {
  3748. context._popper.destroy();
  3749. }
  3750. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3751. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3752. }
  3753. };
  3754. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3755. var parent;
  3756. var selector = Util.getSelectorFromElement(element);
  3757. if (selector) {
  3758. parent = document.querySelector(selector);
  3759. }
  3760. return parent || element.parentNode;
  3761. } // eslint-disable-next-line complexity
  3762. ;
  3763. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3764. // If not input/textarea:
  3765. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3766. // If input/textarea:
  3767. // - If space key => not a dropdown command
  3768. // - If key is other than escape
  3769. // - If key is not up or down => not a dropdown command
  3770. // - If trigger inside the menu => not a dropdown command
  3771. 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)) {
  3772. return;
  3773. }
  3774. event.preventDefault();
  3775. event.stopPropagation();
  3776. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3777. return;
  3778. }
  3779. var parent = Dropdown._getParentFromElement(this);
  3780. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3781. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3782. return;
  3783. }
  3784. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3785. if (event.which === ESCAPE_KEYCODE) {
  3786. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3787. $(toggle).trigger('focus');
  3788. }
  3789. $(this).trigger('click');
  3790. return;
  3791. }
  3792. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3793. return $(item).is(':visible');
  3794. });
  3795. if (items.length === 0) {
  3796. return;
  3797. }
  3798. var index = items.indexOf(event.target);
  3799. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3800. // Up
  3801. index--;
  3802. }
  3803. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3804. // Down
  3805. index++;
  3806. }
  3807. if (index < 0) {
  3808. index = 0;
  3809. }
  3810. items[index].focus();
  3811. };
  3812. _createClass(Dropdown, null, [{
  3813. key: "VERSION",
  3814. get: function get() {
  3815. return VERSION$4;
  3816. }
  3817. }, {
  3818. key: "Default",
  3819. get: function get() {
  3820. return Default$2;
  3821. }
  3822. }, {
  3823. key: "DefaultType",
  3824. get: function get() {
  3825. return DefaultType$2;
  3826. }
  3827. }]);
  3828. return Dropdown;
  3829. }();
  3830. /**
  3831. * ------------------------------------------------------------------------
  3832. * Data Api implementation
  3833. * ------------------------------------------------------------------------
  3834. */
  3835. $(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) {
  3836. event.preventDefault();
  3837. event.stopPropagation();
  3838. Dropdown._jQueryInterface.call($(this), 'toggle');
  3839. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3840. e.stopPropagation();
  3841. });
  3842. /**
  3843. * ------------------------------------------------------------------------
  3844. * jQuery
  3845. * ------------------------------------------------------------------------
  3846. */
  3847. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3848. $.fn[NAME$4].Constructor = Dropdown;
  3849. $.fn[NAME$4].noConflict = function () {
  3850. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3851. return Dropdown._jQueryInterface;
  3852. };
  3853. /**
  3854. * ------------------------------------------------------------------------
  3855. * Constants
  3856. * ------------------------------------------------------------------------
  3857. */
  3858. var NAME$5 = 'modal';
  3859. var VERSION$5 = '4.4.1';
  3860. var DATA_KEY$5 = 'bs.modal';
  3861. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3862. var DATA_API_KEY$5 = '.data-api';
  3863. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3864. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3865. var Default$3 = {
  3866. backdrop: true,
  3867. keyboard: true,
  3868. focus: true,
  3869. show: true
  3870. };
  3871. var DefaultType$3 = {
  3872. backdrop: '(boolean|string)',
  3873. keyboard: 'boolean',
  3874. focus: 'boolean',
  3875. show: 'boolean'
  3876. };
  3877. var Event$5 = {
  3878. HIDE: "hide" + EVENT_KEY$5,
  3879. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  3880. HIDDEN: "hidden" + EVENT_KEY$5,
  3881. SHOW: "show" + EVENT_KEY$5,
  3882. SHOWN: "shown" + EVENT_KEY$5,
  3883. FOCUSIN: "focusin" + EVENT_KEY$5,
  3884. RESIZE: "resize" + EVENT_KEY$5,
  3885. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3886. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3887. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3888. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3889. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3890. };
  3891. var ClassName$5 = {
  3892. SCROLLABLE: 'modal-dialog-scrollable',
  3893. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3894. BACKDROP: 'modal-backdrop',
  3895. OPEN: 'modal-open',
  3896. FADE: 'fade',
  3897. SHOW: 'show',
  3898. STATIC: 'modal-static'
  3899. };
  3900. var Selector$5 = {
  3901. DIALOG: '.modal-dialog',
  3902. MODAL_BODY: '.modal-body',
  3903. DATA_TOGGLE: '[data-toggle="modal"]',
  3904. DATA_DISMISS: '[data-dismiss="modal"]',
  3905. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3906. STICKY_CONTENT: '.sticky-top'
  3907. };
  3908. /**
  3909. * ------------------------------------------------------------------------
  3910. * Class Definition
  3911. * ------------------------------------------------------------------------
  3912. */
  3913. var Modal =
  3914. /*#__PURE__*/
  3915. function () {
  3916. function Modal(element, config) {
  3917. this._config = this._getConfig(config);
  3918. this._element = element;
  3919. this._dialog = element.querySelector(Selector$5.DIALOG);
  3920. this._backdrop = null;
  3921. this._isShown = false;
  3922. this._isBodyOverflowing = false;
  3923. this._ignoreBackdropClick = false;
  3924. this._isTransitioning = false;
  3925. this._scrollbarWidth = 0;
  3926. } // Getters
  3927. var _proto = Modal.prototype;
  3928. // Public
  3929. _proto.toggle = function toggle(relatedTarget) {
  3930. return this._isShown ? this.hide() : this.show(relatedTarget);
  3931. };
  3932. _proto.show = function show(relatedTarget) {
  3933. var _this = this;
  3934. if (this._isShown || this._isTransitioning) {
  3935. return;
  3936. }
  3937. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3938. this._isTransitioning = true;
  3939. }
  3940. var showEvent = $.Event(Event$5.SHOW, {
  3941. relatedTarget: relatedTarget
  3942. });
  3943. $(this._element).trigger(showEvent);
  3944. if (this._isShown || showEvent.isDefaultPrevented()) {
  3945. return;
  3946. }
  3947. this._isShown = true;
  3948. this._checkScrollbar();
  3949. this._setScrollbar();
  3950. this._adjustDialog();
  3951. this._setEscapeEvent();
  3952. this._setResizeEvent();
  3953. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3954. return _this.hide(event);
  3955. });
  3956. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3957. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3958. if ($(event.target).is(_this._element)) {
  3959. _this._ignoreBackdropClick = true;
  3960. }
  3961. });
  3962. });
  3963. this._showBackdrop(function () {
  3964. return _this._showElement(relatedTarget);
  3965. });
  3966. };
  3967. _proto.hide = function hide(event) {
  3968. var _this2 = this;
  3969. if (event) {
  3970. event.preventDefault();
  3971. }
  3972. if (!this._isShown || this._isTransitioning) {
  3973. return;
  3974. }
  3975. var hideEvent = $.Event(Event$5.HIDE);
  3976. $(this._element).trigger(hideEvent);
  3977. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3978. return;
  3979. }
  3980. this._isShown = false;
  3981. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3982. if (transition) {
  3983. this._isTransitioning = true;
  3984. }
  3985. this._setEscapeEvent();
  3986. this._setResizeEvent();
  3987. $(document).off(Event$5.FOCUSIN);
  3988. $(this._element).removeClass(ClassName$5.SHOW);
  3989. $(this._element).off(Event$5.CLICK_DISMISS);
  3990. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  3991. if (transition) {
  3992. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3993. $(this._element).one(Util.TRANSITION_END, function (event) {
  3994. return _this2._hideModal(event);
  3995. }).emulateTransitionEnd(transitionDuration);
  3996. } else {
  3997. this._hideModal();
  3998. }
  3999. };
  4000. _proto.dispose = function dispose() {
  4001. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4002. return $(htmlElement).off(EVENT_KEY$5);
  4003. });
  4004. /**
  4005. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4006. * Do not move `document` in `htmlElements` array
  4007. * It will remove `Event.CLICK_DATA_API` event that should remain
  4008. */
  4009. $(document).off(Event$5.FOCUSIN);
  4010. $.removeData(this._element, DATA_KEY$5);
  4011. this._config = null;
  4012. this._element = null;
  4013. this._dialog = null;
  4014. this._backdrop = null;
  4015. this._isShown = null;
  4016. this._isBodyOverflowing = null;
  4017. this._ignoreBackdropClick = null;
  4018. this._isTransitioning = null;
  4019. this._scrollbarWidth = null;
  4020. };
  4021. _proto.handleUpdate = function handleUpdate() {
  4022. this._adjustDialog();
  4023. } // Private
  4024. ;
  4025. _proto._getConfig = function _getConfig(config) {
  4026. config = _objectSpread2({}, Default$3, {}, config);
  4027. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4028. return config;
  4029. };
  4030. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4031. var _this3 = this;
  4032. if (this._config.backdrop === 'static') {
  4033. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4034. $(this._element).trigger(hideEventPrevented);
  4035. if (hideEventPrevented.defaultPrevented) {
  4036. return;
  4037. }
  4038. this._element.classList.add(ClassName$5.STATIC);
  4039. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4040. $(this._element).one(Util.TRANSITION_END, function () {
  4041. _this3._element.classList.remove(ClassName$5.STATIC);
  4042. }).emulateTransitionEnd(modalTransitionDuration);
  4043. this._element.focus();
  4044. } else {
  4045. this.hide();
  4046. }
  4047. };
  4048. _proto._showElement = function _showElement(relatedTarget) {
  4049. var _this4 = this;
  4050. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4051. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4052. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4053. // Don't move modal's DOM position
  4054. document.body.appendChild(this._element);
  4055. }
  4056. this._element.style.display = 'block';
  4057. this._element.removeAttribute('aria-hidden');
  4058. this._element.setAttribute('aria-modal', true);
  4059. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4060. modalBody.scrollTop = 0;
  4061. } else {
  4062. this._element.scrollTop = 0;
  4063. }
  4064. if (transition) {
  4065. Util.reflow(this._element);
  4066. }
  4067. $(this._element).addClass(ClassName$5.SHOW);
  4068. if (this._config.focus) {
  4069. this._enforceFocus();
  4070. }
  4071. var shownEvent = $.Event(Event$5.SHOWN, {
  4072. relatedTarget: relatedTarget
  4073. });
  4074. var transitionComplete = function transitionComplete() {
  4075. if (_this4._config.focus) {
  4076. _this4._element.focus();
  4077. }
  4078. _this4._isTransitioning = false;
  4079. $(_this4._element).trigger(shownEvent);
  4080. };
  4081. if (transition) {
  4082. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4083. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4084. } else {
  4085. transitionComplete();
  4086. }
  4087. };
  4088. _proto._enforceFocus = function _enforceFocus() {
  4089. var _this5 = this;
  4090. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4091. .on(Event$5.FOCUSIN, function (event) {
  4092. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4093. _this5._element.focus();
  4094. }
  4095. });
  4096. };
  4097. _proto._setEscapeEvent = function _setEscapeEvent() {
  4098. var _this6 = this;
  4099. if (this._isShown && this._config.keyboard) {
  4100. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4101. if (event.which === ESCAPE_KEYCODE$1) {
  4102. _this6._triggerBackdropTransition();
  4103. }
  4104. });
  4105. } else if (!this._isShown) {
  4106. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4107. }
  4108. };
  4109. _proto._setResizeEvent = function _setResizeEvent() {
  4110. var _this7 = this;
  4111. if (this._isShown) {
  4112. $(window).on(Event$5.RESIZE, function (event) {
  4113. return _this7.handleUpdate(event);
  4114. });
  4115. } else {
  4116. $(window).off(Event$5.RESIZE);
  4117. }
  4118. };
  4119. _proto._hideModal = function _hideModal() {
  4120. var _this8 = this;
  4121. this._element.style.display = 'none';
  4122. this._element.setAttribute('aria-hidden', true);
  4123. this._element.removeAttribute('aria-modal');
  4124. this._isTransitioning = false;
  4125. this._showBackdrop(function () {
  4126. $(document.body).removeClass(ClassName$5.OPEN);
  4127. _this8._resetAdjustments();
  4128. _this8._resetScrollbar();
  4129. $(_this8._element).trigger(Event$5.HIDDEN);
  4130. });
  4131. };
  4132. _proto._removeBackdrop = function _removeBackdrop() {
  4133. if (this._backdrop) {
  4134. $(this._backdrop).remove();
  4135. this._backdrop = null;
  4136. }
  4137. };
  4138. _proto._showBackdrop = function _showBackdrop(callback) {
  4139. var _this9 = this;
  4140. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4141. if (this._isShown && this._config.backdrop) {
  4142. this._backdrop = document.createElement('div');
  4143. this._backdrop.className = ClassName$5.BACKDROP;
  4144. if (animate) {
  4145. this._backdrop.classList.add(animate);
  4146. }
  4147. $(this._backdrop).appendTo(document.body);
  4148. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4149. if (_this9._ignoreBackdropClick) {
  4150. _this9._ignoreBackdropClick = false;
  4151. return;
  4152. }
  4153. if (event.target !== event.currentTarget) {
  4154. return;
  4155. }
  4156. _this9._triggerBackdropTransition();
  4157. });
  4158. if (animate) {
  4159. Util.reflow(this._backdrop);
  4160. }
  4161. $(this._backdrop).addClass(ClassName$5.SHOW);
  4162. if (!callback) {
  4163. return;
  4164. }
  4165. if (!animate) {
  4166. callback();
  4167. return;
  4168. }
  4169. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4170. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4171. } else if (!this._isShown && this._backdrop) {
  4172. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4173. var callbackRemove = function callbackRemove() {
  4174. _this9._removeBackdrop();
  4175. if (callback) {
  4176. callback();
  4177. }
  4178. };
  4179. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4180. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4181. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4182. } else {
  4183. callbackRemove();
  4184. }
  4185. } else if (callback) {
  4186. callback();
  4187. }
  4188. } // ----------------------------------------------------------------------
  4189. // the following methods are used to handle overflowing modals
  4190. // todo (fat): these should probably be refactored out of modal.js
  4191. // ----------------------------------------------------------------------
  4192. ;
  4193. _proto._adjustDialog = function _adjustDialog() {
  4194. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4195. if (!this._isBodyOverflowing && isModalOverflowing) {
  4196. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4197. }
  4198. if (this._isBodyOverflowing && !isModalOverflowing) {
  4199. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4200. }
  4201. };
  4202. _proto._resetAdjustments = function _resetAdjustments() {
  4203. this._element.style.paddingLeft = '';
  4204. this._element.style.paddingRight = '';
  4205. };
  4206. _proto._checkScrollbar = function _checkScrollbar() {
  4207. var rect = document.body.getBoundingClientRect();
  4208. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4209. this._scrollbarWidth = this._getScrollbarWidth();
  4210. };
  4211. _proto._setScrollbar = function _setScrollbar() {
  4212. var _this10 = this;
  4213. if (this._isBodyOverflowing) {
  4214. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4215. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4216. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4217. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4218. $(fixedContent).each(function (index, element) {
  4219. var actualPadding = element.style.paddingRight;
  4220. var calculatedPadding = $(element).css('padding-right');
  4221. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4222. }); // Adjust sticky content margin
  4223. $(stickyContent).each(function (index, element) {
  4224. var actualMargin = element.style.marginRight;
  4225. var calculatedMargin = $(element).css('margin-right');
  4226. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4227. }); // Adjust body padding
  4228. var actualPadding = document.body.style.paddingRight;
  4229. var calculatedPadding = $(document.body).css('padding-right');
  4230. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4231. }
  4232. $(document.body).addClass(ClassName$5.OPEN);
  4233. };
  4234. _proto._resetScrollbar = function _resetScrollbar() {
  4235. // Restore fixed content padding
  4236. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4237. $(fixedContent).each(function (index, element) {
  4238. var padding = $(element).data('padding-right');
  4239. $(element).removeData('padding-right');
  4240. element.style.paddingRight = padding ? padding : '';
  4241. }); // Restore sticky content
  4242. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4243. $(elements).each(function (index, element) {
  4244. var margin = $(element).data('margin-right');
  4245. if (typeof margin !== 'undefined') {
  4246. $(element).css('margin-right', margin).removeData('margin-right');
  4247. }
  4248. }); // Restore body padding
  4249. var padding = $(document.body).data('padding-right');
  4250. $(document.body).removeData('padding-right');
  4251. document.body.style.paddingRight = padding ? padding : '';
  4252. };
  4253. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4254. // thx d.walsh
  4255. var scrollDiv = document.createElement('div');
  4256. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4257. document.body.appendChild(scrollDiv);
  4258. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4259. document.body.removeChild(scrollDiv);
  4260. return scrollbarWidth;
  4261. } // Static
  4262. ;
  4263. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4264. return this.each(function () {
  4265. var data = $(this).data(DATA_KEY$5);
  4266. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4267. if (!data) {
  4268. data = new Modal(this, _config);
  4269. $(this).data(DATA_KEY$5, data);
  4270. }
  4271. if (typeof config === 'string') {
  4272. if (typeof data[config] === 'undefined') {
  4273. throw new TypeError("No method named \"" + config + "\"");
  4274. }
  4275. data[config](relatedTarget);
  4276. } else if (_config.show) {
  4277. data.show(relatedTarget);
  4278. }
  4279. });
  4280. };
  4281. _createClass(Modal, null, [{
  4282. key: "VERSION",
  4283. get: function get() {
  4284. return VERSION$5;
  4285. }
  4286. }, {
  4287. key: "Default",
  4288. get: function get() {
  4289. return Default$3;
  4290. }
  4291. }]);
  4292. return Modal;
  4293. }();
  4294. /**
  4295. * ------------------------------------------------------------------------
  4296. * Data Api implementation
  4297. * ------------------------------------------------------------------------
  4298. */
  4299. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4300. var _this11 = this;
  4301. var target;
  4302. var selector = Util.getSelectorFromElement(this);
  4303. if (selector) {
  4304. target = document.querySelector(selector);
  4305. }
  4306. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4307. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4308. event.preventDefault();
  4309. }
  4310. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4311. if (showEvent.isDefaultPrevented()) {
  4312. // Only register focus restorer if modal will actually get shown
  4313. return;
  4314. }
  4315. $target.one(Event$5.HIDDEN, function () {
  4316. if ($(_this11).is(':visible')) {
  4317. _this11.focus();
  4318. }
  4319. });
  4320. });
  4321. Modal._jQueryInterface.call($(target), config, this);
  4322. });
  4323. /**
  4324. * ------------------------------------------------------------------------
  4325. * jQuery
  4326. * ------------------------------------------------------------------------
  4327. */
  4328. $.fn[NAME$5] = Modal._jQueryInterface;
  4329. $.fn[NAME$5].Constructor = Modal;
  4330. $.fn[NAME$5].noConflict = function () {
  4331. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4332. return Modal._jQueryInterface;
  4333. };
  4334. /**
  4335. * --------------------------------------------------------------------------
  4336. * Bootstrap (v4.4.1): tools/sanitizer.js
  4337. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4338. * --------------------------------------------------------------------------
  4339. */
  4340. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4341. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4342. var DefaultWhitelist = {
  4343. // Global attributes allowed on any supplied element below.
  4344. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4345. a: ['target', 'href', 'title', 'rel'],
  4346. area: [],
  4347. b: [],
  4348. br: [],
  4349. col: [],
  4350. code: [],
  4351. div: [],
  4352. em: [],
  4353. hr: [],
  4354. h1: [],
  4355. h2: [],
  4356. h3: [],
  4357. h4: [],
  4358. h5: [],
  4359. h6: [],
  4360. i: [],
  4361. img: ['src', 'alt', 'title', 'width', 'height'],
  4362. li: [],
  4363. ol: [],
  4364. p: [],
  4365. pre: [],
  4366. s: [],
  4367. small: [],
  4368. span: [],
  4369. sub: [],
  4370. sup: [],
  4371. strong: [],
  4372. u: [],
  4373. ul: []
  4374. };
  4375. /**
  4376. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4377. *
  4378. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4379. */
  4380. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4381. /**
  4382. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4383. *
  4384. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4385. */
  4386. 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;
  4387. function allowedAttribute(attr, allowedAttributeList) {
  4388. var attrName = attr.nodeName.toLowerCase();
  4389. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4390. if (uriAttrs.indexOf(attrName) !== -1) {
  4391. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4392. }
  4393. return true;
  4394. }
  4395. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4396. return attrRegex instanceof RegExp;
  4397. }); // Check if a regular expression validates the attribute.
  4398. for (var i = 0, l = regExp.length; i < l; i++) {
  4399. if (attrName.match(regExp[i])) {
  4400. return true;
  4401. }
  4402. }
  4403. return false;
  4404. }
  4405. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4406. if (unsafeHtml.length === 0) {
  4407. return unsafeHtml;
  4408. }
  4409. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4410. return sanitizeFn(unsafeHtml);
  4411. }
  4412. var domParser = new window.DOMParser();
  4413. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4414. var whitelistKeys = Object.keys(whiteList);
  4415. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4416. var _loop = function _loop(i, len) {
  4417. var el = elements[i];
  4418. var elName = el.nodeName.toLowerCase();
  4419. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4420. el.parentNode.removeChild(el);
  4421. return "continue";
  4422. }
  4423. var attributeList = [].slice.call(el.attributes);
  4424. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4425. attributeList.forEach(function (attr) {
  4426. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4427. el.removeAttribute(attr.nodeName);
  4428. }
  4429. });
  4430. };
  4431. for (var i = 0, len = elements.length; i < len; i++) {
  4432. var _ret = _loop(i);
  4433. if (_ret === "continue") continue;
  4434. }
  4435. return createdDocument.body.innerHTML;
  4436. }
  4437. /**
  4438. * ------------------------------------------------------------------------
  4439. * Constants
  4440. * ------------------------------------------------------------------------
  4441. */
  4442. var NAME$6 = 'tooltip';
  4443. var VERSION$6 = '4.4.1';
  4444. var DATA_KEY$6 = 'bs.tooltip';
  4445. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4446. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4447. var CLASS_PREFIX = 'bs-tooltip';
  4448. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4449. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4450. var DefaultType$4 = {
  4451. animation: 'boolean',
  4452. template: 'string',
  4453. title: '(string|element|function)',
  4454. trigger: 'string',
  4455. delay: '(number|object)',
  4456. html: 'boolean',
  4457. selector: '(string|boolean)',
  4458. placement: '(string|function)',
  4459. offset: '(number|string|function)',
  4460. container: '(string|element|boolean)',
  4461. fallbackPlacement: '(string|array)',
  4462. boundary: '(string|element)',
  4463. sanitize: 'boolean',
  4464. sanitizeFn: '(null|function)',
  4465. whiteList: 'object',
  4466. popperConfig: '(null|object)'
  4467. };
  4468. var AttachmentMap$1 = {
  4469. AUTO: 'auto',
  4470. TOP: 'top',
  4471. RIGHT: 'right',
  4472. BOTTOM: 'bottom',
  4473. LEFT: 'left'
  4474. };
  4475. var Default$4 = {
  4476. animation: true,
  4477. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4478. trigger: 'hover focus',
  4479. title: '',
  4480. delay: 0,
  4481. html: false,
  4482. selector: false,
  4483. placement: 'top',
  4484. offset: 0,
  4485. container: false,
  4486. fallbackPlacement: 'flip',
  4487. boundary: 'scrollParent',
  4488. sanitize: true,
  4489. sanitizeFn: null,
  4490. whiteList: DefaultWhitelist,
  4491. popperConfig: null
  4492. };
  4493. var HoverState = {
  4494. SHOW: 'show',
  4495. OUT: 'out'
  4496. };
  4497. var Event$6 = {
  4498. HIDE: "hide" + EVENT_KEY$6,
  4499. HIDDEN: "hidden" + EVENT_KEY$6,
  4500. SHOW: "show" + EVENT_KEY$6,
  4501. SHOWN: "shown" + EVENT_KEY$6,
  4502. INSERTED: "inserted" + EVENT_KEY$6,
  4503. CLICK: "click" + EVENT_KEY$6,
  4504. FOCUSIN: "focusin" + EVENT_KEY$6,
  4505. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4506. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4507. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4508. };
  4509. var ClassName$6 = {
  4510. FADE: 'fade',
  4511. SHOW: 'show'
  4512. };
  4513. var Selector$6 = {
  4514. TOOLTIP: '.tooltip',
  4515. TOOLTIP_INNER: '.tooltip-inner',
  4516. ARROW: '.arrow'
  4517. };
  4518. var Trigger = {
  4519. HOVER: 'hover',
  4520. FOCUS: 'focus',
  4521. CLICK: 'click',
  4522. MANUAL: 'manual'
  4523. };
  4524. /**
  4525. * ------------------------------------------------------------------------
  4526. * Class Definition
  4527. * ------------------------------------------------------------------------
  4528. */
  4529. var Tooltip =
  4530. /*#__PURE__*/
  4531. function () {
  4532. function Tooltip(element, config) {
  4533. if (typeof Popper === 'undefined') {
  4534. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4535. } // private
  4536. this._isEnabled = true;
  4537. this._timeout = 0;
  4538. this._hoverState = '';
  4539. this._activeTrigger = {};
  4540. this._popper = null; // Protected
  4541. this.element = element;
  4542. this.config = this._getConfig(config);
  4543. this.tip = null;
  4544. this._setListeners();
  4545. } // Getters
  4546. var _proto = Tooltip.prototype;
  4547. // Public
  4548. _proto.enable = function enable() {
  4549. this._isEnabled = true;
  4550. };
  4551. _proto.disable = function disable() {
  4552. this._isEnabled = false;
  4553. };
  4554. _proto.toggleEnabled = function toggleEnabled() {
  4555. this._isEnabled = !this._isEnabled;
  4556. };
  4557. _proto.toggle = function toggle(event) {
  4558. if (!this._isEnabled) {
  4559. return;
  4560. }
  4561. if (event) {
  4562. var dataKey = this.constructor.DATA_KEY;
  4563. var context = $(event.currentTarget).data(dataKey);
  4564. if (!context) {
  4565. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4566. $(event.currentTarget).data(dataKey, context);
  4567. }
  4568. context._activeTrigger.click = !context._activeTrigger.click;
  4569. if (context._isWithActiveTrigger()) {
  4570. context._enter(null, context);
  4571. } else {
  4572. context._leave(null, context);
  4573. }
  4574. } else {
  4575. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4576. this._leave(null, this);
  4577. return;
  4578. }
  4579. this._enter(null, this);
  4580. }
  4581. };
  4582. _proto.dispose = function dispose() {
  4583. clearTimeout(this._timeout);
  4584. $.removeData(this.element, this.constructor.DATA_KEY);
  4585. $(this.element).off(this.constructor.EVENT_KEY);
  4586. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4587. if (this.tip) {
  4588. $(this.tip).remove();
  4589. }
  4590. this._isEnabled = null;
  4591. this._timeout = null;
  4592. this._hoverState = null;
  4593. this._activeTrigger = null;
  4594. if (this._popper) {
  4595. this._popper.destroy();
  4596. }
  4597. this._popper = null;
  4598. this.element = null;
  4599. this.config = null;
  4600. this.tip = null;
  4601. };
  4602. _proto.show = function show() {
  4603. var _this = this;
  4604. if ($(this.element).css('display') === 'none') {
  4605. throw new Error('Please use show on visible elements');
  4606. }
  4607. var showEvent = $.Event(this.constructor.Event.SHOW);
  4608. if (this.isWithContent() && this._isEnabled) {
  4609. $(this.element).trigger(showEvent);
  4610. var shadowRoot = Util.findShadowRoot(this.element);
  4611. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4612. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4613. return;
  4614. }
  4615. var tip = this.getTipElement();
  4616. var tipId = Util.getUID(this.constructor.NAME);
  4617. tip.setAttribute('id', tipId);
  4618. this.element.setAttribute('aria-describedby', tipId);
  4619. this.setContent();
  4620. if (this.config.animation) {
  4621. $(tip).addClass(ClassName$6.FADE);
  4622. }
  4623. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4624. var attachment = this._getAttachment(placement);
  4625. this.addAttachmentClass(attachment);
  4626. var container = this._getContainer();
  4627. $(tip).data(this.constructor.DATA_KEY, this);
  4628. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4629. $(tip).appendTo(container);
  4630. }
  4631. $(this.element).trigger(this.constructor.Event.INSERTED);
  4632. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4633. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4634. // empty mouseover listeners to the body's immediate children;
  4635. // only needed because of broken event delegation on iOS
  4636. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4637. if ('ontouchstart' in document.documentElement) {
  4638. $(document.body).children().on('mouseover', null, $.noop);
  4639. }
  4640. var complete = function complete() {
  4641. if (_this.config.animation) {
  4642. _this._fixTransition();
  4643. }
  4644. var prevHoverState = _this._hoverState;
  4645. _this._hoverState = null;
  4646. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4647. if (prevHoverState === HoverState.OUT) {
  4648. _this._leave(null, _this);
  4649. }
  4650. };
  4651. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4652. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4653. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4654. } else {
  4655. complete();
  4656. }
  4657. }
  4658. };
  4659. _proto.hide = function hide(callback) {
  4660. var _this2 = this;
  4661. var tip = this.getTipElement();
  4662. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4663. var complete = function complete() {
  4664. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4665. tip.parentNode.removeChild(tip);
  4666. }
  4667. _this2._cleanTipClass();
  4668. _this2.element.removeAttribute('aria-describedby');
  4669. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4670. if (_this2._popper !== null) {
  4671. _this2._popper.destroy();
  4672. }
  4673. if (callback) {
  4674. callback();
  4675. }
  4676. };
  4677. $(this.element).trigger(hideEvent);
  4678. if (hideEvent.isDefaultPrevented()) {
  4679. return;
  4680. }
  4681. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4682. // empty mouseover listeners we added for iOS support
  4683. if ('ontouchstart' in document.documentElement) {
  4684. $(document.body).children().off('mouseover', null, $.noop);
  4685. }
  4686. this._activeTrigger[Trigger.CLICK] = false;
  4687. this._activeTrigger[Trigger.FOCUS] = false;
  4688. this._activeTrigger[Trigger.HOVER] = false;
  4689. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4690. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4691. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4692. } else {
  4693. complete();
  4694. }
  4695. this._hoverState = '';
  4696. };
  4697. _proto.update = function update() {
  4698. if (this._popper !== null) {
  4699. this._popper.scheduleUpdate();
  4700. }
  4701. } // Protected
  4702. ;
  4703. _proto.isWithContent = function isWithContent() {
  4704. return Boolean(this.getTitle());
  4705. };
  4706. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4707. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4708. };
  4709. _proto.getTipElement = function getTipElement() {
  4710. this.tip = this.tip || $(this.config.template)[0];
  4711. return this.tip;
  4712. };
  4713. _proto.setContent = function setContent() {
  4714. var tip = this.getTipElement();
  4715. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4716. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4717. };
  4718. _proto.setElementContent = function setElementContent($element, content) {
  4719. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4720. // Content is a DOM node or a jQuery
  4721. if (this.config.html) {
  4722. if (!$(content).parent().is($element)) {
  4723. $element.empty().append(content);
  4724. }
  4725. } else {
  4726. $element.text($(content).text());
  4727. }
  4728. return;
  4729. }
  4730. if (this.config.html) {
  4731. if (this.config.sanitize) {
  4732. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4733. }
  4734. $element.html(content);
  4735. } else {
  4736. $element.text(content);
  4737. }
  4738. };
  4739. _proto.getTitle = function getTitle() {
  4740. var title = this.element.getAttribute('data-original-title');
  4741. if (!title) {
  4742. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4743. }
  4744. return title;
  4745. } // Private
  4746. ;
  4747. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4748. var _this3 = this;
  4749. var defaultBsConfig = {
  4750. placement: attachment,
  4751. modifiers: {
  4752. offset: this._getOffset(),
  4753. flip: {
  4754. behavior: this.config.fallbackPlacement
  4755. },
  4756. arrow: {
  4757. element: Selector$6.ARROW
  4758. },
  4759. preventOverflow: {
  4760. boundariesElement: this.config.boundary
  4761. }
  4762. },
  4763. onCreate: function onCreate(data) {
  4764. if (data.originalPlacement !== data.placement) {
  4765. _this3._handlePopperPlacementChange(data);
  4766. }
  4767. },
  4768. onUpdate: function onUpdate(data) {
  4769. return _this3._handlePopperPlacementChange(data);
  4770. }
  4771. };
  4772. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4773. };
  4774. _proto._getOffset = function _getOffset() {
  4775. var _this4 = this;
  4776. var offset = {};
  4777. if (typeof this.config.offset === 'function') {
  4778. offset.fn = function (data) {
  4779. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4780. return data;
  4781. };
  4782. } else {
  4783. offset.offset = this.config.offset;
  4784. }
  4785. return offset;
  4786. };
  4787. _proto._getContainer = function _getContainer() {
  4788. if (this.config.container === false) {
  4789. return document.body;
  4790. }
  4791. if (Util.isElement(this.config.container)) {
  4792. return $(this.config.container);
  4793. }
  4794. return $(document).find(this.config.container);
  4795. };
  4796. _proto._getAttachment = function _getAttachment(placement) {
  4797. return AttachmentMap$1[placement.toUpperCase()];
  4798. };
  4799. _proto._setListeners = function _setListeners() {
  4800. var _this5 = this;
  4801. var triggers = this.config.trigger.split(' ');
  4802. triggers.forEach(function (trigger) {
  4803. if (trigger === 'click') {
  4804. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4805. return _this5.toggle(event);
  4806. });
  4807. } else if (trigger !== Trigger.MANUAL) {
  4808. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4809. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4810. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4811. return _this5._enter(event);
  4812. }).on(eventOut, _this5.config.selector, function (event) {
  4813. return _this5._leave(event);
  4814. });
  4815. }
  4816. });
  4817. this._hideModalHandler = function () {
  4818. if (_this5.element) {
  4819. _this5.hide();
  4820. }
  4821. };
  4822. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4823. if (this.config.selector) {
  4824. this.config = _objectSpread2({}, this.config, {
  4825. trigger: 'manual',
  4826. selector: ''
  4827. });
  4828. } else {
  4829. this._fixTitle();
  4830. }
  4831. };
  4832. _proto._fixTitle = function _fixTitle() {
  4833. var titleType = typeof this.element.getAttribute('data-original-title');
  4834. if (this.element.getAttribute('title') || titleType !== 'string') {
  4835. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4836. this.element.setAttribute('title', '');
  4837. }
  4838. };
  4839. _proto._enter = function _enter(event, context) {
  4840. var dataKey = this.constructor.DATA_KEY;
  4841. context = context || $(event.currentTarget).data(dataKey);
  4842. if (!context) {
  4843. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4844. $(event.currentTarget).data(dataKey, context);
  4845. }
  4846. if (event) {
  4847. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4848. }
  4849. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4850. context._hoverState = HoverState.SHOW;
  4851. return;
  4852. }
  4853. clearTimeout(context._timeout);
  4854. context._hoverState = HoverState.SHOW;
  4855. if (!context.config.delay || !context.config.delay.show) {
  4856. context.show();
  4857. return;
  4858. }
  4859. context._timeout = setTimeout(function () {
  4860. if (context._hoverState === HoverState.SHOW) {
  4861. context.show();
  4862. }
  4863. }, context.config.delay.show);
  4864. };
  4865. _proto._leave = function _leave(event, context) {
  4866. var dataKey = this.constructor.DATA_KEY;
  4867. context = context || $(event.currentTarget).data(dataKey);
  4868. if (!context) {
  4869. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4870. $(event.currentTarget).data(dataKey, context);
  4871. }
  4872. if (event) {
  4873. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4874. }
  4875. if (context._isWithActiveTrigger()) {
  4876. return;
  4877. }
  4878. clearTimeout(context._timeout);
  4879. context._hoverState = HoverState.OUT;
  4880. if (!context.config.delay || !context.config.delay.hide) {
  4881. context.hide();
  4882. return;
  4883. }
  4884. context._timeout = setTimeout(function () {
  4885. if (context._hoverState === HoverState.OUT) {
  4886. context.hide();
  4887. }
  4888. }, context.config.delay.hide);
  4889. };
  4890. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4891. for (var trigger in this._activeTrigger) {
  4892. if (this._activeTrigger[trigger]) {
  4893. return true;
  4894. }
  4895. }
  4896. return false;
  4897. };
  4898. _proto._getConfig = function _getConfig(config) {
  4899. var dataAttributes = $(this.element).data();
  4900. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4901. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4902. delete dataAttributes[dataAttr];
  4903. }
  4904. });
  4905. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  4906. if (typeof config.delay === 'number') {
  4907. config.delay = {
  4908. show: config.delay,
  4909. hide: config.delay
  4910. };
  4911. }
  4912. if (typeof config.title === 'number') {
  4913. config.title = config.title.toString();
  4914. }
  4915. if (typeof config.content === 'number') {
  4916. config.content = config.content.toString();
  4917. }
  4918. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4919. if (config.sanitize) {
  4920. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4921. }
  4922. return config;
  4923. };
  4924. _proto._getDelegateConfig = function _getDelegateConfig() {
  4925. var config = {};
  4926. if (this.config) {
  4927. for (var key in this.config) {
  4928. if (this.constructor.Default[key] !== this.config[key]) {
  4929. config[key] = this.config[key];
  4930. }
  4931. }
  4932. }
  4933. return config;
  4934. };
  4935. _proto._cleanTipClass = function _cleanTipClass() {
  4936. var $tip = $(this.getTipElement());
  4937. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4938. if (tabClass !== null && tabClass.length) {
  4939. $tip.removeClass(tabClass.join(''));
  4940. }
  4941. };
  4942. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4943. var popperInstance = popperData.instance;
  4944. this.tip = popperInstance.popper;
  4945. this._cleanTipClass();
  4946. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4947. };
  4948. _proto._fixTransition = function _fixTransition() {
  4949. var tip = this.getTipElement();
  4950. var initConfigAnimation = this.config.animation;
  4951. if (tip.getAttribute('x-placement') !== null) {
  4952. return;
  4953. }
  4954. $(tip).removeClass(ClassName$6.FADE);
  4955. this.config.animation = false;
  4956. this.hide();
  4957. this.show();
  4958. this.config.animation = initConfigAnimation;
  4959. } // Static
  4960. ;
  4961. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4962. return this.each(function () {
  4963. var data = $(this).data(DATA_KEY$6);
  4964. var _config = typeof config === 'object' && config;
  4965. if (!data && /dispose|hide/.test(config)) {
  4966. return;
  4967. }
  4968. if (!data) {
  4969. data = new Tooltip(this, _config);
  4970. $(this).data(DATA_KEY$6, data);
  4971. }
  4972. if (typeof config === 'string') {
  4973. if (typeof data[config] === 'undefined') {
  4974. throw new TypeError("No method named \"" + config + "\"");
  4975. }
  4976. data[config]();
  4977. }
  4978. });
  4979. };
  4980. _createClass(Tooltip, null, [{
  4981. key: "VERSION",
  4982. get: function get() {
  4983. return VERSION$6;
  4984. }
  4985. }, {
  4986. key: "Default",
  4987. get: function get() {
  4988. return Default$4;
  4989. }
  4990. }, {
  4991. key: "NAME",
  4992. get: function get() {
  4993. return NAME$6;
  4994. }
  4995. }, {
  4996. key: "DATA_KEY",
  4997. get: function get() {
  4998. return DATA_KEY$6;
  4999. }
  5000. }, {
  5001. key: "Event",
  5002. get: function get() {
  5003. return Event$6;
  5004. }
  5005. }, {
  5006. key: "EVENT_KEY",
  5007. get: function get() {
  5008. return EVENT_KEY$6;
  5009. }
  5010. }, {
  5011. key: "DefaultType",
  5012. get: function get() {
  5013. return DefaultType$4;
  5014. }
  5015. }]);
  5016. return Tooltip;
  5017. }();
  5018. /**
  5019. * ------------------------------------------------------------------------
  5020. * jQuery
  5021. * ------------------------------------------------------------------------
  5022. */
  5023. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5024. $.fn[NAME$6].Constructor = Tooltip;
  5025. $.fn[NAME$6].noConflict = function () {
  5026. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5027. return Tooltip._jQueryInterface;
  5028. };
  5029. /**
  5030. * ------------------------------------------------------------------------
  5031. * Constants
  5032. * ------------------------------------------------------------------------
  5033. */
  5034. var NAME$7 = 'popover';
  5035. var VERSION$7 = '4.4.1';
  5036. var DATA_KEY$7 = 'bs.popover';
  5037. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5038. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5039. var CLASS_PREFIX$1 = 'bs-popover';
  5040. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5041. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5042. placement: 'right',
  5043. trigger: 'click',
  5044. content: '',
  5045. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5046. });
  5047. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5048. content: '(string|element|function)'
  5049. });
  5050. var ClassName$7 = {
  5051. FADE: 'fade',
  5052. SHOW: 'show'
  5053. };
  5054. var Selector$7 = {
  5055. TITLE: '.popover-header',
  5056. CONTENT: '.popover-body'
  5057. };
  5058. var Event$7 = {
  5059. HIDE: "hide" + EVENT_KEY$7,
  5060. HIDDEN: "hidden" + EVENT_KEY$7,
  5061. SHOW: "show" + EVENT_KEY$7,
  5062. SHOWN: "shown" + EVENT_KEY$7,
  5063. INSERTED: "inserted" + EVENT_KEY$7,
  5064. CLICK: "click" + EVENT_KEY$7,
  5065. FOCUSIN: "focusin" + EVENT_KEY$7,
  5066. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5067. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5068. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5069. };
  5070. /**
  5071. * ------------------------------------------------------------------------
  5072. * Class Definition
  5073. * ------------------------------------------------------------------------
  5074. */
  5075. var Popover =
  5076. /*#__PURE__*/
  5077. function (_Tooltip) {
  5078. _inheritsLoose(Popover, _Tooltip);
  5079. function Popover() {
  5080. return _Tooltip.apply(this, arguments) || this;
  5081. }
  5082. var _proto = Popover.prototype;
  5083. // Overrides
  5084. _proto.isWithContent = function isWithContent() {
  5085. return this.getTitle() || this._getContent();
  5086. };
  5087. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5088. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5089. };
  5090. _proto.getTipElement = function getTipElement() {
  5091. this.tip = this.tip || $(this.config.template)[0];
  5092. return this.tip;
  5093. };
  5094. _proto.setContent = function setContent() {
  5095. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5096. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5097. var content = this._getContent();
  5098. if (typeof content === 'function') {
  5099. content = content.call(this.element);
  5100. }
  5101. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5102. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5103. } // Private
  5104. ;
  5105. _proto._getContent = function _getContent() {
  5106. return this.element.getAttribute('data-content') || this.config.content;
  5107. };
  5108. _proto._cleanTipClass = function _cleanTipClass() {
  5109. var $tip = $(this.getTipElement());
  5110. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5111. if (tabClass !== null && tabClass.length > 0) {
  5112. $tip.removeClass(tabClass.join(''));
  5113. }
  5114. } // Static
  5115. ;
  5116. Popover._jQueryInterface = function _jQueryInterface(config) {
  5117. return this.each(function () {
  5118. var data = $(this).data(DATA_KEY$7);
  5119. var _config = typeof config === 'object' ? config : null;
  5120. if (!data && /dispose|hide/.test(config)) {
  5121. return;
  5122. }
  5123. if (!data) {
  5124. data = new Popover(this, _config);
  5125. $(this).data(DATA_KEY$7, data);
  5126. }
  5127. if (typeof config === 'string') {
  5128. if (typeof data[config] === 'undefined') {
  5129. throw new TypeError("No method named \"" + config + "\"");
  5130. }
  5131. data[config]();
  5132. }
  5133. });
  5134. };
  5135. _createClass(Popover, null, [{
  5136. key: "VERSION",
  5137. // Getters
  5138. get: function get() {
  5139. return VERSION$7;
  5140. }
  5141. }, {
  5142. key: "Default",
  5143. get: function get() {
  5144. return Default$5;
  5145. }
  5146. }, {
  5147. key: "NAME",
  5148. get: function get() {
  5149. return NAME$7;
  5150. }
  5151. }, {
  5152. key: "DATA_KEY",
  5153. get: function get() {
  5154. return DATA_KEY$7;
  5155. }
  5156. }, {
  5157. key: "Event",
  5158. get: function get() {
  5159. return Event$7;
  5160. }
  5161. }, {
  5162. key: "EVENT_KEY",
  5163. get: function get() {
  5164. return EVENT_KEY$7;
  5165. }
  5166. }, {
  5167. key: "DefaultType",
  5168. get: function get() {
  5169. return DefaultType$5;
  5170. }
  5171. }]);
  5172. return Popover;
  5173. }(Tooltip);
  5174. /**
  5175. * ------------------------------------------------------------------------
  5176. * jQuery
  5177. * ------------------------------------------------------------------------
  5178. */
  5179. $.fn[NAME$7] = Popover._jQueryInterface;
  5180. $.fn[NAME$7].Constructor = Popover;
  5181. $.fn[NAME$7].noConflict = function () {
  5182. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5183. return Popover._jQueryInterface;
  5184. };
  5185. /**
  5186. * ------------------------------------------------------------------------
  5187. * Constants
  5188. * ------------------------------------------------------------------------
  5189. */
  5190. var NAME$8 = 'scrollspy';
  5191. var VERSION$8 = '4.4.1';
  5192. var DATA_KEY$8 = 'bs.scrollspy';
  5193. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5194. var DATA_API_KEY$6 = '.data-api';
  5195. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5196. var Default$6 = {
  5197. offset: 10,
  5198. method: 'auto',
  5199. target: ''
  5200. };
  5201. var DefaultType$6 = {
  5202. offset: 'number',
  5203. method: 'string',
  5204. target: '(string|element)'
  5205. };
  5206. var Event$8 = {
  5207. ACTIVATE: "activate" + EVENT_KEY$8,
  5208. SCROLL: "scroll" + EVENT_KEY$8,
  5209. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5210. };
  5211. var ClassName$8 = {
  5212. DROPDOWN_ITEM: 'dropdown-item',
  5213. DROPDOWN_MENU: 'dropdown-menu',
  5214. ACTIVE: 'active'
  5215. };
  5216. var Selector$8 = {
  5217. DATA_SPY: '[data-spy="scroll"]',
  5218. ACTIVE: '.active',
  5219. NAV_LIST_GROUP: '.nav, .list-group',
  5220. NAV_LINKS: '.nav-link',
  5221. NAV_ITEMS: '.nav-item',
  5222. LIST_ITEMS: '.list-group-item',
  5223. DROPDOWN: '.dropdown',
  5224. DROPDOWN_ITEMS: '.dropdown-item',
  5225. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5226. };
  5227. var OffsetMethod = {
  5228. OFFSET: 'offset',
  5229. POSITION: 'position'
  5230. };
  5231. /**
  5232. * ------------------------------------------------------------------------
  5233. * Class Definition
  5234. * ------------------------------------------------------------------------
  5235. */
  5236. var ScrollSpy =
  5237. /*#__PURE__*/
  5238. function () {
  5239. function ScrollSpy(element, config) {
  5240. var _this = this;
  5241. this._element = element;
  5242. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5243. this._config = this._getConfig(config);
  5244. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5245. this._offsets = [];
  5246. this._targets = [];
  5247. this._activeTarget = null;
  5248. this._scrollHeight = 0;
  5249. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5250. return _this._process(event);
  5251. });
  5252. this.refresh();
  5253. this._process();
  5254. } // Getters
  5255. var _proto = ScrollSpy.prototype;
  5256. // Public
  5257. _proto.refresh = function refresh() {
  5258. var _this2 = this;
  5259. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5260. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5261. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5262. this._offsets = [];
  5263. this._targets = [];
  5264. this._scrollHeight = this._getScrollHeight();
  5265. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5266. targets.map(function (element) {
  5267. var target;
  5268. var targetSelector = Util.getSelectorFromElement(element);
  5269. if (targetSelector) {
  5270. target = document.querySelector(targetSelector);
  5271. }
  5272. if (target) {
  5273. var targetBCR = target.getBoundingClientRect();
  5274. if (targetBCR.width || targetBCR.height) {
  5275. // TODO (fat): remove sketch reliance on jQuery position/offset
  5276. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5277. }
  5278. }
  5279. return null;
  5280. }).filter(function (item) {
  5281. return item;
  5282. }).sort(function (a, b) {
  5283. return a[0] - b[0];
  5284. }).forEach(function (item) {
  5285. _this2._offsets.push(item[0]);
  5286. _this2._targets.push(item[1]);
  5287. });
  5288. };
  5289. _proto.dispose = function dispose() {
  5290. $.removeData(this._element, DATA_KEY$8);
  5291. $(this._scrollElement).off(EVENT_KEY$8);
  5292. this._element = null;
  5293. this._scrollElement = null;
  5294. this._config = null;
  5295. this._selector = null;
  5296. this._offsets = null;
  5297. this._targets = null;
  5298. this._activeTarget = null;
  5299. this._scrollHeight = null;
  5300. } // Private
  5301. ;
  5302. _proto._getConfig = function _getConfig(config) {
  5303. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5304. if (typeof config.target !== 'string') {
  5305. var id = $(config.target).attr('id');
  5306. if (!id) {
  5307. id = Util.getUID(NAME$8);
  5308. $(config.target).attr('id', id);
  5309. }
  5310. config.target = "#" + id;
  5311. }
  5312. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5313. return config;
  5314. };
  5315. _proto._getScrollTop = function _getScrollTop() {
  5316. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5317. };
  5318. _proto._getScrollHeight = function _getScrollHeight() {
  5319. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5320. };
  5321. _proto._getOffsetHeight = function _getOffsetHeight() {
  5322. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5323. };
  5324. _proto._process = function _process() {
  5325. var scrollTop = this._getScrollTop() + this._config.offset;
  5326. var scrollHeight = this._getScrollHeight();
  5327. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5328. if (this._scrollHeight !== scrollHeight) {
  5329. this.refresh();
  5330. }
  5331. if (scrollTop >= maxScroll) {
  5332. var target = this._targets[this._targets.length - 1];
  5333. if (this._activeTarget !== target) {
  5334. this._activate(target);
  5335. }
  5336. return;
  5337. }
  5338. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5339. this._activeTarget = null;
  5340. this._clear();
  5341. return;
  5342. }
  5343. var offsetLength = this._offsets.length;
  5344. for (var i = offsetLength; i--;) {
  5345. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5346. if (isActiveTarget) {
  5347. this._activate(this._targets[i]);
  5348. }
  5349. }
  5350. };
  5351. _proto._activate = function _activate(target) {
  5352. this._activeTarget = target;
  5353. this._clear();
  5354. var queries = this._selector.split(',').map(function (selector) {
  5355. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5356. });
  5357. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5358. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5359. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5360. $link.addClass(ClassName$8.ACTIVE);
  5361. } else {
  5362. // Set triggered link as active
  5363. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5364. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5365. $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
  5366. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5367. }
  5368. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5369. relatedTarget: target
  5370. });
  5371. };
  5372. _proto._clear = function _clear() {
  5373. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5374. return node.classList.contains(ClassName$8.ACTIVE);
  5375. }).forEach(function (node) {
  5376. return node.classList.remove(ClassName$8.ACTIVE);
  5377. });
  5378. } // Static
  5379. ;
  5380. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5381. return this.each(function () {
  5382. var data = $(this).data(DATA_KEY$8);
  5383. var _config = typeof config === 'object' && config;
  5384. if (!data) {
  5385. data = new ScrollSpy(this, _config);
  5386. $(this).data(DATA_KEY$8, data);
  5387. }
  5388. if (typeof config === 'string') {
  5389. if (typeof data[config] === 'undefined') {
  5390. throw new TypeError("No method named \"" + config + "\"");
  5391. }
  5392. data[config]();
  5393. }
  5394. });
  5395. };
  5396. _createClass(ScrollSpy, null, [{
  5397. key: "VERSION",
  5398. get: function get() {
  5399. return VERSION$8;
  5400. }
  5401. }, {
  5402. key: "Default",
  5403. get: function get() {
  5404. return Default$6;
  5405. }
  5406. }]);
  5407. return ScrollSpy;
  5408. }();
  5409. /**
  5410. * ------------------------------------------------------------------------
  5411. * Data Api implementation
  5412. * ------------------------------------------------------------------------
  5413. */
  5414. $(window).on(Event$8.LOAD_DATA_API, function () {
  5415. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5416. var scrollSpysLength = scrollSpys.length;
  5417. for (var i = scrollSpysLength; i--;) {
  5418. var $spy = $(scrollSpys[i]);
  5419. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5420. }
  5421. });
  5422. /**
  5423. * ------------------------------------------------------------------------
  5424. * jQuery
  5425. * ------------------------------------------------------------------------
  5426. */
  5427. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5428. $.fn[NAME$8].Constructor = ScrollSpy;
  5429. $.fn[NAME$8].noConflict = function () {
  5430. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5431. return ScrollSpy._jQueryInterface;
  5432. };
  5433. /**
  5434. * ------------------------------------------------------------------------
  5435. * Constants
  5436. * ------------------------------------------------------------------------
  5437. */
  5438. var NAME$9 = 'tab';
  5439. var VERSION$9 = '4.4.1';
  5440. var DATA_KEY$9 = 'bs.tab';
  5441. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5442. var DATA_API_KEY$7 = '.data-api';
  5443. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5444. var Event$9 = {
  5445. HIDE: "hide" + EVENT_KEY$9,
  5446. HIDDEN: "hidden" + EVENT_KEY$9,
  5447. SHOW: "show" + EVENT_KEY$9,
  5448. SHOWN: "shown" + EVENT_KEY$9,
  5449. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5450. };
  5451. var ClassName$9 = {
  5452. DROPDOWN_MENU: 'dropdown-menu',
  5453. ACTIVE: 'active',
  5454. DISABLED: 'disabled',
  5455. FADE: 'fade',
  5456. SHOW: 'show'
  5457. };
  5458. var Selector$9 = {
  5459. DROPDOWN: '.dropdown',
  5460. NAV_LIST_GROUP: '.nav, .list-group',
  5461. ACTIVE: '.active',
  5462. ACTIVE_UL: '> li > .active',
  5463. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5464. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5465. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5466. };
  5467. /**
  5468. * ------------------------------------------------------------------------
  5469. * Class Definition
  5470. * ------------------------------------------------------------------------
  5471. */
  5472. var Tab =
  5473. /*#__PURE__*/
  5474. function () {
  5475. function Tab(element) {
  5476. this._element = element;
  5477. } // Getters
  5478. var _proto = Tab.prototype;
  5479. // Public
  5480. _proto.show = function show() {
  5481. var _this = this;
  5482. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5483. return;
  5484. }
  5485. var target;
  5486. var previous;
  5487. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5488. var selector = Util.getSelectorFromElement(this._element);
  5489. if (listElement) {
  5490. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5491. previous = $.makeArray($(listElement).find(itemSelector));
  5492. previous = previous[previous.length - 1];
  5493. }
  5494. var hideEvent = $.Event(Event$9.HIDE, {
  5495. relatedTarget: this._element
  5496. });
  5497. var showEvent = $.Event(Event$9.SHOW, {
  5498. relatedTarget: previous
  5499. });
  5500. if (previous) {
  5501. $(previous).trigger(hideEvent);
  5502. }
  5503. $(this._element).trigger(showEvent);
  5504. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5505. return;
  5506. }
  5507. if (selector) {
  5508. target = document.querySelector(selector);
  5509. }
  5510. this._activate(this._element, listElement);
  5511. var complete = function complete() {
  5512. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5513. relatedTarget: _this._element
  5514. });
  5515. var shownEvent = $.Event(Event$9.SHOWN, {
  5516. relatedTarget: previous
  5517. });
  5518. $(previous).trigger(hiddenEvent);
  5519. $(_this._element).trigger(shownEvent);
  5520. };
  5521. if (target) {
  5522. this._activate(target, target.parentNode, complete);
  5523. } else {
  5524. complete();
  5525. }
  5526. };
  5527. _proto.dispose = function dispose() {
  5528. $.removeData(this._element, DATA_KEY$9);
  5529. this._element = null;
  5530. } // Private
  5531. ;
  5532. _proto._activate = function _activate(element, container, callback) {
  5533. var _this2 = this;
  5534. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5535. var active = activeElements[0];
  5536. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5537. var complete = function complete() {
  5538. return _this2._transitionComplete(element, active, callback);
  5539. };
  5540. if (active && isTransitioning) {
  5541. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5542. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5543. } else {
  5544. complete();
  5545. }
  5546. };
  5547. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5548. if (active) {
  5549. $(active).removeClass(ClassName$9.ACTIVE);
  5550. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5551. if (dropdownChild) {
  5552. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5553. }
  5554. if (active.getAttribute('role') === 'tab') {
  5555. active.setAttribute('aria-selected', false);
  5556. }
  5557. }
  5558. $(element).addClass(ClassName$9.ACTIVE);
  5559. if (element.getAttribute('role') === 'tab') {
  5560. element.setAttribute('aria-selected', true);
  5561. }
  5562. Util.reflow(element);
  5563. if (element.classList.contains(ClassName$9.FADE)) {
  5564. element.classList.add(ClassName$9.SHOW);
  5565. }
  5566. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5567. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5568. if (dropdownElement) {
  5569. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5570. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5571. }
  5572. element.setAttribute('aria-expanded', true);
  5573. }
  5574. if (callback) {
  5575. callback();
  5576. }
  5577. } // Static
  5578. ;
  5579. Tab._jQueryInterface = function _jQueryInterface(config) {
  5580. return this.each(function () {
  5581. var $this = $(this);
  5582. var data = $this.data(DATA_KEY$9);
  5583. if (!data) {
  5584. data = new Tab(this);
  5585. $this.data(DATA_KEY$9, data);
  5586. }
  5587. if (typeof config === 'string') {
  5588. if (typeof data[config] === 'undefined') {
  5589. throw new TypeError("No method named \"" + config + "\"");
  5590. }
  5591. data[config]();
  5592. }
  5593. });
  5594. };
  5595. _createClass(Tab, null, [{
  5596. key: "VERSION",
  5597. get: function get() {
  5598. return VERSION$9;
  5599. }
  5600. }]);
  5601. return Tab;
  5602. }();
  5603. /**
  5604. * ------------------------------------------------------------------------
  5605. * Data Api implementation
  5606. * ------------------------------------------------------------------------
  5607. */
  5608. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5609. event.preventDefault();
  5610. Tab._jQueryInterface.call($(this), 'show');
  5611. });
  5612. /**
  5613. * ------------------------------------------------------------------------
  5614. * jQuery
  5615. * ------------------------------------------------------------------------
  5616. */
  5617. $.fn[NAME$9] = Tab._jQueryInterface;
  5618. $.fn[NAME$9].Constructor = Tab;
  5619. $.fn[NAME$9].noConflict = function () {
  5620. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5621. return Tab._jQueryInterface;
  5622. };
  5623. /**
  5624. * ------------------------------------------------------------------------
  5625. * Constants
  5626. * ------------------------------------------------------------------------
  5627. */
  5628. var NAME$a = 'toast';
  5629. var VERSION$a = '4.4.1';
  5630. var DATA_KEY$a = 'bs.toast';
  5631. var EVENT_KEY$a = "." + DATA_KEY$a;
  5632. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5633. var Event$a = {
  5634. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5635. HIDE: "hide" + EVENT_KEY$a,
  5636. HIDDEN: "hidden" + EVENT_KEY$a,
  5637. SHOW: "show" + EVENT_KEY$a,
  5638. SHOWN: "shown" + EVENT_KEY$a
  5639. };
  5640. var ClassName$a = {
  5641. FADE: 'fade',
  5642. HIDE: 'hide',
  5643. SHOW: 'show',
  5644. SHOWING: 'showing'
  5645. };
  5646. var DefaultType$7 = {
  5647. animation: 'boolean',
  5648. autohide: 'boolean',
  5649. delay: 'number'
  5650. };
  5651. var Default$7 = {
  5652. animation: true,
  5653. autohide: true,
  5654. delay: 500
  5655. };
  5656. var Selector$a = {
  5657. DATA_DISMISS: '[data-dismiss="toast"]'
  5658. };
  5659. /**
  5660. * ------------------------------------------------------------------------
  5661. * Class Definition
  5662. * ------------------------------------------------------------------------
  5663. */
  5664. var Toast =
  5665. /*#__PURE__*/
  5666. function () {
  5667. function Toast(element, config) {
  5668. this._element = element;
  5669. this._config = this._getConfig(config);
  5670. this._timeout = null;
  5671. this._setListeners();
  5672. } // Getters
  5673. var _proto = Toast.prototype;
  5674. // Public
  5675. _proto.show = function show() {
  5676. var _this = this;
  5677. var showEvent = $.Event(Event$a.SHOW);
  5678. $(this._element).trigger(showEvent);
  5679. if (showEvent.isDefaultPrevented()) {
  5680. return;
  5681. }
  5682. if (this._config.animation) {
  5683. this._element.classList.add(ClassName$a.FADE);
  5684. }
  5685. var complete = function complete() {
  5686. _this._element.classList.remove(ClassName$a.SHOWING);
  5687. _this._element.classList.add(ClassName$a.SHOW);
  5688. $(_this._element).trigger(Event$a.SHOWN);
  5689. if (_this._config.autohide) {
  5690. _this._timeout = setTimeout(function () {
  5691. _this.hide();
  5692. }, _this._config.delay);
  5693. }
  5694. };
  5695. this._element.classList.remove(ClassName$a.HIDE);
  5696. Util.reflow(this._element);
  5697. this._element.classList.add(ClassName$a.SHOWING);
  5698. if (this._config.animation) {
  5699. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5700. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5701. } else {
  5702. complete();
  5703. }
  5704. };
  5705. _proto.hide = function hide() {
  5706. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5707. return;
  5708. }
  5709. var hideEvent = $.Event(Event$a.HIDE);
  5710. $(this._element).trigger(hideEvent);
  5711. if (hideEvent.isDefaultPrevented()) {
  5712. return;
  5713. }
  5714. this._close();
  5715. };
  5716. _proto.dispose = function dispose() {
  5717. clearTimeout(this._timeout);
  5718. this._timeout = null;
  5719. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5720. this._element.classList.remove(ClassName$a.SHOW);
  5721. }
  5722. $(this._element).off(Event$a.CLICK_DISMISS);
  5723. $.removeData(this._element, DATA_KEY$a);
  5724. this._element = null;
  5725. this._config = null;
  5726. } // Private
  5727. ;
  5728. _proto._getConfig = function _getConfig(config) {
  5729. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5730. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5731. return config;
  5732. };
  5733. _proto._setListeners = function _setListeners() {
  5734. var _this2 = this;
  5735. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5736. return _this2.hide();
  5737. });
  5738. };
  5739. _proto._close = function _close() {
  5740. var _this3 = this;
  5741. var complete = function complete() {
  5742. _this3._element.classList.add(ClassName$a.HIDE);
  5743. $(_this3._element).trigger(Event$a.HIDDEN);
  5744. };
  5745. this._element.classList.remove(ClassName$a.SHOW);
  5746. if (this._config.animation) {
  5747. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5748. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5749. } else {
  5750. complete();
  5751. }
  5752. } // Static
  5753. ;
  5754. Toast._jQueryInterface = function _jQueryInterface(config) {
  5755. return this.each(function () {
  5756. var $element = $(this);
  5757. var data = $element.data(DATA_KEY$a);
  5758. var _config = typeof config === 'object' && config;
  5759. if (!data) {
  5760. data = new Toast(this, _config);
  5761. $element.data(DATA_KEY$a, data);
  5762. }
  5763. if (typeof config === 'string') {
  5764. if (typeof data[config] === 'undefined') {
  5765. throw new TypeError("No method named \"" + config + "\"");
  5766. }
  5767. data[config](this);
  5768. }
  5769. });
  5770. };
  5771. _createClass(Toast, null, [{
  5772. key: "VERSION",
  5773. get: function get() {
  5774. return VERSION$a;
  5775. }
  5776. }, {
  5777. key: "DefaultType",
  5778. get: function get() {
  5779. return DefaultType$7;
  5780. }
  5781. }, {
  5782. key: "Default",
  5783. get: function get() {
  5784. return Default$7;
  5785. }
  5786. }]);
  5787. return Toast;
  5788. }();
  5789. /**
  5790. * ------------------------------------------------------------------------
  5791. * jQuery
  5792. * ------------------------------------------------------------------------
  5793. */
  5794. $.fn[NAME$a] = Toast._jQueryInterface;
  5795. $.fn[NAME$a].Constructor = Toast;
  5796. $.fn[NAME$a].noConflict = function () {
  5797. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5798. return Toast._jQueryInterface;
  5799. };
  5800. exports.Alert = Alert;
  5801. exports.Button = Button;
  5802. exports.Carousel = Carousel;
  5803. exports.Collapse = Collapse;
  5804. exports.Dropdown = Dropdown;
  5805. exports.Modal = Modal;
  5806. exports.Popover = Popover;
  5807. exports.Scrollspy = ScrollSpy;
  5808. exports.Tab = Tab;
  5809. exports.Toast = Toast;
  5810. exports.Tooltip = Tooltip;
  5811. exports.Util = Util;
  5812. Object.defineProperty(exports, '__esModule', { value: true });
  5813. })));
  5814. //# sourceMappingURL=bootstrap.js.map
  5815. /***/ }),
  5816. /***/ "./node_modules/buffer/index.js":
  5817. /*!**************************************!*\
  5818. !*** ./node_modules/buffer/index.js ***!
  5819. \**************************************/
  5820. /*! no static exports found */
  5821. /***/ (function(module, exports, __webpack_require__) {
  5822. "use strict";
  5823. /* WEBPACK VAR INJECTION */(function(global) {/*!
  5824. * The buffer module from node.js, for the browser.
  5825. *
  5826. * @author Feross Aboukhadijeh <http://feross.org>
  5827. * @license MIT
  5828. */
  5829. /* eslint-disable no-proto */
  5830. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  5831. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  5832. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  5833. exports.Buffer = Buffer
  5834. exports.SlowBuffer = SlowBuffer
  5835. exports.INSPECT_MAX_BYTES = 50
  5836. /**
  5837. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  5838. * === true Use Uint8Array implementation (fastest)
  5839. * === false Use Object implementation (most compatible, even IE6)
  5840. *
  5841. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  5842. * Opera 11.6+, iOS 4.2+.
  5843. *
  5844. * Due to various browser bugs, sometimes the Object implementation will be used even
  5845. * when the browser supports typed arrays.
  5846. *
  5847. * Note:
  5848. *
  5849. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  5850. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  5851. *
  5852. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  5853. *
  5854. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  5855. * incorrect length in some situations.
  5856. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  5857. * get the Object implementation, which is slower but behaves correctly.
  5858. */
  5859. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  5860. ? global.TYPED_ARRAY_SUPPORT
  5861. : typedArraySupport()
  5862. /*
  5863. * Export kMaxLength after typed array support is determined.
  5864. */
  5865. exports.kMaxLength = kMaxLength()
  5866. function typedArraySupport () {
  5867. try {
  5868. var arr = new Uint8Array(1)
  5869. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  5870. return arr.foo() === 42 && // typed array instances can be augmented
  5871. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  5872. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  5873. } catch (e) {
  5874. return false
  5875. }
  5876. }
  5877. function kMaxLength () {
  5878. return Buffer.TYPED_ARRAY_SUPPORT
  5879. ? 0x7fffffff
  5880. : 0x3fffffff
  5881. }
  5882. function createBuffer (that, length) {
  5883. if (kMaxLength() < length) {
  5884. throw new RangeError('Invalid typed array length')
  5885. }
  5886. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5887. // Return an augmented `Uint8Array` instance, for best performance
  5888. that = new Uint8Array(length)
  5889. that.__proto__ = Buffer.prototype
  5890. } else {
  5891. // Fallback: Return an object instance of the Buffer class
  5892. if (that === null) {
  5893. that = new Buffer(length)
  5894. }
  5895. that.length = length
  5896. }
  5897. return that
  5898. }
  5899. /**
  5900. * The Buffer constructor returns instances of `Uint8Array` that have their
  5901. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  5902. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  5903. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  5904. * returns a single octet.
  5905. *
  5906. * The `Uint8Array` prototype remains unmodified.
  5907. */
  5908. function Buffer (arg, encodingOrOffset, length) {
  5909. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  5910. return new Buffer(arg, encodingOrOffset, length)
  5911. }
  5912. // Common case.
  5913. if (typeof arg === 'number') {
  5914. if (typeof encodingOrOffset === 'string') {
  5915. throw new Error(
  5916. 'If encoding is specified then the first argument must be a string'
  5917. )
  5918. }
  5919. return allocUnsafe(this, arg)
  5920. }
  5921. return from(this, arg, encodingOrOffset, length)
  5922. }
  5923. Buffer.poolSize = 8192 // not used by this implementation
  5924. // TODO: Legacy, not needed anymore. Remove in next major version.
  5925. Buffer._augment = function (arr) {
  5926. arr.__proto__ = Buffer.prototype
  5927. return arr
  5928. }
  5929. function from (that, value, encodingOrOffset, length) {
  5930. if (typeof value === 'number') {
  5931. throw new TypeError('"value" argument must not be a number')
  5932. }
  5933. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  5934. return fromArrayBuffer(that, value, encodingOrOffset, length)
  5935. }
  5936. if (typeof value === 'string') {
  5937. return fromString(that, value, encodingOrOffset)
  5938. }
  5939. return fromObject(that, value)
  5940. }
  5941. /**
  5942. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  5943. * if value is a number.
  5944. * Buffer.from(str[, encoding])
  5945. * Buffer.from(array)
  5946. * Buffer.from(buffer)
  5947. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  5948. **/
  5949. Buffer.from = function (value, encodingOrOffset, length) {
  5950. return from(null, value, encodingOrOffset, length)
  5951. }
  5952. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5953. Buffer.prototype.__proto__ = Uint8Array.prototype
  5954. Buffer.__proto__ = Uint8Array
  5955. if (typeof Symbol !== 'undefined' && Symbol.species &&
  5956. Buffer[Symbol.species] === Buffer) {
  5957. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  5958. Object.defineProperty(Buffer, Symbol.species, {
  5959. value: null,
  5960. configurable: true
  5961. })
  5962. }
  5963. }
  5964. function assertSize (size) {
  5965. if (typeof size !== 'number') {
  5966. throw new TypeError('"size" argument must be a number')
  5967. } else if (size < 0) {
  5968. throw new RangeError('"size" argument must not be negative')
  5969. }
  5970. }
  5971. function alloc (that, size, fill, encoding) {
  5972. assertSize(size)
  5973. if (size <= 0) {
  5974. return createBuffer(that, size)
  5975. }
  5976. if (fill !== undefined) {
  5977. // Only pay attention to encoding if it's a string. This
  5978. // prevents accidentally sending in a number that would
  5979. // be interpretted as a start offset.
  5980. return typeof encoding === 'string'
  5981. ? createBuffer(that, size).fill(fill, encoding)
  5982. : createBuffer(that, size).fill(fill)
  5983. }
  5984. return createBuffer(that, size)
  5985. }
  5986. /**
  5987. * Creates a new filled Buffer instance.
  5988. * alloc(size[, fill[, encoding]])
  5989. **/
  5990. Buffer.alloc = function (size, fill, encoding) {
  5991. return alloc(null, size, fill, encoding)
  5992. }
  5993. function allocUnsafe (that, size) {
  5994. assertSize(size)
  5995. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  5996. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  5997. for (var i = 0; i < size; ++i) {
  5998. that[i] = 0
  5999. }
  6000. }
  6001. return that
  6002. }
  6003. /**
  6004. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6005. * */
  6006. Buffer.allocUnsafe = function (size) {
  6007. return allocUnsafe(null, size)
  6008. }
  6009. /**
  6010. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6011. */
  6012. Buffer.allocUnsafeSlow = function (size) {
  6013. return allocUnsafe(null, size)
  6014. }
  6015. function fromString (that, string, encoding) {
  6016. if (typeof encoding !== 'string' || encoding === '') {
  6017. encoding = 'utf8'
  6018. }
  6019. if (!Buffer.isEncoding(encoding)) {
  6020. throw new TypeError('"encoding" must be a valid string encoding')
  6021. }
  6022. var length = byteLength(string, encoding) | 0
  6023. that = createBuffer(that, length)
  6024. var actual = that.write(string, encoding)
  6025. if (actual !== length) {
  6026. // Writing a hex string, for example, that contains invalid characters will
  6027. // cause everything after the first invalid character to be ignored. (e.g.
  6028. // 'abxxcd' will be treated as 'ab')
  6029. that = that.slice(0, actual)
  6030. }
  6031. return that
  6032. }
  6033. function fromArrayLike (that, array) {
  6034. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6035. that = createBuffer(that, length)
  6036. for (var i = 0; i < length; i += 1) {
  6037. that[i] = array[i] & 255
  6038. }
  6039. return that
  6040. }
  6041. function fromArrayBuffer (that, array, byteOffset, length) {
  6042. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6043. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6044. throw new RangeError('\'offset\' is out of bounds')
  6045. }
  6046. if (array.byteLength < byteOffset + (length || 0)) {
  6047. throw new RangeError('\'length\' is out of bounds')
  6048. }
  6049. if (byteOffset === undefined && length === undefined) {
  6050. array = new Uint8Array(array)
  6051. } else if (length === undefined) {
  6052. array = new Uint8Array(array, byteOffset)
  6053. } else {
  6054. array = new Uint8Array(array, byteOffset, length)
  6055. }
  6056. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6057. // Return an augmented `Uint8Array` instance, for best performance
  6058. that = array
  6059. that.__proto__ = Buffer.prototype
  6060. } else {
  6061. // Fallback: Return an object instance of the Buffer class
  6062. that = fromArrayLike(that, array)
  6063. }
  6064. return that
  6065. }
  6066. function fromObject (that, obj) {
  6067. if (Buffer.isBuffer(obj)) {
  6068. var len = checked(obj.length) | 0
  6069. that = createBuffer(that, len)
  6070. if (that.length === 0) {
  6071. return that
  6072. }
  6073. obj.copy(that, 0, 0, len)
  6074. return that
  6075. }
  6076. if (obj) {
  6077. if ((typeof ArrayBuffer !== 'undefined' &&
  6078. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6079. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6080. return createBuffer(that, 0)
  6081. }
  6082. return fromArrayLike(that, obj)
  6083. }
  6084. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6085. return fromArrayLike(that, obj.data)
  6086. }
  6087. }
  6088. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6089. }
  6090. function checked (length) {
  6091. // Note: cannot use `length < kMaxLength()` here because that fails when
  6092. // length is NaN (which is otherwise coerced to zero.)
  6093. if (length >= kMaxLength()) {
  6094. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6095. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6096. }
  6097. return length | 0
  6098. }
  6099. function SlowBuffer (length) {
  6100. if (+length != length) { // eslint-disable-line eqeqeq
  6101. length = 0
  6102. }
  6103. return Buffer.alloc(+length)
  6104. }
  6105. Buffer.isBuffer = function isBuffer (b) {
  6106. return !!(b != null && b._isBuffer)
  6107. }
  6108. Buffer.compare = function compare (a, b) {
  6109. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6110. throw new TypeError('Arguments must be Buffers')
  6111. }
  6112. if (a === b) return 0
  6113. var x = a.length
  6114. var y = b.length
  6115. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6116. if (a[i] !== b[i]) {
  6117. x = a[i]
  6118. y = b[i]
  6119. break
  6120. }
  6121. }
  6122. if (x < y) return -1
  6123. if (y < x) return 1
  6124. return 0
  6125. }
  6126. Buffer.isEncoding = function isEncoding (encoding) {
  6127. switch (String(encoding).toLowerCase()) {
  6128. case 'hex':
  6129. case 'utf8':
  6130. case 'utf-8':
  6131. case 'ascii':
  6132. case 'latin1':
  6133. case 'binary':
  6134. case 'base64':
  6135. case 'ucs2':
  6136. case 'ucs-2':
  6137. case 'utf16le':
  6138. case 'utf-16le':
  6139. return true
  6140. default:
  6141. return false
  6142. }
  6143. }
  6144. Buffer.concat = function concat (list, length) {
  6145. if (!isArray(list)) {
  6146. throw new TypeError('"list" argument must be an Array of Buffers')
  6147. }
  6148. if (list.length === 0) {
  6149. return Buffer.alloc(0)
  6150. }
  6151. var i
  6152. if (length === undefined) {
  6153. length = 0
  6154. for (i = 0; i < list.length; ++i) {
  6155. length += list[i].length
  6156. }
  6157. }
  6158. var buffer = Buffer.allocUnsafe(length)
  6159. var pos = 0
  6160. for (i = 0; i < list.length; ++i) {
  6161. var buf = list[i]
  6162. if (!Buffer.isBuffer(buf)) {
  6163. throw new TypeError('"list" argument must be an Array of Buffers')
  6164. }
  6165. buf.copy(buffer, pos)
  6166. pos += buf.length
  6167. }
  6168. return buffer
  6169. }
  6170. function byteLength (string, encoding) {
  6171. if (Buffer.isBuffer(string)) {
  6172. return string.length
  6173. }
  6174. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6175. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6176. return string.byteLength
  6177. }
  6178. if (typeof string !== 'string') {
  6179. string = '' + string
  6180. }
  6181. var len = string.length
  6182. if (len === 0) return 0
  6183. // Use a for loop to avoid recursion
  6184. var loweredCase = false
  6185. for (;;) {
  6186. switch (encoding) {
  6187. case 'ascii':
  6188. case 'latin1':
  6189. case 'binary':
  6190. return len
  6191. case 'utf8':
  6192. case 'utf-8':
  6193. case undefined:
  6194. return utf8ToBytes(string).length
  6195. case 'ucs2':
  6196. case 'ucs-2':
  6197. case 'utf16le':
  6198. case 'utf-16le':
  6199. return len * 2
  6200. case 'hex':
  6201. return len >>> 1
  6202. case 'base64':
  6203. return base64ToBytes(string).length
  6204. default:
  6205. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6206. encoding = ('' + encoding).toLowerCase()
  6207. loweredCase = true
  6208. }
  6209. }
  6210. }
  6211. Buffer.byteLength = byteLength
  6212. function slowToString (encoding, start, end) {
  6213. var loweredCase = false
  6214. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6215. // property of a typed array.
  6216. // This behaves neither like String nor Uint8Array in that we set start/end
  6217. // to their upper/lower bounds if the value passed is out of range.
  6218. // undefined is handled specially as per ECMA-262 6th Edition,
  6219. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6220. if (start === undefined || start < 0) {
  6221. start = 0
  6222. }
  6223. // Return early if start > this.length. Done here to prevent potential uint32
  6224. // coercion fail below.
  6225. if (start > this.length) {
  6226. return ''
  6227. }
  6228. if (end === undefined || end > this.length) {
  6229. end = this.length
  6230. }
  6231. if (end <= 0) {
  6232. return ''
  6233. }
  6234. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6235. end >>>= 0
  6236. start >>>= 0
  6237. if (end <= start) {
  6238. return ''
  6239. }
  6240. if (!encoding) encoding = 'utf8'
  6241. while (true) {
  6242. switch (encoding) {
  6243. case 'hex':
  6244. return hexSlice(this, start, end)
  6245. case 'utf8':
  6246. case 'utf-8':
  6247. return utf8Slice(this, start, end)
  6248. case 'ascii':
  6249. return asciiSlice(this, start, end)
  6250. case 'latin1':
  6251. case 'binary':
  6252. return latin1Slice(this, start, end)
  6253. case 'base64':
  6254. return base64Slice(this, start, end)
  6255. case 'ucs2':
  6256. case 'ucs-2':
  6257. case 'utf16le':
  6258. case 'utf-16le':
  6259. return utf16leSlice(this, start, end)
  6260. default:
  6261. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6262. encoding = (encoding + '').toLowerCase()
  6263. loweredCase = true
  6264. }
  6265. }
  6266. }
  6267. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6268. // Buffer instances.
  6269. Buffer.prototype._isBuffer = true
  6270. function swap (b, n, m) {
  6271. var i = b[n]
  6272. b[n] = b[m]
  6273. b[m] = i
  6274. }
  6275. Buffer.prototype.swap16 = function swap16 () {
  6276. var len = this.length
  6277. if (len % 2 !== 0) {
  6278. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6279. }
  6280. for (var i = 0; i < len; i += 2) {
  6281. swap(this, i, i + 1)
  6282. }
  6283. return this
  6284. }
  6285. Buffer.prototype.swap32 = function swap32 () {
  6286. var len = this.length
  6287. if (len % 4 !== 0) {
  6288. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6289. }
  6290. for (var i = 0; i < len; i += 4) {
  6291. swap(this, i, i + 3)
  6292. swap(this, i + 1, i + 2)
  6293. }
  6294. return this
  6295. }
  6296. Buffer.prototype.swap64 = function swap64 () {
  6297. var len = this.length
  6298. if (len % 8 !== 0) {
  6299. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6300. }
  6301. for (var i = 0; i < len; i += 8) {
  6302. swap(this, i, i + 7)
  6303. swap(this, i + 1, i + 6)
  6304. swap(this, i + 2, i + 5)
  6305. swap(this, i + 3, i + 4)
  6306. }
  6307. return this
  6308. }
  6309. Buffer.prototype.toString = function toString () {
  6310. var length = this.length | 0
  6311. if (length === 0) return ''
  6312. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6313. return slowToString.apply(this, arguments)
  6314. }
  6315. Buffer.prototype.equals = function equals (b) {
  6316. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6317. if (this === b) return true
  6318. return Buffer.compare(this, b) === 0
  6319. }
  6320. Buffer.prototype.inspect = function inspect () {
  6321. var str = ''
  6322. var max = exports.INSPECT_MAX_BYTES
  6323. if (this.length > 0) {
  6324. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6325. if (this.length > max) str += ' ... '
  6326. }
  6327. return '<Buffer ' + str + '>'
  6328. }
  6329. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6330. if (!Buffer.isBuffer(target)) {
  6331. throw new TypeError('Argument must be a Buffer')
  6332. }
  6333. if (start === undefined) {
  6334. start = 0
  6335. }
  6336. if (end === undefined) {
  6337. end = target ? target.length : 0
  6338. }
  6339. if (thisStart === undefined) {
  6340. thisStart = 0
  6341. }
  6342. if (thisEnd === undefined) {
  6343. thisEnd = this.length
  6344. }
  6345. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6346. throw new RangeError('out of range index')
  6347. }
  6348. if (thisStart >= thisEnd && start >= end) {
  6349. return 0
  6350. }
  6351. if (thisStart >= thisEnd) {
  6352. return -1
  6353. }
  6354. if (start >= end) {
  6355. return 1
  6356. }
  6357. start >>>= 0
  6358. end >>>= 0
  6359. thisStart >>>= 0
  6360. thisEnd >>>= 0
  6361. if (this === target) return 0
  6362. var x = thisEnd - thisStart
  6363. var y = end - start
  6364. var len = Math.min(x, y)
  6365. var thisCopy = this.slice(thisStart, thisEnd)
  6366. var targetCopy = target.slice(start, end)
  6367. for (var i = 0; i < len; ++i) {
  6368. if (thisCopy[i] !== targetCopy[i]) {
  6369. x = thisCopy[i]
  6370. y = targetCopy[i]
  6371. break
  6372. }
  6373. }
  6374. if (x < y) return -1
  6375. if (y < x) return 1
  6376. return 0
  6377. }
  6378. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6379. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6380. //
  6381. // Arguments:
  6382. // - buffer - a Buffer to search
  6383. // - val - a string, Buffer, or number
  6384. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6385. // - encoding - an optional encoding, relevant is val is a string
  6386. // - dir - true for indexOf, false for lastIndexOf
  6387. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6388. // Empty buffer means no match
  6389. if (buffer.length === 0) return -1
  6390. // Normalize byteOffset
  6391. if (typeof byteOffset === 'string') {
  6392. encoding = byteOffset
  6393. byteOffset = 0
  6394. } else if (byteOffset > 0x7fffffff) {
  6395. byteOffset = 0x7fffffff
  6396. } else if (byteOffset < -0x80000000) {
  6397. byteOffset = -0x80000000
  6398. }
  6399. byteOffset = +byteOffset // Coerce to Number.
  6400. if (isNaN(byteOffset)) {
  6401. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6402. byteOffset = dir ? 0 : (buffer.length - 1)
  6403. }
  6404. // Normalize byteOffset: negative offsets start from the end of the buffer
  6405. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6406. if (byteOffset >= buffer.length) {
  6407. if (dir) return -1
  6408. else byteOffset = buffer.length - 1
  6409. } else if (byteOffset < 0) {
  6410. if (dir) byteOffset = 0
  6411. else return -1
  6412. }
  6413. // Normalize val
  6414. if (typeof val === 'string') {
  6415. val = Buffer.from(val, encoding)
  6416. }
  6417. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6418. if (Buffer.isBuffer(val)) {
  6419. // Special case: looking for empty string/buffer always fails
  6420. if (val.length === 0) {
  6421. return -1
  6422. }
  6423. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6424. } else if (typeof val === 'number') {
  6425. val = val & 0xFF // Search for a byte value [0-255]
  6426. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6427. typeof Uint8Array.prototype.indexOf === 'function') {
  6428. if (dir) {
  6429. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6430. } else {
  6431. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6432. }
  6433. }
  6434. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6435. }
  6436. throw new TypeError('val must be string, number or Buffer')
  6437. }
  6438. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6439. var indexSize = 1
  6440. var arrLength = arr.length
  6441. var valLength = val.length
  6442. if (encoding !== undefined) {
  6443. encoding = String(encoding).toLowerCase()
  6444. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6445. encoding === 'utf16le' || encoding === 'utf-16le') {
  6446. if (arr.length < 2 || val.length < 2) {
  6447. return -1
  6448. }
  6449. indexSize = 2
  6450. arrLength /= 2
  6451. valLength /= 2
  6452. byteOffset /= 2
  6453. }
  6454. }
  6455. function read (buf, i) {
  6456. if (indexSize === 1) {
  6457. return buf[i]
  6458. } else {
  6459. return buf.readUInt16BE(i * indexSize)
  6460. }
  6461. }
  6462. var i
  6463. if (dir) {
  6464. var foundIndex = -1
  6465. for (i = byteOffset; i < arrLength; i++) {
  6466. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6467. if (foundIndex === -1) foundIndex = i
  6468. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6469. } else {
  6470. if (foundIndex !== -1) i -= i - foundIndex
  6471. foundIndex = -1
  6472. }
  6473. }
  6474. } else {
  6475. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6476. for (i = byteOffset; i >= 0; i--) {
  6477. var found = true
  6478. for (var j = 0; j < valLength; j++) {
  6479. if (read(arr, i + j) !== read(val, j)) {
  6480. found = false
  6481. break
  6482. }
  6483. }
  6484. if (found) return i
  6485. }
  6486. }
  6487. return -1
  6488. }
  6489. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6490. return this.indexOf(val, byteOffset, encoding) !== -1
  6491. }
  6492. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6493. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6494. }
  6495. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6496. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6497. }
  6498. function hexWrite (buf, string, offset, length) {
  6499. offset = Number(offset) || 0
  6500. var remaining = buf.length - offset
  6501. if (!length) {
  6502. length = remaining
  6503. } else {
  6504. length = Number(length)
  6505. if (length > remaining) {
  6506. length = remaining
  6507. }
  6508. }
  6509. // must be an even number of digits
  6510. var strLen = string.length
  6511. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6512. if (length > strLen / 2) {
  6513. length = strLen / 2
  6514. }
  6515. for (var i = 0; i < length; ++i) {
  6516. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6517. if (isNaN(parsed)) return i
  6518. buf[offset + i] = parsed
  6519. }
  6520. return i
  6521. }
  6522. function utf8Write (buf, string, offset, length) {
  6523. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6524. }
  6525. function asciiWrite (buf, string, offset, length) {
  6526. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6527. }
  6528. function latin1Write (buf, string, offset, length) {
  6529. return asciiWrite(buf, string, offset, length)
  6530. }
  6531. function base64Write (buf, string, offset, length) {
  6532. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6533. }
  6534. function ucs2Write (buf, string, offset, length) {
  6535. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6536. }
  6537. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6538. // Buffer#write(string)
  6539. if (offset === undefined) {
  6540. encoding = 'utf8'
  6541. length = this.length
  6542. offset = 0
  6543. // Buffer#write(string, encoding)
  6544. } else if (length === undefined && typeof offset === 'string') {
  6545. encoding = offset
  6546. length = this.length
  6547. offset = 0
  6548. // Buffer#write(string, offset[, length][, encoding])
  6549. } else if (isFinite(offset)) {
  6550. offset = offset | 0
  6551. if (isFinite(length)) {
  6552. length = length | 0
  6553. if (encoding === undefined) encoding = 'utf8'
  6554. } else {
  6555. encoding = length
  6556. length = undefined
  6557. }
  6558. // legacy write(string, encoding, offset, length) - remove in v0.13
  6559. } else {
  6560. throw new Error(
  6561. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6562. )
  6563. }
  6564. var remaining = this.length - offset
  6565. if (length === undefined || length > remaining) length = remaining
  6566. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6567. throw new RangeError('Attempt to write outside buffer bounds')
  6568. }
  6569. if (!encoding) encoding = 'utf8'
  6570. var loweredCase = false
  6571. for (;;) {
  6572. switch (encoding) {
  6573. case 'hex':
  6574. return hexWrite(this, string, offset, length)
  6575. case 'utf8':
  6576. case 'utf-8':
  6577. return utf8Write(this, string, offset, length)
  6578. case 'ascii':
  6579. return asciiWrite(this, string, offset, length)
  6580. case 'latin1':
  6581. case 'binary':
  6582. return latin1Write(this, string, offset, length)
  6583. case 'base64':
  6584. // Warning: maxLength not taken into account in base64Write
  6585. return base64Write(this, string, offset, length)
  6586. case 'ucs2':
  6587. case 'ucs-2':
  6588. case 'utf16le':
  6589. case 'utf-16le':
  6590. return ucs2Write(this, string, offset, length)
  6591. default:
  6592. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6593. encoding = ('' + encoding).toLowerCase()
  6594. loweredCase = true
  6595. }
  6596. }
  6597. }
  6598. Buffer.prototype.toJSON = function toJSON () {
  6599. return {
  6600. type: 'Buffer',
  6601. data: Array.prototype.slice.call(this._arr || this, 0)
  6602. }
  6603. }
  6604. function base64Slice (buf, start, end) {
  6605. if (start === 0 && end === buf.length) {
  6606. return base64.fromByteArray(buf)
  6607. } else {
  6608. return base64.fromByteArray(buf.slice(start, end))
  6609. }
  6610. }
  6611. function utf8Slice (buf, start, end) {
  6612. end = Math.min(buf.length, end)
  6613. var res = []
  6614. var i = start
  6615. while (i < end) {
  6616. var firstByte = buf[i]
  6617. var codePoint = null
  6618. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6619. : (firstByte > 0xDF) ? 3
  6620. : (firstByte > 0xBF) ? 2
  6621. : 1
  6622. if (i + bytesPerSequence <= end) {
  6623. var secondByte, thirdByte, fourthByte, tempCodePoint
  6624. switch (bytesPerSequence) {
  6625. case 1:
  6626. if (firstByte < 0x80) {
  6627. codePoint = firstByte
  6628. }
  6629. break
  6630. case 2:
  6631. secondByte = buf[i + 1]
  6632. if ((secondByte & 0xC0) === 0x80) {
  6633. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6634. if (tempCodePoint > 0x7F) {
  6635. codePoint = tempCodePoint
  6636. }
  6637. }
  6638. break
  6639. case 3:
  6640. secondByte = buf[i + 1]
  6641. thirdByte = buf[i + 2]
  6642. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6643. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6644. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6645. codePoint = tempCodePoint
  6646. }
  6647. }
  6648. break
  6649. case 4:
  6650. secondByte = buf[i + 1]
  6651. thirdByte = buf[i + 2]
  6652. fourthByte = buf[i + 3]
  6653. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6654. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6655. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6656. codePoint = tempCodePoint
  6657. }
  6658. }
  6659. }
  6660. }
  6661. if (codePoint === null) {
  6662. // we did not generate a valid codePoint so insert a
  6663. // replacement char (U+FFFD) and advance only 1 byte
  6664. codePoint = 0xFFFD
  6665. bytesPerSequence = 1
  6666. } else if (codePoint > 0xFFFF) {
  6667. // encode to utf16 (surrogate pair dance)
  6668. codePoint -= 0x10000
  6669. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6670. codePoint = 0xDC00 | codePoint & 0x3FF
  6671. }
  6672. res.push(codePoint)
  6673. i += bytesPerSequence
  6674. }
  6675. return decodeCodePointsArray(res)
  6676. }
  6677. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6678. // the lowest limit is Chrome, with 0x10000 args.
  6679. // We go 1 magnitude less, for safety
  6680. var MAX_ARGUMENTS_LENGTH = 0x1000
  6681. function decodeCodePointsArray (codePoints) {
  6682. var len = codePoints.length
  6683. if (len <= MAX_ARGUMENTS_LENGTH) {
  6684. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6685. }
  6686. // Decode in chunks to avoid "call stack size exceeded".
  6687. var res = ''
  6688. var i = 0
  6689. while (i < len) {
  6690. res += String.fromCharCode.apply(
  6691. String,
  6692. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6693. )
  6694. }
  6695. return res
  6696. }
  6697. function asciiSlice (buf, start, end) {
  6698. var ret = ''
  6699. end = Math.min(buf.length, end)
  6700. for (var i = start; i < end; ++i) {
  6701. ret += String.fromCharCode(buf[i] & 0x7F)
  6702. }
  6703. return ret
  6704. }
  6705. function latin1Slice (buf, start, end) {
  6706. var ret = ''
  6707. end = Math.min(buf.length, end)
  6708. for (var i = start; i < end; ++i) {
  6709. ret += String.fromCharCode(buf[i])
  6710. }
  6711. return ret
  6712. }
  6713. function hexSlice (buf, start, end) {
  6714. var len = buf.length
  6715. if (!start || start < 0) start = 0
  6716. if (!end || end < 0 || end > len) end = len
  6717. var out = ''
  6718. for (var i = start; i < end; ++i) {
  6719. out += toHex(buf[i])
  6720. }
  6721. return out
  6722. }
  6723. function utf16leSlice (buf, start, end) {
  6724. var bytes = buf.slice(start, end)
  6725. var res = ''
  6726. for (var i = 0; i < bytes.length; i += 2) {
  6727. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6728. }
  6729. return res
  6730. }
  6731. Buffer.prototype.slice = function slice (start, end) {
  6732. var len = this.length
  6733. start = ~~start
  6734. end = end === undefined ? len : ~~end
  6735. if (start < 0) {
  6736. start += len
  6737. if (start < 0) start = 0
  6738. } else if (start > len) {
  6739. start = len
  6740. }
  6741. if (end < 0) {
  6742. end += len
  6743. if (end < 0) end = 0
  6744. } else if (end > len) {
  6745. end = len
  6746. }
  6747. if (end < start) end = start
  6748. var newBuf
  6749. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6750. newBuf = this.subarray(start, end)
  6751. newBuf.__proto__ = Buffer.prototype
  6752. } else {
  6753. var sliceLen = end - start
  6754. newBuf = new Buffer(sliceLen, undefined)
  6755. for (var i = 0; i < sliceLen; ++i) {
  6756. newBuf[i] = this[i + start]
  6757. }
  6758. }
  6759. return newBuf
  6760. }
  6761. /*
  6762. * Need to make sure that buffer isn't trying to write out of bounds.
  6763. */
  6764. function checkOffset (offset, ext, length) {
  6765. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  6766. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  6767. }
  6768. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  6769. offset = offset | 0
  6770. byteLength = byteLength | 0
  6771. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6772. var val = this[offset]
  6773. var mul = 1
  6774. var i = 0
  6775. while (++i < byteLength && (mul *= 0x100)) {
  6776. val += this[offset + i] * mul
  6777. }
  6778. return val
  6779. }
  6780. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  6781. offset = offset | 0
  6782. byteLength = byteLength | 0
  6783. if (!noAssert) {
  6784. checkOffset(offset, byteLength, this.length)
  6785. }
  6786. var val = this[offset + --byteLength]
  6787. var mul = 1
  6788. while (byteLength > 0 && (mul *= 0x100)) {
  6789. val += this[offset + --byteLength] * mul
  6790. }
  6791. return val
  6792. }
  6793. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  6794. if (!noAssert) checkOffset(offset, 1, this.length)
  6795. return this[offset]
  6796. }
  6797. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  6798. if (!noAssert) checkOffset(offset, 2, this.length)
  6799. return this[offset] | (this[offset + 1] << 8)
  6800. }
  6801. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  6802. if (!noAssert) checkOffset(offset, 2, this.length)
  6803. return (this[offset] << 8) | this[offset + 1]
  6804. }
  6805. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  6806. if (!noAssert) checkOffset(offset, 4, this.length)
  6807. return ((this[offset]) |
  6808. (this[offset + 1] << 8) |
  6809. (this[offset + 2] << 16)) +
  6810. (this[offset + 3] * 0x1000000)
  6811. }
  6812. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  6813. if (!noAssert) checkOffset(offset, 4, this.length)
  6814. return (this[offset] * 0x1000000) +
  6815. ((this[offset + 1] << 16) |
  6816. (this[offset + 2] << 8) |
  6817. this[offset + 3])
  6818. }
  6819. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  6820. offset = offset | 0
  6821. byteLength = byteLength | 0
  6822. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6823. var val = this[offset]
  6824. var mul = 1
  6825. var i = 0
  6826. while (++i < byteLength && (mul *= 0x100)) {
  6827. val += this[offset + i] * mul
  6828. }
  6829. mul *= 0x80
  6830. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6831. return val
  6832. }
  6833. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  6834. offset = offset | 0
  6835. byteLength = byteLength | 0
  6836. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6837. var i = byteLength
  6838. var mul = 1
  6839. var val = this[offset + --i]
  6840. while (i > 0 && (mul *= 0x100)) {
  6841. val += this[offset + --i] * mul
  6842. }
  6843. mul *= 0x80
  6844. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6845. return val
  6846. }
  6847. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  6848. if (!noAssert) checkOffset(offset, 1, this.length)
  6849. if (!(this[offset] & 0x80)) return (this[offset])
  6850. return ((0xff - this[offset] + 1) * -1)
  6851. }
  6852. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  6853. if (!noAssert) checkOffset(offset, 2, this.length)
  6854. var val = this[offset] | (this[offset + 1] << 8)
  6855. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6856. }
  6857. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  6858. if (!noAssert) checkOffset(offset, 2, this.length)
  6859. var val = this[offset + 1] | (this[offset] << 8)
  6860. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6861. }
  6862. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  6863. if (!noAssert) checkOffset(offset, 4, this.length)
  6864. return (this[offset]) |
  6865. (this[offset + 1] << 8) |
  6866. (this[offset + 2] << 16) |
  6867. (this[offset + 3] << 24)
  6868. }
  6869. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  6870. if (!noAssert) checkOffset(offset, 4, this.length)
  6871. return (this[offset] << 24) |
  6872. (this[offset + 1] << 16) |
  6873. (this[offset + 2] << 8) |
  6874. (this[offset + 3])
  6875. }
  6876. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  6877. if (!noAssert) checkOffset(offset, 4, this.length)
  6878. return ieee754.read(this, offset, true, 23, 4)
  6879. }
  6880. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  6881. if (!noAssert) checkOffset(offset, 4, this.length)
  6882. return ieee754.read(this, offset, false, 23, 4)
  6883. }
  6884. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  6885. if (!noAssert) checkOffset(offset, 8, this.length)
  6886. return ieee754.read(this, offset, true, 52, 8)
  6887. }
  6888. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  6889. if (!noAssert) checkOffset(offset, 8, this.length)
  6890. return ieee754.read(this, offset, false, 52, 8)
  6891. }
  6892. function checkInt (buf, value, offset, ext, max, min) {
  6893. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  6894. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  6895. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6896. }
  6897. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  6898. value = +value
  6899. offset = offset | 0
  6900. byteLength = byteLength | 0
  6901. if (!noAssert) {
  6902. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6903. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6904. }
  6905. var mul = 1
  6906. var i = 0
  6907. this[offset] = value & 0xFF
  6908. while (++i < byteLength && (mul *= 0x100)) {
  6909. this[offset + i] = (value / mul) & 0xFF
  6910. }
  6911. return offset + byteLength
  6912. }
  6913. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  6914. value = +value
  6915. offset = offset | 0
  6916. byteLength = byteLength | 0
  6917. if (!noAssert) {
  6918. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6919. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6920. }
  6921. var i = byteLength - 1
  6922. var mul = 1
  6923. this[offset + i] = value & 0xFF
  6924. while (--i >= 0 && (mul *= 0x100)) {
  6925. this[offset + i] = (value / mul) & 0xFF
  6926. }
  6927. return offset + byteLength
  6928. }
  6929. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  6930. value = +value
  6931. offset = offset | 0
  6932. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  6933. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6934. this[offset] = (value & 0xff)
  6935. return offset + 1
  6936. }
  6937. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  6938. if (value < 0) value = 0xffff + value + 1
  6939. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  6940. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  6941. (littleEndian ? i : 1 - i) * 8
  6942. }
  6943. }
  6944. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  6945. value = +value
  6946. offset = offset | 0
  6947. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6948. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6949. this[offset] = (value & 0xff)
  6950. this[offset + 1] = (value >>> 8)
  6951. } else {
  6952. objectWriteUInt16(this, value, offset, true)
  6953. }
  6954. return offset + 2
  6955. }
  6956. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  6957. value = +value
  6958. offset = offset | 0
  6959. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6960. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6961. this[offset] = (value >>> 8)
  6962. this[offset + 1] = (value & 0xff)
  6963. } else {
  6964. objectWriteUInt16(this, value, offset, false)
  6965. }
  6966. return offset + 2
  6967. }
  6968. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  6969. if (value < 0) value = 0xffffffff + value + 1
  6970. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  6971. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  6972. }
  6973. }
  6974. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  6975. value = +value
  6976. offset = offset | 0
  6977. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6978. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6979. this[offset + 3] = (value >>> 24)
  6980. this[offset + 2] = (value >>> 16)
  6981. this[offset + 1] = (value >>> 8)
  6982. this[offset] = (value & 0xff)
  6983. } else {
  6984. objectWriteUInt32(this, value, offset, true)
  6985. }
  6986. return offset + 4
  6987. }
  6988. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  6989. value = +value
  6990. offset = offset | 0
  6991. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6992. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6993. this[offset] = (value >>> 24)
  6994. this[offset + 1] = (value >>> 16)
  6995. this[offset + 2] = (value >>> 8)
  6996. this[offset + 3] = (value & 0xff)
  6997. } else {
  6998. objectWriteUInt32(this, value, offset, false)
  6999. }
  7000. return offset + 4
  7001. }
  7002. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7003. value = +value
  7004. offset = offset | 0
  7005. if (!noAssert) {
  7006. var limit = Math.pow(2, 8 * byteLength - 1)
  7007. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7008. }
  7009. var i = 0
  7010. var mul = 1
  7011. var sub = 0
  7012. this[offset] = value & 0xFF
  7013. while (++i < byteLength && (mul *= 0x100)) {
  7014. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7015. sub = 1
  7016. }
  7017. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7018. }
  7019. return offset + byteLength
  7020. }
  7021. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7022. value = +value
  7023. offset = offset | 0
  7024. if (!noAssert) {
  7025. var limit = Math.pow(2, 8 * byteLength - 1)
  7026. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7027. }
  7028. var i = byteLength - 1
  7029. var mul = 1
  7030. var sub = 0
  7031. this[offset + i] = value & 0xFF
  7032. while (--i >= 0 && (mul *= 0x100)) {
  7033. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7034. sub = 1
  7035. }
  7036. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7037. }
  7038. return offset + byteLength
  7039. }
  7040. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7041. value = +value
  7042. offset = offset | 0
  7043. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7044. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7045. if (value < 0) value = 0xff + value + 1
  7046. this[offset] = (value & 0xff)
  7047. return offset + 1
  7048. }
  7049. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7050. value = +value
  7051. offset = offset | 0
  7052. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7053. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7054. this[offset] = (value & 0xff)
  7055. this[offset + 1] = (value >>> 8)
  7056. } else {
  7057. objectWriteUInt16(this, value, offset, true)
  7058. }
  7059. return offset + 2
  7060. }
  7061. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7062. value = +value
  7063. offset = offset | 0
  7064. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7065. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7066. this[offset] = (value >>> 8)
  7067. this[offset + 1] = (value & 0xff)
  7068. } else {
  7069. objectWriteUInt16(this, value, offset, false)
  7070. }
  7071. return offset + 2
  7072. }
  7073. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7074. value = +value
  7075. offset = offset | 0
  7076. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7077. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7078. this[offset] = (value & 0xff)
  7079. this[offset + 1] = (value >>> 8)
  7080. this[offset + 2] = (value >>> 16)
  7081. this[offset + 3] = (value >>> 24)
  7082. } else {
  7083. objectWriteUInt32(this, value, offset, true)
  7084. }
  7085. return offset + 4
  7086. }
  7087. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7088. value = +value
  7089. offset = offset | 0
  7090. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7091. if (value < 0) value = 0xffffffff + value + 1
  7092. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7093. this[offset] = (value >>> 24)
  7094. this[offset + 1] = (value >>> 16)
  7095. this[offset + 2] = (value >>> 8)
  7096. this[offset + 3] = (value & 0xff)
  7097. } else {
  7098. objectWriteUInt32(this, value, offset, false)
  7099. }
  7100. return offset + 4
  7101. }
  7102. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7103. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7104. if (offset < 0) throw new RangeError('Index out of range')
  7105. }
  7106. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7107. if (!noAssert) {
  7108. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7109. }
  7110. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7111. return offset + 4
  7112. }
  7113. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7114. return writeFloat(this, value, offset, true, noAssert)
  7115. }
  7116. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7117. return writeFloat(this, value, offset, false, noAssert)
  7118. }
  7119. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7120. if (!noAssert) {
  7121. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7122. }
  7123. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7124. return offset + 8
  7125. }
  7126. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7127. return writeDouble(this, value, offset, true, noAssert)
  7128. }
  7129. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7130. return writeDouble(this, value, offset, false, noAssert)
  7131. }
  7132. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7133. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7134. if (!start) start = 0
  7135. if (!end && end !== 0) end = this.length
  7136. if (targetStart >= target.length) targetStart = target.length
  7137. if (!targetStart) targetStart = 0
  7138. if (end > 0 && end < start) end = start
  7139. // Copy 0 bytes; we're done
  7140. if (end === start) return 0
  7141. if (target.length === 0 || this.length === 0) return 0
  7142. // Fatal error conditions
  7143. if (targetStart < 0) {
  7144. throw new RangeError('targetStart out of bounds')
  7145. }
  7146. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7147. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7148. // Are we oob?
  7149. if (end > this.length) end = this.length
  7150. if (target.length - targetStart < end - start) {
  7151. end = target.length - targetStart + start
  7152. }
  7153. var len = end - start
  7154. var i
  7155. if (this === target && start < targetStart && targetStart < end) {
  7156. // descending copy from end
  7157. for (i = len - 1; i >= 0; --i) {
  7158. target[i + targetStart] = this[i + start]
  7159. }
  7160. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7161. // ascending copy from start
  7162. for (i = 0; i < len; ++i) {
  7163. target[i + targetStart] = this[i + start]
  7164. }
  7165. } else {
  7166. Uint8Array.prototype.set.call(
  7167. target,
  7168. this.subarray(start, start + len),
  7169. targetStart
  7170. )
  7171. }
  7172. return len
  7173. }
  7174. // Usage:
  7175. // buffer.fill(number[, offset[, end]])
  7176. // buffer.fill(buffer[, offset[, end]])
  7177. // buffer.fill(string[, offset[, end]][, encoding])
  7178. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7179. // Handle string cases:
  7180. if (typeof val === 'string') {
  7181. if (typeof start === 'string') {
  7182. encoding = start
  7183. start = 0
  7184. end = this.length
  7185. } else if (typeof end === 'string') {
  7186. encoding = end
  7187. end = this.length
  7188. }
  7189. if (val.length === 1) {
  7190. var code = val.charCodeAt(0)
  7191. if (code < 256) {
  7192. val = code
  7193. }
  7194. }
  7195. if (encoding !== undefined && typeof encoding !== 'string') {
  7196. throw new TypeError('encoding must be a string')
  7197. }
  7198. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7199. throw new TypeError('Unknown encoding: ' + encoding)
  7200. }
  7201. } else if (typeof val === 'number') {
  7202. val = val & 255
  7203. }
  7204. // Invalid ranges are not set to a default, so can range check early.
  7205. if (start < 0 || this.length < start || this.length < end) {
  7206. throw new RangeError('Out of range index')
  7207. }
  7208. if (end <= start) {
  7209. return this
  7210. }
  7211. start = start >>> 0
  7212. end = end === undefined ? this.length : end >>> 0
  7213. if (!val) val = 0
  7214. var i
  7215. if (typeof val === 'number') {
  7216. for (i = start; i < end; ++i) {
  7217. this[i] = val
  7218. }
  7219. } else {
  7220. var bytes = Buffer.isBuffer(val)
  7221. ? val
  7222. : utf8ToBytes(new Buffer(val, encoding).toString())
  7223. var len = bytes.length
  7224. for (i = 0; i < end - start; ++i) {
  7225. this[i + start] = bytes[i % len]
  7226. }
  7227. }
  7228. return this
  7229. }
  7230. // HELPER FUNCTIONS
  7231. // ================
  7232. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7233. function base64clean (str) {
  7234. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7235. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7236. // Node converts strings with length < 2 to ''
  7237. if (str.length < 2) return ''
  7238. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7239. while (str.length % 4 !== 0) {
  7240. str = str + '='
  7241. }
  7242. return str
  7243. }
  7244. function stringtrim (str) {
  7245. if (str.trim) return str.trim()
  7246. return str.replace(/^\s+|\s+$/g, '')
  7247. }
  7248. function toHex (n) {
  7249. if (n < 16) return '0' + n.toString(16)
  7250. return n.toString(16)
  7251. }
  7252. function utf8ToBytes (string, units) {
  7253. units = units || Infinity
  7254. var codePoint
  7255. var length = string.length
  7256. var leadSurrogate = null
  7257. var bytes = []
  7258. for (var i = 0; i < length; ++i) {
  7259. codePoint = string.charCodeAt(i)
  7260. // is surrogate component
  7261. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7262. // last char was a lead
  7263. if (!leadSurrogate) {
  7264. // no lead yet
  7265. if (codePoint > 0xDBFF) {
  7266. // unexpected trail
  7267. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7268. continue
  7269. } else if (i + 1 === length) {
  7270. // unpaired lead
  7271. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7272. continue
  7273. }
  7274. // valid lead
  7275. leadSurrogate = codePoint
  7276. continue
  7277. }
  7278. // 2 leads in a row
  7279. if (codePoint < 0xDC00) {
  7280. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7281. leadSurrogate = codePoint
  7282. continue
  7283. }
  7284. // valid surrogate pair
  7285. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7286. } else if (leadSurrogate) {
  7287. // valid bmp char, but last char was a lead
  7288. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7289. }
  7290. leadSurrogate = null
  7291. // encode utf8
  7292. if (codePoint < 0x80) {
  7293. if ((units -= 1) < 0) break
  7294. bytes.push(codePoint)
  7295. } else if (codePoint < 0x800) {
  7296. if ((units -= 2) < 0) break
  7297. bytes.push(
  7298. codePoint >> 0x6 | 0xC0,
  7299. codePoint & 0x3F | 0x80
  7300. )
  7301. } else if (codePoint < 0x10000) {
  7302. if ((units -= 3) < 0) break
  7303. bytes.push(
  7304. codePoint >> 0xC | 0xE0,
  7305. codePoint >> 0x6 & 0x3F | 0x80,
  7306. codePoint & 0x3F | 0x80
  7307. )
  7308. } else if (codePoint < 0x110000) {
  7309. if ((units -= 4) < 0) break
  7310. bytes.push(
  7311. codePoint >> 0x12 | 0xF0,
  7312. codePoint >> 0xC & 0x3F | 0x80,
  7313. codePoint >> 0x6 & 0x3F | 0x80,
  7314. codePoint & 0x3F | 0x80
  7315. )
  7316. } else {
  7317. throw new Error('Invalid code point')
  7318. }
  7319. }
  7320. return bytes
  7321. }
  7322. function asciiToBytes (str) {
  7323. var byteArray = []
  7324. for (var i = 0; i < str.length; ++i) {
  7325. // Node's code seems to be doing this and not & 0x7F..
  7326. byteArray.push(str.charCodeAt(i) & 0xFF)
  7327. }
  7328. return byteArray
  7329. }
  7330. function utf16leToBytes (str, units) {
  7331. var c, hi, lo
  7332. var byteArray = []
  7333. for (var i = 0; i < str.length; ++i) {
  7334. if ((units -= 2) < 0) break
  7335. c = str.charCodeAt(i)
  7336. hi = c >> 8
  7337. lo = c % 256
  7338. byteArray.push(lo)
  7339. byteArray.push(hi)
  7340. }
  7341. return byteArray
  7342. }
  7343. function base64ToBytes (str) {
  7344. return base64.toByteArray(base64clean(str))
  7345. }
  7346. function blitBuffer (src, dst, offset, length) {
  7347. for (var i = 0; i < length; ++i) {
  7348. if ((i + offset >= dst.length) || (i >= src.length)) break
  7349. dst[i + offset] = src[i]
  7350. }
  7351. return i
  7352. }
  7353. function isnan (val) {
  7354. return val !== val // eslint-disable-line no-self-compare
  7355. }
  7356. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7357. /***/ }),
  7358. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7359. /*!**************************************************!*\
  7360. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7361. \**************************************************/
  7362. /*! no static exports found */
  7363. /***/ (function(module, exports, __webpack_require__) {
  7364. /*!
  7365. * clipboard.js v2.0.4
  7366. * https://zenorocha.github.io/clipboard.js
  7367. *
  7368. * Licensed MIT © Zeno Rocha
  7369. */
  7370. (function webpackUniversalModuleDefinition(root, factory) {
  7371. if(true)
  7372. module.exports = factory();
  7373. else {}
  7374. })(this, function() {
  7375. return /******/ (function(modules) { // webpackBootstrap
  7376. /******/ // The module cache
  7377. /******/ var installedModules = {};
  7378. /******/
  7379. /******/ // The require function
  7380. /******/ function __webpack_require__(moduleId) {
  7381. /******/
  7382. /******/ // Check if module is in cache
  7383. /******/ if(installedModules[moduleId]) {
  7384. /******/ return installedModules[moduleId].exports;
  7385. /******/ }
  7386. /******/ // Create a new module (and put it into the cache)
  7387. /******/ var module = installedModules[moduleId] = {
  7388. /******/ i: moduleId,
  7389. /******/ l: false,
  7390. /******/ exports: {}
  7391. /******/ };
  7392. /******/
  7393. /******/ // Execute the module function
  7394. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7395. /******/
  7396. /******/ // Flag the module as loaded
  7397. /******/ module.l = true;
  7398. /******/
  7399. /******/ // Return the exports of the module
  7400. /******/ return module.exports;
  7401. /******/ }
  7402. /******/
  7403. /******/
  7404. /******/ // expose the modules object (__webpack_modules__)
  7405. /******/ __webpack_require__.m = modules;
  7406. /******/
  7407. /******/ // expose the module cache
  7408. /******/ __webpack_require__.c = installedModules;
  7409. /******/
  7410. /******/ // define getter function for harmony exports
  7411. /******/ __webpack_require__.d = function(exports, name, getter) {
  7412. /******/ if(!__webpack_require__.o(exports, name)) {
  7413. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7414. /******/ }
  7415. /******/ };
  7416. /******/
  7417. /******/ // define __esModule on exports
  7418. /******/ __webpack_require__.r = function(exports) {
  7419. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7420. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7421. /******/ }
  7422. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7423. /******/ };
  7424. /******/
  7425. /******/ // create a fake namespace object
  7426. /******/ // mode & 1: value is a module id, require it
  7427. /******/ // mode & 2: merge all properties of value into the ns
  7428. /******/ // mode & 4: return value when already ns object
  7429. /******/ // mode & 8|1: behave like require
  7430. /******/ __webpack_require__.t = function(value, mode) {
  7431. /******/ if(mode & 1) value = __webpack_require__(value);
  7432. /******/ if(mode & 8) return value;
  7433. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7434. /******/ var ns = Object.create(null);
  7435. /******/ __webpack_require__.r(ns);
  7436. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7437. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7438. /******/ return ns;
  7439. /******/ };
  7440. /******/
  7441. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7442. /******/ __webpack_require__.n = function(module) {
  7443. /******/ var getter = module && module.__esModule ?
  7444. /******/ function getDefault() { return module['default']; } :
  7445. /******/ function getModuleExports() { return module; };
  7446. /******/ __webpack_require__.d(getter, 'a', getter);
  7447. /******/ return getter;
  7448. /******/ };
  7449. /******/
  7450. /******/ // Object.prototype.hasOwnProperty.call
  7451. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7452. /******/
  7453. /******/ // __webpack_public_path__
  7454. /******/ __webpack_require__.p = "";
  7455. /******/
  7456. /******/
  7457. /******/ // Load entry module and return exports
  7458. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7459. /******/ })
  7460. /************************************************************************/
  7461. /******/ ([
  7462. /* 0 */
  7463. /***/ (function(module, exports, __webpack_require__) {
  7464. "use strict";
  7465. 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; };
  7466. 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; }; }();
  7467. var _clipboardAction = __webpack_require__(1);
  7468. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7469. var _tinyEmitter = __webpack_require__(3);
  7470. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7471. var _goodListener = __webpack_require__(4);
  7472. var _goodListener2 = _interopRequireDefault(_goodListener);
  7473. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7474. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7475. 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; }
  7476. 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; }
  7477. /**
  7478. * Base class which takes one or more elements, adds event listeners to them,
  7479. * and instantiates a new `ClipboardAction` on each click.
  7480. */
  7481. var Clipboard = function (_Emitter) {
  7482. _inherits(Clipboard, _Emitter);
  7483. /**
  7484. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7485. * @param {Object} options
  7486. */
  7487. function Clipboard(trigger, options) {
  7488. _classCallCheck(this, Clipboard);
  7489. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7490. _this.resolveOptions(options);
  7491. _this.listenClick(trigger);
  7492. return _this;
  7493. }
  7494. /**
  7495. * Defines if attributes would be resolved using internal setter functions
  7496. * or custom functions that were passed in the constructor.
  7497. * @param {Object} options
  7498. */
  7499. _createClass(Clipboard, [{
  7500. key: 'resolveOptions',
  7501. value: function resolveOptions() {
  7502. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7503. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7504. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7505. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7506. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7507. }
  7508. /**
  7509. * Adds a click event listener to the passed trigger.
  7510. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7511. */
  7512. }, {
  7513. key: 'listenClick',
  7514. value: function listenClick(trigger) {
  7515. var _this2 = this;
  7516. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7517. return _this2.onClick(e);
  7518. });
  7519. }
  7520. /**
  7521. * Defines a new `ClipboardAction` on each click event.
  7522. * @param {Event} e
  7523. */
  7524. }, {
  7525. key: 'onClick',
  7526. value: function onClick(e) {
  7527. var trigger = e.delegateTarget || e.currentTarget;
  7528. if (this.clipboardAction) {
  7529. this.clipboardAction = null;
  7530. }
  7531. this.clipboardAction = new _clipboardAction2.default({
  7532. action: this.action(trigger),
  7533. target: this.target(trigger),
  7534. text: this.text(trigger),
  7535. container: this.container,
  7536. trigger: trigger,
  7537. emitter: this
  7538. });
  7539. }
  7540. /**
  7541. * Default `action` lookup function.
  7542. * @param {Element} trigger
  7543. */
  7544. }, {
  7545. key: 'defaultAction',
  7546. value: function defaultAction(trigger) {
  7547. return getAttributeValue('action', trigger);
  7548. }
  7549. /**
  7550. * Default `target` lookup function.
  7551. * @param {Element} trigger
  7552. */
  7553. }, {
  7554. key: 'defaultTarget',
  7555. value: function defaultTarget(trigger) {
  7556. var selector = getAttributeValue('target', trigger);
  7557. if (selector) {
  7558. return document.querySelector(selector);
  7559. }
  7560. }
  7561. /**
  7562. * Returns the support of the given action, or all actions if no action is
  7563. * given.
  7564. * @param {String} [action]
  7565. */
  7566. }, {
  7567. key: 'defaultText',
  7568. /**
  7569. * Default `text` lookup function.
  7570. * @param {Element} trigger
  7571. */
  7572. value: function defaultText(trigger) {
  7573. return getAttributeValue('text', trigger);
  7574. }
  7575. /**
  7576. * Destroy lifecycle.
  7577. */
  7578. }, {
  7579. key: 'destroy',
  7580. value: function destroy() {
  7581. this.listener.destroy();
  7582. if (this.clipboardAction) {
  7583. this.clipboardAction.destroy();
  7584. this.clipboardAction = null;
  7585. }
  7586. }
  7587. }], [{
  7588. key: 'isSupported',
  7589. value: function isSupported() {
  7590. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7591. var actions = typeof action === 'string' ? [action] : action;
  7592. var support = !!document.queryCommandSupported;
  7593. actions.forEach(function (action) {
  7594. support = support && !!document.queryCommandSupported(action);
  7595. });
  7596. return support;
  7597. }
  7598. }]);
  7599. return Clipboard;
  7600. }(_tinyEmitter2.default);
  7601. /**
  7602. * Helper function to retrieve attribute value.
  7603. * @param {String} suffix
  7604. * @param {Element} element
  7605. */
  7606. function getAttributeValue(suffix, element) {
  7607. var attribute = 'data-clipboard-' + suffix;
  7608. if (!element.hasAttribute(attribute)) {
  7609. return;
  7610. }
  7611. return element.getAttribute(attribute);
  7612. }
  7613. module.exports = Clipboard;
  7614. /***/ }),
  7615. /* 1 */
  7616. /***/ (function(module, exports, __webpack_require__) {
  7617. "use strict";
  7618. 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; };
  7619. 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; }; }();
  7620. var _select = __webpack_require__(2);
  7621. var _select2 = _interopRequireDefault(_select);
  7622. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7623. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7624. /**
  7625. * Inner class which performs selection from either `text` or `target`
  7626. * properties and then executes copy or cut operations.
  7627. */
  7628. var ClipboardAction = function () {
  7629. /**
  7630. * @param {Object} options
  7631. */
  7632. function ClipboardAction(options) {
  7633. _classCallCheck(this, ClipboardAction);
  7634. this.resolveOptions(options);
  7635. this.initSelection();
  7636. }
  7637. /**
  7638. * Defines base properties passed from constructor.
  7639. * @param {Object} options
  7640. */
  7641. _createClass(ClipboardAction, [{
  7642. key: 'resolveOptions',
  7643. value: function resolveOptions() {
  7644. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7645. this.action = options.action;
  7646. this.container = options.container;
  7647. this.emitter = options.emitter;
  7648. this.target = options.target;
  7649. this.text = options.text;
  7650. this.trigger = options.trigger;
  7651. this.selectedText = '';
  7652. }
  7653. /**
  7654. * Decides which selection strategy is going to be applied based
  7655. * on the existence of `text` and `target` properties.
  7656. */
  7657. }, {
  7658. key: 'initSelection',
  7659. value: function initSelection() {
  7660. if (this.text) {
  7661. this.selectFake();
  7662. } else if (this.target) {
  7663. this.selectTarget();
  7664. }
  7665. }
  7666. /**
  7667. * Creates a fake textarea element, sets its value from `text` property,
  7668. * and makes a selection on it.
  7669. */
  7670. }, {
  7671. key: 'selectFake',
  7672. value: function selectFake() {
  7673. var _this = this;
  7674. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7675. this.removeFake();
  7676. this.fakeHandlerCallback = function () {
  7677. return _this.removeFake();
  7678. };
  7679. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7680. this.fakeElem = document.createElement('textarea');
  7681. // Prevent zooming on iOS
  7682. this.fakeElem.style.fontSize = '12pt';
  7683. // Reset box model
  7684. this.fakeElem.style.border = '0';
  7685. this.fakeElem.style.padding = '0';
  7686. this.fakeElem.style.margin = '0';
  7687. // Move element out of screen horizontally
  7688. this.fakeElem.style.position = 'absolute';
  7689. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7690. // Move element to the same position vertically
  7691. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7692. this.fakeElem.style.top = yPosition + 'px';
  7693. this.fakeElem.setAttribute('readonly', '');
  7694. this.fakeElem.value = this.text;
  7695. this.container.appendChild(this.fakeElem);
  7696. this.selectedText = (0, _select2.default)(this.fakeElem);
  7697. this.copyText();
  7698. }
  7699. /**
  7700. * Only removes the fake element after another click event, that way
  7701. * a user can hit `Ctrl+C` to copy because selection still exists.
  7702. */
  7703. }, {
  7704. key: 'removeFake',
  7705. value: function removeFake() {
  7706. if (this.fakeHandler) {
  7707. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7708. this.fakeHandler = null;
  7709. this.fakeHandlerCallback = null;
  7710. }
  7711. if (this.fakeElem) {
  7712. this.container.removeChild(this.fakeElem);
  7713. this.fakeElem = null;
  7714. }
  7715. }
  7716. /**
  7717. * Selects the content from element passed on `target` property.
  7718. */
  7719. }, {
  7720. key: 'selectTarget',
  7721. value: function selectTarget() {
  7722. this.selectedText = (0, _select2.default)(this.target);
  7723. this.copyText();
  7724. }
  7725. /**
  7726. * Executes the copy operation based on the current selection.
  7727. */
  7728. }, {
  7729. key: 'copyText',
  7730. value: function copyText() {
  7731. var succeeded = void 0;
  7732. try {
  7733. succeeded = document.execCommand(this.action);
  7734. } catch (err) {
  7735. succeeded = false;
  7736. }
  7737. this.handleResult(succeeded);
  7738. }
  7739. /**
  7740. * Fires an event based on the copy operation result.
  7741. * @param {Boolean} succeeded
  7742. */
  7743. }, {
  7744. key: 'handleResult',
  7745. value: function handleResult(succeeded) {
  7746. this.emitter.emit(succeeded ? 'success' : 'error', {
  7747. action: this.action,
  7748. text: this.selectedText,
  7749. trigger: this.trigger,
  7750. clearSelection: this.clearSelection.bind(this)
  7751. });
  7752. }
  7753. /**
  7754. * Moves focus away from `target` and back to the trigger, removes current selection.
  7755. */
  7756. }, {
  7757. key: 'clearSelection',
  7758. value: function clearSelection() {
  7759. if (this.trigger) {
  7760. this.trigger.focus();
  7761. }
  7762. window.getSelection().removeAllRanges();
  7763. }
  7764. /**
  7765. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  7766. * @param {String} action
  7767. */
  7768. }, {
  7769. key: 'destroy',
  7770. /**
  7771. * Destroy lifecycle.
  7772. */
  7773. value: function destroy() {
  7774. this.removeFake();
  7775. }
  7776. }, {
  7777. key: 'action',
  7778. set: function set() {
  7779. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  7780. this._action = action;
  7781. if (this._action !== 'copy' && this._action !== 'cut') {
  7782. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  7783. }
  7784. }
  7785. /**
  7786. * Gets the `action` property.
  7787. * @return {String}
  7788. */
  7789. ,
  7790. get: function get() {
  7791. return this._action;
  7792. }
  7793. /**
  7794. * Sets the `target` property using an element
  7795. * that will be have its content copied.
  7796. * @param {Element} target
  7797. */
  7798. }, {
  7799. key: 'target',
  7800. set: function set(target) {
  7801. if (target !== undefined) {
  7802. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  7803. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  7804. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  7805. }
  7806. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  7807. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  7808. }
  7809. this._target = target;
  7810. } else {
  7811. throw new Error('Invalid "target" value, use a valid Element');
  7812. }
  7813. }
  7814. }
  7815. /**
  7816. * Gets the `target` property.
  7817. * @return {String|HTMLElement}
  7818. */
  7819. ,
  7820. get: function get() {
  7821. return this._target;
  7822. }
  7823. }]);
  7824. return ClipboardAction;
  7825. }();
  7826. module.exports = ClipboardAction;
  7827. /***/ }),
  7828. /* 2 */
  7829. /***/ (function(module, exports) {
  7830. function select(element) {
  7831. var selectedText;
  7832. if (element.nodeName === 'SELECT') {
  7833. element.focus();
  7834. selectedText = element.value;
  7835. }
  7836. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  7837. var isReadOnly = element.hasAttribute('readonly');
  7838. if (!isReadOnly) {
  7839. element.setAttribute('readonly', '');
  7840. }
  7841. element.select();
  7842. element.setSelectionRange(0, element.value.length);
  7843. if (!isReadOnly) {
  7844. element.removeAttribute('readonly');
  7845. }
  7846. selectedText = element.value;
  7847. }
  7848. else {
  7849. if (element.hasAttribute('contenteditable')) {
  7850. element.focus();
  7851. }
  7852. var selection = window.getSelection();
  7853. var range = document.createRange();
  7854. range.selectNodeContents(element);
  7855. selection.removeAllRanges();
  7856. selection.addRange(range);
  7857. selectedText = selection.toString();
  7858. }
  7859. return selectedText;
  7860. }
  7861. module.exports = select;
  7862. /***/ }),
  7863. /* 3 */
  7864. /***/ (function(module, exports) {
  7865. function E () {
  7866. // Keep this empty so it's easier to inherit from
  7867. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  7868. }
  7869. E.prototype = {
  7870. on: function (name, callback, ctx) {
  7871. var e = this.e || (this.e = {});
  7872. (e[name] || (e[name] = [])).push({
  7873. fn: callback,
  7874. ctx: ctx
  7875. });
  7876. return this;
  7877. },
  7878. once: function (name, callback, ctx) {
  7879. var self = this;
  7880. function listener () {
  7881. self.off(name, listener);
  7882. callback.apply(ctx, arguments);
  7883. };
  7884. listener._ = callback
  7885. return this.on(name, listener, ctx);
  7886. },
  7887. emit: function (name) {
  7888. var data = [].slice.call(arguments, 1);
  7889. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  7890. var i = 0;
  7891. var len = evtArr.length;
  7892. for (i; i < len; i++) {
  7893. evtArr[i].fn.apply(evtArr[i].ctx, data);
  7894. }
  7895. return this;
  7896. },
  7897. off: function (name, callback) {
  7898. var e = this.e || (this.e = {});
  7899. var evts = e[name];
  7900. var liveEvents = [];
  7901. if (evts && callback) {
  7902. for (var i = 0, len = evts.length; i < len; i++) {
  7903. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  7904. liveEvents.push(evts[i]);
  7905. }
  7906. }
  7907. // Remove event from queue to prevent memory leak
  7908. // Suggested by https://github.com/lazd
  7909. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  7910. (liveEvents.length)
  7911. ? e[name] = liveEvents
  7912. : delete e[name];
  7913. return this;
  7914. }
  7915. };
  7916. module.exports = E;
  7917. /***/ }),
  7918. /* 4 */
  7919. /***/ (function(module, exports, __webpack_require__) {
  7920. var is = __webpack_require__(5);
  7921. var delegate = __webpack_require__(6);
  7922. /**
  7923. * Validates all params and calls the right
  7924. * listener function based on its target type.
  7925. *
  7926. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  7927. * @param {String} type
  7928. * @param {Function} callback
  7929. * @return {Object}
  7930. */
  7931. function listen(target, type, callback) {
  7932. if (!target && !type && !callback) {
  7933. throw new Error('Missing required arguments');
  7934. }
  7935. if (!is.string(type)) {
  7936. throw new TypeError('Second argument must be a String');
  7937. }
  7938. if (!is.fn(callback)) {
  7939. throw new TypeError('Third argument must be a Function');
  7940. }
  7941. if (is.node(target)) {
  7942. return listenNode(target, type, callback);
  7943. }
  7944. else if (is.nodeList(target)) {
  7945. return listenNodeList(target, type, callback);
  7946. }
  7947. else if (is.string(target)) {
  7948. return listenSelector(target, type, callback);
  7949. }
  7950. else {
  7951. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  7952. }
  7953. }
  7954. /**
  7955. * Adds an event listener to a HTML element
  7956. * and returns a remove listener function.
  7957. *
  7958. * @param {HTMLElement} node
  7959. * @param {String} type
  7960. * @param {Function} callback
  7961. * @return {Object}
  7962. */
  7963. function listenNode(node, type, callback) {
  7964. node.addEventListener(type, callback);
  7965. return {
  7966. destroy: function() {
  7967. node.removeEventListener(type, callback);
  7968. }
  7969. }
  7970. }
  7971. /**
  7972. * Add an event listener to a list of HTML elements
  7973. * and returns a remove listener function.
  7974. *
  7975. * @param {NodeList|HTMLCollection} nodeList
  7976. * @param {String} type
  7977. * @param {Function} callback
  7978. * @return {Object}
  7979. */
  7980. function listenNodeList(nodeList, type, callback) {
  7981. Array.prototype.forEach.call(nodeList, function(node) {
  7982. node.addEventListener(type, callback);
  7983. });
  7984. return {
  7985. destroy: function() {
  7986. Array.prototype.forEach.call(nodeList, function(node) {
  7987. node.removeEventListener(type, callback);
  7988. });
  7989. }
  7990. }
  7991. }
  7992. /**
  7993. * Add an event listener to a selector
  7994. * and returns a remove listener function.
  7995. *
  7996. * @param {String} selector
  7997. * @param {String} type
  7998. * @param {Function} callback
  7999. * @return {Object}
  8000. */
  8001. function listenSelector(selector, type, callback) {
  8002. return delegate(document.body, selector, type, callback);
  8003. }
  8004. module.exports = listen;
  8005. /***/ }),
  8006. /* 5 */
  8007. /***/ (function(module, exports) {
  8008. /**
  8009. * Check if argument is a HTML element.
  8010. *
  8011. * @param {Object} value
  8012. * @return {Boolean}
  8013. */
  8014. exports.node = function(value) {
  8015. return value !== undefined
  8016. && value instanceof HTMLElement
  8017. && value.nodeType === 1;
  8018. };
  8019. /**
  8020. * Check if argument is a list of HTML elements.
  8021. *
  8022. * @param {Object} value
  8023. * @return {Boolean}
  8024. */
  8025. exports.nodeList = function(value) {
  8026. var type = Object.prototype.toString.call(value);
  8027. return value !== undefined
  8028. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8029. && ('length' in value)
  8030. && (value.length === 0 || exports.node(value[0]));
  8031. };
  8032. /**
  8033. * Check if argument is a string.
  8034. *
  8035. * @param {Object} value
  8036. * @return {Boolean}
  8037. */
  8038. exports.string = function(value) {
  8039. return typeof value === 'string'
  8040. || value instanceof String;
  8041. };
  8042. /**
  8043. * Check if argument is a function.
  8044. *
  8045. * @param {Object} value
  8046. * @return {Boolean}
  8047. */
  8048. exports.fn = function(value) {
  8049. var type = Object.prototype.toString.call(value);
  8050. return type === '[object Function]';
  8051. };
  8052. /***/ }),
  8053. /* 6 */
  8054. /***/ (function(module, exports, __webpack_require__) {
  8055. var closest = __webpack_require__(7);
  8056. /**
  8057. * Delegates event to a selector.
  8058. *
  8059. * @param {Element} element
  8060. * @param {String} selector
  8061. * @param {String} type
  8062. * @param {Function} callback
  8063. * @param {Boolean} useCapture
  8064. * @return {Object}
  8065. */
  8066. function _delegate(element, selector, type, callback, useCapture) {
  8067. var listenerFn = listener.apply(this, arguments);
  8068. element.addEventListener(type, listenerFn, useCapture);
  8069. return {
  8070. destroy: function() {
  8071. element.removeEventListener(type, listenerFn, useCapture);
  8072. }
  8073. }
  8074. }
  8075. /**
  8076. * Delegates event to a selector.
  8077. *
  8078. * @param {Element|String|Array} [elements]
  8079. * @param {String} selector
  8080. * @param {String} type
  8081. * @param {Function} callback
  8082. * @param {Boolean} useCapture
  8083. * @return {Object}
  8084. */
  8085. function delegate(elements, selector, type, callback, useCapture) {
  8086. // Handle the regular Element usage
  8087. if (typeof elements.addEventListener === 'function') {
  8088. return _delegate.apply(null, arguments);
  8089. }
  8090. // Handle Element-less usage, it defaults to global delegation
  8091. if (typeof type === 'function') {
  8092. // Use `document` as the first parameter, then apply arguments
  8093. // This is a short way to .unshift `arguments` without running into deoptimizations
  8094. return _delegate.bind(null, document).apply(null, arguments);
  8095. }
  8096. // Handle Selector-based usage
  8097. if (typeof elements === 'string') {
  8098. elements = document.querySelectorAll(elements);
  8099. }
  8100. // Handle Array-like based usage
  8101. return Array.prototype.map.call(elements, function (element) {
  8102. return _delegate(element, selector, type, callback, useCapture);
  8103. });
  8104. }
  8105. /**
  8106. * Finds closest match and invokes callback.
  8107. *
  8108. * @param {Element} element
  8109. * @param {String} selector
  8110. * @param {String} type
  8111. * @param {Function} callback
  8112. * @return {Function}
  8113. */
  8114. function listener(element, selector, type, callback) {
  8115. return function(e) {
  8116. e.delegateTarget = closest(e.target, selector);
  8117. if (e.delegateTarget) {
  8118. callback.call(element, e);
  8119. }
  8120. }
  8121. }
  8122. module.exports = delegate;
  8123. /***/ }),
  8124. /* 7 */
  8125. /***/ (function(module, exports) {
  8126. var DOCUMENT_NODE_TYPE = 9;
  8127. /**
  8128. * A polyfill for Element.matches()
  8129. */
  8130. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8131. var proto = Element.prototype;
  8132. proto.matches = proto.matchesSelector ||
  8133. proto.mozMatchesSelector ||
  8134. proto.msMatchesSelector ||
  8135. proto.oMatchesSelector ||
  8136. proto.webkitMatchesSelector;
  8137. }
  8138. /**
  8139. * Finds the closest parent that matches a selector.
  8140. *
  8141. * @param {Element} element
  8142. * @param {String} selector
  8143. * @return {Function}
  8144. */
  8145. function closest (element, selector) {
  8146. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8147. if (typeof element.matches === 'function' &&
  8148. element.matches(selector)) {
  8149. return element;
  8150. }
  8151. element = element.parentNode;
  8152. }
  8153. }
  8154. module.exports = closest;
  8155. /***/ })
  8156. /******/ ]);
  8157. });
  8158. /***/ }),
  8159. /***/ "./node_modules/ieee754/index.js":
  8160. /*!***************************************!*\
  8161. !*** ./node_modules/ieee754/index.js ***!
  8162. \***************************************/
  8163. /*! no static exports found */
  8164. /***/ (function(module, exports) {
  8165. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8166. var e, m
  8167. var eLen = (nBytes * 8) - mLen - 1
  8168. var eMax = (1 << eLen) - 1
  8169. var eBias = eMax >> 1
  8170. var nBits = -7
  8171. var i = isLE ? (nBytes - 1) : 0
  8172. var d = isLE ? -1 : 1
  8173. var s = buffer[offset + i]
  8174. i += d
  8175. e = s & ((1 << (-nBits)) - 1)
  8176. s >>= (-nBits)
  8177. nBits += eLen
  8178. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8179. m = e & ((1 << (-nBits)) - 1)
  8180. e >>= (-nBits)
  8181. nBits += mLen
  8182. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8183. if (e === 0) {
  8184. e = 1 - eBias
  8185. } else if (e === eMax) {
  8186. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8187. } else {
  8188. m = m + Math.pow(2, mLen)
  8189. e = e - eBias
  8190. }
  8191. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8192. }
  8193. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8194. var e, m, c
  8195. var eLen = (nBytes * 8) - mLen - 1
  8196. var eMax = (1 << eLen) - 1
  8197. var eBias = eMax >> 1
  8198. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8199. var i = isLE ? 0 : (nBytes - 1)
  8200. var d = isLE ? 1 : -1
  8201. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8202. value = Math.abs(value)
  8203. if (isNaN(value) || value === Infinity) {
  8204. m = isNaN(value) ? 1 : 0
  8205. e = eMax
  8206. } else {
  8207. e = Math.floor(Math.log(value) / Math.LN2)
  8208. if (value * (c = Math.pow(2, -e)) < 1) {
  8209. e--
  8210. c *= 2
  8211. }
  8212. if (e + eBias >= 1) {
  8213. value += rt / c
  8214. } else {
  8215. value += rt * Math.pow(2, 1 - eBias)
  8216. }
  8217. if (value * c >= 2) {
  8218. e++
  8219. c /= 2
  8220. }
  8221. if (e + eBias >= eMax) {
  8222. m = 0
  8223. e = eMax
  8224. } else if (e + eBias >= 1) {
  8225. m = ((value * c) - 1) * Math.pow(2, mLen)
  8226. e = e + eBias
  8227. } else {
  8228. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8229. e = 0
  8230. }
  8231. }
  8232. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8233. e = (e << mLen) | m
  8234. eLen += mLen
  8235. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8236. buffer[offset + i - d] |= s * 128
  8237. }
  8238. /***/ }),
  8239. /***/ "./node_modules/isarray/index.js":
  8240. /*!***************************************!*\
  8241. !*** ./node_modules/isarray/index.js ***!
  8242. \***************************************/
  8243. /*! no static exports found */
  8244. /***/ (function(module, exports) {
  8245. var toString = {}.toString;
  8246. module.exports = Array.isArray || function (arr) {
  8247. return toString.call(arr) == '[object Array]';
  8248. };
  8249. /***/ }),
  8250. /***/ "./node_modules/jquery/dist/jquery.js":
  8251. /*!********************************************!*\
  8252. !*** ./node_modules/jquery/dist/jquery.js ***!
  8253. \********************************************/
  8254. /*! no static exports found */
  8255. /***/ (function(module, exports, __webpack_require__) {
  8256. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8257. * jQuery JavaScript Library v3.4.1
  8258. * https://jquery.com/
  8259. *
  8260. * Includes Sizzle.js
  8261. * https://sizzlejs.com/
  8262. *
  8263. * Copyright JS Foundation and other contributors
  8264. * Released under the MIT license
  8265. * https://jquery.org/license
  8266. *
  8267. * Date: 2019-05-01T21:04Z
  8268. */
  8269. ( function( global, factory ) {
  8270. "use strict";
  8271. if ( true && typeof module.exports === "object" ) {
  8272. // For CommonJS and CommonJS-like environments where a proper `window`
  8273. // is present, execute the factory and get jQuery.
  8274. // For environments that do not have a `window` with a `document`
  8275. // (such as Node.js), expose a factory as module.exports.
  8276. // This accentuates the need for the creation of a real `window`.
  8277. // e.g. var jQuery = require("jquery")(window);
  8278. // See ticket #14549 for more info.
  8279. module.exports = global.document ?
  8280. factory( global, true ) :
  8281. function( w ) {
  8282. if ( !w.document ) {
  8283. throw new Error( "jQuery requires a window with a document" );
  8284. }
  8285. return factory( w );
  8286. };
  8287. } else {
  8288. factory( global );
  8289. }
  8290. // Pass this if window is not defined yet
  8291. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8292. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8293. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8294. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8295. // enough that all such attempts are guarded in a try block.
  8296. "use strict";
  8297. var arr = [];
  8298. var document = window.document;
  8299. var getProto = Object.getPrototypeOf;
  8300. var slice = arr.slice;
  8301. var concat = arr.concat;
  8302. var push = arr.push;
  8303. var indexOf = arr.indexOf;
  8304. var class2type = {};
  8305. var toString = class2type.toString;
  8306. var hasOwn = class2type.hasOwnProperty;
  8307. var fnToString = hasOwn.toString;
  8308. var ObjectFunctionString = fnToString.call( Object );
  8309. var support = {};
  8310. var isFunction = function isFunction( obj ) {
  8311. // Support: Chrome <=57, Firefox <=52
  8312. // In some browsers, typeof returns "function" for HTML <object> elements
  8313. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8314. // We don't want to classify *any* DOM node as a function.
  8315. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8316. };
  8317. var isWindow = function isWindow( obj ) {
  8318. return obj != null && obj === obj.window;
  8319. };
  8320. var preservedScriptAttributes = {
  8321. type: true,
  8322. src: true,
  8323. nonce: true,
  8324. noModule: true
  8325. };
  8326. function DOMEval( code, node, doc ) {
  8327. doc = doc || document;
  8328. var i, val,
  8329. script = doc.createElement( "script" );
  8330. script.text = code;
  8331. if ( node ) {
  8332. for ( i in preservedScriptAttributes ) {
  8333. // Support: Firefox 64+, Edge 18+
  8334. // Some browsers don't support the "nonce" property on scripts.
  8335. // On the other hand, just using `getAttribute` is not enough as
  8336. // the `nonce` attribute is reset to an empty string whenever it
  8337. // becomes browsing-context connected.
  8338. // See https://github.com/whatwg/html/issues/2369
  8339. // See https://html.spec.whatwg.org/#nonce-attributes
  8340. // The `node.getAttribute` check was added for the sake of
  8341. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8342. // via an object.
  8343. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8344. if ( val ) {
  8345. script.setAttribute( i, val );
  8346. }
  8347. }
  8348. }
  8349. doc.head.appendChild( script ).parentNode.removeChild( script );
  8350. }
  8351. function toType( obj ) {
  8352. if ( obj == null ) {
  8353. return obj + "";
  8354. }
  8355. // Support: Android <=2.3 only (functionish RegExp)
  8356. return typeof obj === "object" || typeof obj === "function" ?
  8357. class2type[ toString.call( obj ) ] || "object" :
  8358. typeof obj;
  8359. }
  8360. /* global Symbol */
  8361. // Defining this global in .eslintrc.json would create a danger of using the global
  8362. // unguarded in another place, it seems safer to define global only for this module
  8363. var
  8364. version = "3.4.1",
  8365. // Define a local copy of jQuery
  8366. jQuery = function( selector, context ) {
  8367. // The jQuery object is actually just the init constructor 'enhanced'
  8368. // Need init if jQuery is called (just allow error to be thrown if not included)
  8369. return new jQuery.fn.init( selector, context );
  8370. },
  8371. // Support: Android <=4.0 only
  8372. // Make sure we trim BOM and NBSP
  8373. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8374. jQuery.fn = jQuery.prototype = {
  8375. // The current version of jQuery being used
  8376. jquery: version,
  8377. constructor: jQuery,
  8378. // The default length of a jQuery object is 0
  8379. length: 0,
  8380. toArray: function() {
  8381. return slice.call( this );
  8382. },
  8383. // Get the Nth element in the matched element set OR
  8384. // Get the whole matched element set as a clean array
  8385. get: function( num ) {
  8386. // Return all the elements in a clean array
  8387. if ( num == null ) {
  8388. return slice.call( this );
  8389. }
  8390. // Return just the one element from the set
  8391. return num < 0 ? this[ num + this.length ] : this[ num ];
  8392. },
  8393. // Take an array of elements and push it onto the stack
  8394. // (returning the new matched element set)
  8395. pushStack: function( elems ) {
  8396. // Build a new jQuery matched element set
  8397. var ret = jQuery.merge( this.constructor(), elems );
  8398. // Add the old object onto the stack (as a reference)
  8399. ret.prevObject = this;
  8400. // Return the newly-formed element set
  8401. return ret;
  8402. },
  8403. // Execute a callback for every element in the matched set.
  8404. each: function( callback ) {
  8405. return jQuery.each( this, callback );
  8406. },
  8407. map: function( callback ) {
  8408. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8409. return callback.call( elem, i, elem );
  8410. } ) );
  8411. },
  8412. slice: function() {
  8413. return this.pushStack( slice.apply( this, arguments ) );
  8414. },
  8415. first: function() {
  8416. return this.eq( 0 );
  8417. },
  8418. last: function() {
  8419. return this.eq( -1 );
  8420. },
  8421. eq: function( i ) {
  8422. var len = this.length,
  8423. j = +i + ( i < 0 ? len : 0 );
  8424. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8425. },
  8426. end: function() {
  8427. return this.prevObject || this.constructor();
  8428. },
  8429. // For internal use only.
  8430. // Behaves like an Array's method, not like a jQuery method.
  8431. push: push,
  8432. sort: arr.sort,
  8433. splice: arr.splice
  8434. };
  8435. jQuery.extend = jQuery.fn.extend = function() {
  8436. var options, name, src, copy, copyIsArray, clone,
  8437. target = arguments[ 0 ] || {},
  8438. i = 1,
  8439. length = arguments.length,
  8440. deep = false;
  8441. // Handle a deep copy situation
  8442. if ( typeof target === "boolean" ) {
  8443. deep = target;
  8444. // Skip the boolean and the target
  8445. target = arguments[ i ] || {};
  8446. i++;
  8447. }
  8448. // Handle case when target is a string or something (possible in deep copy)
  8449. if ( typeof target !== "object" && !isFunction( target ) ) {
  8450. target = {};
  8451. }
  8452. // Extend jQuery itself if only one argument is passed
  8453. if ( i === length ) {
  8454. target = this;
  8455. i--;
  8456. }
  8457. for ( ; i < length; i++ ) {
  8458. // Only deal with non-null/undefined values
  8459. if ( ( options = arguments[ i ] ) != null ) {
  8460. // Extend the base object
  8461. for ( name in options ) {
  8462. copy = options[ name ];
  8463. // Prevent Object.prototype pollution
  8464. // Prevent never-ending loop
  8465. if ( name === "__proto__" || target === copy ) {
  8466. continue;
  8467. }
  8468. // Recurse if we're merging plain objects or arrays
  8469. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8470. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8471. src = target[ name ];
  8472. // Ensure proper type for the source value
  8473. if ( copyIsArray && !Array.isArray( src ) ) {
  8474. clone = [];
  8475. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8476. clone = {};
  8477. } else {
  8478. clone = src;
  8479. }
  8480. copyIsArray = false;
  8481. // Never move original objects, clone them
  8482. target[ name ] = jQuery.extend( deep, clone, copy );
  8483. // Don't bring in undefined values
  8484. } else if ( copy !== undefined ) {
  8485. target[ name ] = copy;
  8486. }
  8487. }
  8488. }
  8489. }
  8490. // Return the modified object
  8491. return target;
  8492. };
  8493. jQuery.extend( {
  8494. // Unique for each copy of jQuery on the page
  8495. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8496. // Assume jQuery is ready without the ready module
  8497. isReady: true,
  8498. error: function( msg ) {
  8499. throw new Error( msg );
  8500. },
  8501. noop: function() {},
  8502. isPlainObject: function( obj ) {
  8503. var proto, Ctor;
  8504. // Detect obvious negatives
  8505. // Use toString instead of jQuery.type to catch host objects
  8506. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8507. return false;
  8508. }
  8509. proto = getProto( obj );
  8510. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8511. if ( !proto ) {
  8512. return true;
  8513. }
  8514. // Objects with prototype are plain iff they were constructed by a global Object function
  8515. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8516. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8517. },
  8518. isEmptyObject: function( obj ) {
  8519. var name;
  8520. for ( name in obj ) {
  8521. return false;
  8522. }
  8523. return true;
  8524. },
  8525. // Evaluates a script in a global context
  8526. globalEval: function( code, options ) {
  8527. DOMEval( code, { nonce: options && options.nonce } );
  8528. },
  8529. each: function( obj, callback ) {
  8530. var length, i = 0;
  8531. if ( isArrayLike( obj ) ) {
  8532. length = obj.length;
  8533. for ( ; i < length; i++ ) {
  8534. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8535. break;
  8536. }
  8537. }
  8538. } else {
  8539. for ( i in obj ) {
  8540. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8541. break;
  8542. }
  8543. }
  8544. }
  8545. return obj;
  8546. },
  8547. // Support: Android <=4.0 only
  8548. trim: function( text ) {
  8549. return text == null ?
  8550. "" :
  8551. ( text + "" ).replace( rtrim, "" );
  8552. },
  8553. // results is for internal usage only
  8554. makeArray: function( arr, results ) {
  8555. var ret = results || [];
  8556. if ( arr != null ) {
  8557. if ( isArrayLike( Object( arr ) ) ) {
  8558. jQuery.merge( ret,
  8559. typeof arr === "string" ?
  8560. [ arr ] : arr
  8561. );
  8562. } else {
  8563. push.call( ret, arr );
  8564. }
  8565. }
  8566. return ret;
  8567. },
  8568. inArray: function( elem, arr, i ) {
  8569. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8570. },
  8571. // Support: Android <=4.0 only, PhantomJS 1 only
  8572. // push.apply(_, arraylike) throws on ancient WebKit
  8573. merge: function( first, second ) {
  8574. var len = +second.length,
  8575. j = 0,
  8576. i = first.length;
  8577. for ( ; j < len; j++ ) {
  8578. first[ i++ ] = second[ j ];
  8579. }
  8580. first.length = i;
  8581. return first;
  8582. },
  8583. grep: function( elems, callback, invert ) {
  8584. var callbackInverse,
  8585. matches = [],
  8586. i = 0,
  8587. length = elems.length,
  8588. callbackExpect = !invert;
  8589. // Go through the array, only saving the items
  8590. // that pass the validator function
  8591. for ( ; i < length; i++ ) {
  8592. callbackInverse = !callback( elems[ i ], i );
  8593. if ( callbackInverse !== callbackExpect ) {
  8594. matches.push( elems[ i ] );
  8595. }
  8596. }
  8597. return matches;
  8598. },
  8599. // arg is for internal usage only
  8600. map: function( elems, callback, arg ) {
  8601. var length, value,
  8602. i = 0,
  8603. ret = [];
  8604. // Go through the array, translating each of the items to their new values
  8605. if ( isArrayLike( elems ) ) {
  8606. length = elems.length;
  8607. for ( ; i < length; i++ ) {
  8608. value = callback( elems[ i ], i, arg );
  8609. if ( value != null ) {
  8610. ret.push( value );
  8611. }
  8612. }
  8613. // Go through every key on the object,
  8614. } else {
  8615. for ( i in elems ) {
  8616. value = callback( elems[ i ], i, arg );
  8617. if ( value != null ) {
  8618. ret.push( value );
  8619. }
  8620. }
  8621. }
  8622. // Flatten any nested arrays
  8623. return concat.apply( [], ret );
  8624. },
  8625. // A global GUID counter for objects
  8626. guid: 1,
  8627. // jQuery.support is not used in Core but other projects attach their
  8628. // properties to it so it needs to exist.
  8629. support: support
  8630. } );
  8631. if ( typeof Symbol === "function" ) {
  8632. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8633. }
  8634. // Populate the class2type map
  8635. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8636. function( i, name ) {
  8637. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8638. } );
  8639. function isArrayLike( obj ) {
  8640. // Support: real iOS 8.2 only (not reproducible in simulator)
  8641. // `in` check used to prevent JIT error (gh-2145)
  8642. // hasOwn isn't used here due to false negatives
  8643. // regarding Nodelist length in IE
  8644. var length = !!obj && "length" in obj && obj.length,
  8645. type = toType( obj );
  8646. if ( isFunction( obj ) || isWindow( obj ) ) {
  8647. return false;
  8648. }
  8649. return type === "array" || length === 0 ||
  8650. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8651. }
  8652. var Sizzle =
  8653. /*!
  8654. * Sizzle CSS Selector Engine v2.3.4
  8655. * https://sizzlejs.com/
  8656. *
  8657. * Copyright JS Foundation and other contributors
  8658. * Released under the MIT license
  8659. * https://js.foundation/
  8660. *
  8661. * Date: 2019-04-08
  8662. */
  8663. (function( window ) {
  8664. var i,
  8665. support,
  8666. Expr,
  8667. getText,
  8668. isXML,
  8669. tokenize,
  8670. compile,
  8671. select,
  8672. outermostContext,
  8673. sortInput,
  8674. hasDuplicate,
  8675. // Local document vars
  8676. setDocument,
  8677. document,
  8678. docElem,
  8679. documentIsHTML,
  8680. rbuggyQSA,
  8681. rbuggyMatches,
  8682. matches,
  8683. contains,
  8684. // Instance-specific data
  8685. expando = "sizzle" + 1 * new Date(),
  8686. preferredDoc = window.document,
  8687. dirruns = 0,
  8688. done = 0,
  8689. classCache = createCache(),
  8690. tokenCache = createCache(),
  8691. compilerCache = createCache(),
  8692. nonnativeSelectorCache = createCache(),
  8693. sortOrder = function( a, b ) {
  8694. if ( a === b ) {
  8695. hasDuplicate = true;
  8696. }
  8697. return 0;
  8698. },
  8699. // Instance methods
  8700. hasOwn = ({}).hasOwnProperty,
  8701. arr = [],
  8702. pop = arr.pop,
  8703. push_native = arr.push,
  8704. push = arr.push,
  8705. slice = arr.slice,
  8706. // Use a stripped-down indexOf as it's faster than native
  8707. // https://jsperf.com/thor-indexof-vs-for/5
  8708. indexOf = function( list, elem ) {
  8709. var i = 0,
  8710. len = list.length;
  8711. for ( ; i < len; i++ ) {
  8712. if ( list[i] === elem ) {
  8713. return i;
  8714. }
  8715. }
  8716. return -1;
  8717. },
  8718. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  8719. // Regular expressions
  8720. // http://www.w3.org/TR/css3-selectors/#whitespace
  8721. whitespace = "[\\x20\\t\\r\\n\\f]",
  8722. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  8723. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  8724. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  8725. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  8726. // Operator (capture 2)
  8727. "*([*^$|!~]?=)" + whitespace +
  8728. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  8729. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  8730. "*\\]",
  8731. pseudos = ":(" + identifier + ")(?:\\((" +
  8732. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  8733. // 1. quoted (capture 3; capture 4 or capture 5)
  8734. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  8735. // 2. simple (capture 6)
  8736. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  8737. // 3. anything else (capture 2)
  8738. ".*" +
  8739. ")\\)|)",
  8740. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  8741. rwhitespace = new RegExp( whitespace + "+", "g" ),
  8742. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  8743. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  8744. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  8745. rdescend = new RegExp( whitespace + "|>" ),
  8746. rpseudo = new RegExp( pseudos ),
  8747. ridentifier = new RegExp( "^" + identifier + "$" ),
  8748. matchExpr = {
  8749. "ID": new RegExp( "^#(" + identifier + ")" ),
  8750. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  8751. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  8752. "ATTR": new RegExp( "^" + attributes ),
  8753. "PSEUDO": new RegExp( "^" + pseudos ),
  8754. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  8755. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  8756. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  8757. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  8758. // For use in libraries implementing .is()
  8759. // We use this for POS matching in `select`
  8760. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  8761. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  8762. },
  8763. rhtml = /HTML$/i,
  8764. rinputs = /^(?:input|select|textarea|button)$/i,
  8765. rheader = /^h\d$/i,
  8766. rnative = /^[^{]+\{\s*\[native \w/,
  8767. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  8768. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  8769. rsibling = /[+~]/,
  8770. // CSS escapes
  8771. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  8772. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  8773. funescape = function( _, escaped, escapedWhitespace ) {
  8774. var high = "0x" + escaped - 0x10000;
  8775. // NaN means non-codepoint
  8776. // Support: Firefox<24
  8777. // Workaround erroneous numeric interpretation of +"0x"
  8778. return high !== high || escapedWhitespace ?
  8779. escaped :
  8780. high < 0 ?
  8781. // BMP codepoint
  8782. String.fromCharCode( high + 0x10000 ) :
  8783. // Supplemental Plane codepoint (surrogate pair)
  8784. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  8785. },
  8786. // CSS string/identifier serialization
  8787. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  8788. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  8789. fcssescape = function( ch, asCodePoint ) {
  8790. if ( asCodePoint ) {
  8791. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  8792. if ( ch === "\0" ) {
  8793. return "\uFFFD";
  8794. }
  8795. // Control characters and (dependent upon position) numbers get escaped as code points
  8796. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  8797. }
  8798. // Other potentially-special ASCII characters get backslash-escaped
  8799. return "\\" + ch;
  8800. },
  8801. // Used for iframes
  8802. // See setDocument()
  8803. // Removing the function wrapper causes a "Permission Denied"
  8804. // error in IE
  8805. unloadHandler = function() {
  8806. setDocument();
  8807. },
  8808. inDisabledFieldset = addCombinator(
  8809. function( elem ) {
  8810. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  8811. },
  8812. { dir: "parentNode", next: "legend" }
  8813. );
  8814. // Optimize for push.apply( _, NodeList )
  8815. try {
  8816. push.apply(
  8817. (arr = slice.call( preferredDoc.childNodes )),
  8818. preferredDoc.childNodes
  8819. );
  8820. // Support: Android<4.0
  8821. // Detect silently failing push.apply
  8822. arr[ preferredDoc.childNodes.length ].nodeType;
  8823. } catch ( e ) {
  8824. push = { apply: arr.length ?
  8825. // Leverage slice if possible
  8826. function( target, els ) {
  8827. push_native.apply( target, slice.call(els) );
  8828. } :
  8829. // Support: IE<9
  8830. // Otherwise append directly
  8831. function( target, els ) {
  8832. var j = target.length,
  8833. i = 0;
  8834. // Can't trust NodeList.length
  8835. while ( (target[j++] = els[i++]) ) {}
  8836. target.length = j - 1;
  8837. }
  8838. };
  8839. }
  8840. function Sizzle( selector, context, results, seed ) {
  8841. var m, i, elem, nid, match, groups, newSelector,
  8842. newContext = context && context.ownerDocument,
  8843. // nodeType defaults to 9, since context defaults to document
  8844. nodeType = context ? context.nodeType : 9;
  8845. results = results || [];
  8846. // Return early from calls with invalid selector or context
  8847. if ( typeof selector !== "string" || !selector ||
  8848. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  8849. return results;
  8850. }
  8851. // Try to shortcut find operations (as opposed to filters) in HTML documents
  8852. if ( !seed ) {
  8853. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  8854. setDocument( context );
  8855. }
  8856. context = context || document;
  8857. if ( documentIsHTML ) {
  8858. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  8859. // (excepting DocumentFragment context, where the methods don't exist)
  8860. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  8861. // ID selector
  8862. if ( (m = match[1]) ) {
  8863. // Document context
  8864. if ( nodeType === 9 ) {
  8865. if ( (elem = context.getElementById( m )) ) {
  8866. // Support: IE, Opera, Webkit
  8867. // TODO: identify versions
  8868. // getElementById can match elements by name instead of ID
  8869. if ( elem.id === m ) {
  8870. results.push( elem );
  8871. return results;
  8872. }
  8873. } else {
  8874. return results;
  8875. }
  8876. // Element context
  8877. } else {
  8878. // Support: IE, Opera, Webkit
  8879. // TODO: identify versions
  8880. // getElementById can match elements by name instead of ID
  8881. if ( newContext && (elem = newContext.getElementById( m )) &&
  8882. contains( context, elem ) &&
  8883. elem.id === m ) {
  8884. results.push( elem );
  8885. return results;
  8886. }
  8887. }
  8888. // Type selector
  8889. } else if ( match[2] ) {
  8890. push.apply( results, context.getElementsByTagName( selector ) );
  8891. return results;
  8892. // Class selector
  8893. } else if ( (m = match[3]) && support.getElementsByClassName &&
  8894. context.getElementsByClassName ) {
  8895. push.apply( results, context.getElementsByClassName( m ) );
  8896. return results;
  8897. }
  8898. }
  8899. // Take advantage of querySelectorAll
  8900. if ( support.qsa &&
  8901. !nonnativeSelectorCache[ selector + " " ] &&
  8902. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  8903. // Support: IE 8 only
  8904. // Exclude object elements
  8905. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  8906. newSelector = selector;
  8907. newContext = context;
  8908. // qSA considers elements outside a scoping root when evaluating child or
  8909. // descendant combinators, which is not what we want.
  8910. // In such cases, we work around the behavior by prefixing every selector in the
  8911. // list with an ID selector referencing the scope context.
  8912. // Thanks to Andrew Dupont for this technique.
  8913. if ( nodeType === 1 && rdescend.test( selector ) ) {
  8914. // Capture the context ID, setting it first if necessary
  8915. if ( (nid = context.getAttribute( "id" )) ) {
  8916. nid = nid.replace( rcssescape, fcssescape );
  8917. } else {
  8918. context.setAttribute( "id", (nid = expando) );
  8919. }
  8920. // Prefix every selector in the list
  8921. groups = tokenize( selector );
  8922. i = groups.length;
  8923. while ( i-- ) {
  8924. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  8925. }
  8926. newSelector = groups.join( "," );
  8927. // Expand context for sibling selectors
  8928. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  8929. context;
  8930. }
  8931. try {
  8932. push.apply( results,
  8933. newContext.querySelectorAll( newSelector )
  8934. );
  8935. return results;
  8936. } catch ( qsaError ) {
  8937. nonnativeSelectorCache( selector, true );
  8938. } finally {
  8939. if ( nid === expando ) {
  8940. context.removeAttribute( "id" );
  8941. }
  8942. }
  8943. }
  8944. }
  8945. }
  8946. // All others
  8947. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  8948. }
  8949. /**
  8950. * Create key-value caches of limited size
  8951. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  8952. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  8953. * deleting the oldest entry
  8954. */
  8955. function createCache() {
  8956. var keys = [];
  8957. function cache( key, value ) {
  8958. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  8959. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  8960. // Only keep the most recent entries
  8961. delete cache[ keys.shift() ];
  8962. }
  8963. return (cache[ key + " " ] = value);
  8964. }
  8965. return cache;
  8966. }
  8967. /**
  8968. * Mark a function for special use by Sizzle
  8969. * @param {Function} fn The function to mark
  8970. */
  8971. function markFunction( fn ) {
  8972. fn[ expando ] = true;
  8973. return fn;
  8974. }
  8975. /**
  8976. * Support testing using an element
  8977. * @param {Function} fn Passed the created element and returns a boolean result
  8978. */
  8979. function assert( fn ) {
  8980. var el = document.createElement("fieldset");
  8981. try {
  8982. return !!fn( el );
  8983. } catch (e) {
  8984. return false;
  8985. } finally {
  8986. // Remove from its parent by default
  8987. if ( el.parentNode ) {
  8988. el.parentNode.removeChild( el );
  8989. }
  8990. // release memory in IE
  8991. el = null;
  8992. }
  8993. }
  8994. /**
  8995. * Adds the same handler for all of the specified attrs
  8996. * @param {String} attrs Pipe-separated list of attributes
  8997. * @param {Function} handler The method that will be applied
  8998. */
  8999. function addHandle( attrs, handler ) {
  9000. var arr = attrs.split("|"),
  9001. i = arr.length;
  9002. while ( i-- ) {
  9003. Expr.attrHandle[ arr[i] ] = handler;
  9004. }
  9005. }
  9006. /**
  9007. * Checks document order of two siblings
  9008. * @param {Element} a
  9009. * @param {Element} b
  9010. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9011. */
  9012. function siblingCheck( a, b ) {
  9013. var cur = b && a,
  9014. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9015. a.sourceIndex - b.sourceIndex;
  9016. // Use IE sourceIndex if available on both nodes
  9017. if ( diff ) {
  9018. return diff;
  9019. }
  9020. // Check if b follows a
  9021. if ( cur ) {
  9022. while ( (cur = cur.nextSibling) ) {
  9023. if ( cur === b ) {
  9024. return -1;
  9025. }
  9026. }
  9027. }
  9028. return a ? 1 : -1;
  9029. }
  9030. /**
  9031. * Returns a function to use in pseudos for input types
  9032. * @param {String} type
  9033. */
  9034. function createInputPseudo( type ) {
  9035. return function( elem ) {
  9036. var name = elem.nodeName.toLowerCase();
  9037. return name === "input" && elem.type === type;
  9038. };
  9039. }
  9040. /**
  9041. * Returns a function to use in pseudos for buttons
  9042. * @param {String} type
  9043. */
  9044. function createButtonPseudo( type ) {
  9045. return function( elem ) {
  9046. var name = elem.nodeName.toLowerCase();
  9047. return (name === "input" || name === "button") && elem.type === type;
  9048. };
  9049. }
  9050. /**
  9051. * Returns a function to use in pseudos for :enabled/:disabled
  9052. * @param {Boolean} disabled true for :disabled; false for :enabled
  9053. */
  9054. function createDisabledPseudo( disabled ) {
  9055. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9056. return function( elem ) {
  9057. // Only certain elements can match :enabled or :disabled
  9058. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9059. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9060. if ( "form" in elem ) {
  9061. // Check for inherited disabledness on relevant non-disabled elements:
  9062. // * listed form-associated elements in a disabled fieldset
  9063. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9064. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9065. // * option elements in a disabled optgroup
  9066. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9067. // All such elements have a "form" property.
  9068. if ( elem.parentNode && elem.disabled === false ) {
  9069. // Option elements defer to a parent optgroup if present
  9070. if ( "label" in elem ) {
  9071. if ( "label" in elem.parentNode ) {
  9072. return elem.parentNode.disabled === disabled;
  9073. } else {
  9074. return elem.disabled === disabled;
  9075. }
  9076. }
  9077. // Support: IE 6 - 11
  9078. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9079. return elem.isDisabled === disabled ||
  9080. // Where there is no isDisabled, check manually
  9081. /* jshint -W018 */
  9082. elem.isDisabled !== !disabled &&
  9083. inDisabledFieldset( elem ) === disabled;
  9084. }
  9085. return elem.disabled === disabled;
  9086. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9087. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9088. // even exist on them, let alone have a boolean value.
  9089. } else if ( "label" in elem ) {
  9090. return elem.disabled === disabled;
  9091. }
  9092. // Remaining elements are neither :enabled nor :disabled
  9093. return false;
  9094. };
  9095. }
  9096. /**
  9097. * Returns a function to use in pseudos for positionals
  9098. * @param {Function} fn
  9099. */
  9100. function createPositionalPseudo( fn ) {
  9101. return markFunction(function( argument ) {
  9102. argument = +argument;
  9103. return markFunction(function( seed, matches ) {
  9104. var j,
  9105. matchIndexes = fn( [], seed.length, argument ),
  9106. i = matchIndexes.length;
  9107. // Match elements found at the specified indexes
  9108. while ( i-- ) {
  9109. if ( seed[ (j = matchIndexes[i]) ] ) {
  9110. seed[j] = !(matches[j] = seed[j]);
  9111. }
  9112. }
  9113. });
  9114. });
  9115. }
  9116. /**
  9117. * Checks a node for validity as a Sizzle context
  9118. * @param {Element|Object=} context
  9119. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9120. */
  9121. function testContext( context ) {
  9122. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9123. }
  9124. // Expose support vars for convenience
  9125. support = Sizzle.support = {};
  9126. /**
  9127. * Detects XML nodes
  9128. * @param {Element|Object} elem An element or a document
  9129. * @returns {Boolean} True iff elem is a non-HTML XML node
  9130. */
  9131. isXML = Sizzle.isXML = function( elem ) {
  9132. var namespace = elem.namespaceURI,
  9133. docElem = (elem.ownerDocument || elem).documentElement;
  9134. // Support: IE <=8
  9135. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9136. // https://bugs.jquery.com/ticket/4833
  9137. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9138. };
  9139. /**
  9140. * Sets document-related variables once based on the current document
  9141. * @param {Element|Object} [doc] An element or document object to use to set the document
  9142. * @returns {Object} Returns the current document
  9143. */
  9144. setDocument = Sizzle.setDocument = function( node ) {
  9145. var hasCompare, subWindow,
  9146. doc = node ? node.ownerDocument || node : preferredDoc;
  9147. // Return early if doc is invalid or already selected
  9148. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9149. return document;
  9150. }
  9151. // Update global variables
  9152. document = doc;
  9153. docElem = document.documentElement;
  9154. documentIsHTML = !isXML( document );
  9155. // Support: IE 9-11, Edge
  9156. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9157. if ( preferredDoc !== document &&
  9158. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9159. // Support: IE 11, Edge
  9160. if ( subWindow.addEventListener ) {
  9161. subWindow.addEventListener( "unload", unloadHandler, false );
  9162. // Support: IE 9 - 10 only
  9163. } else if ( subWindow.attachEvent ) {
  9164. subWindow.attachEvent( "onunload", unloadHandler );
  9165. }
  9166. }
  9167. /* Attributes
  9168. ---------------------------------------------------------------------- */
  9169. // Support: IE<8
  9170. // Verify that getAttribute really returns attributes and not properties
  9171. // (excepting IE8 booleans)
  9172. support.attributes = assert(function( el ) {
  9173. el.className = "i";
  9174. return !el.getAttribute("className");
  9175. });
  9176. /* getElement(s)By*
  9177. ---------------------------------------------------------------------- */
  9178. // Check if getElementsByTagName("*") returns only elements
  9179. support.getElementsByTagName = assert(function( el ) {
  9180. el.appendChild( document.createComment("") );
  9181. return !el.getElementsByTagName("*").length;
  9182. });
  9183. // Support: IE<9
  9184. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9185. // Support: IE<10
  9186. // Check if getElementById returns elements by name
  9187. // The broken getElementById methods don't pick up programmatically-set names,
  9188. // so use a roundabout getElementsByName test
  9189. support.getById = assert(function( el ) {
  9190. docElem.appendChild( el ).id = expando;
  9191. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9192. });
  9193. // ID filter and find
  9194. if ( support.getById ) {
  9195. Expr.filter["ID"] = function( id ) {
  9196. var attrId = id.replace( runescape, funescape );
  9197. return function( elem ) {
  9198. return elem.getAttribute("id") === attrId;
  9199. };
  9200. };
  9201. Expr.find["ID"] = function( id, context ) {
  9202. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9203. var elem = context.getElementById( id );
  9204. return elem ? [ elem ] : [];
  9205. }
  9206. };
  9207. } else {
  9208. Expr.filter["ID"] = function( id ) {
  9209. var attrId = id.replace( runescape, funescape );
  9210. return function( elem ) {
  9211. var node = typeof elem.getAttributeNode !== "undefined" &&
  9212. elem.getAttributeNode("id");
  9213. return node && node.value === attrId;
  9214. };
  9215. };
  9216. // Support: IE 6 - 7 only
  9217. // getElementById is not reliable as a find shortcut
  9218. Expr.find["ID"] = function( id, context ) {
  9219. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9220. var node, i, elems,
  9221. elem = context.getElementById( id );
  9222. if ( elem ) {
  9223. // Verify the id attribute
  9224. node = elem.getAttributeNode("id");
  9225. if ( node && node.value === id ) {
  9226. return [ elem ];
  9227. }
  9228. // Fall back on getElementsByName
  9229. elems = context.getElementsByName( id );
  9230. i = 0;
  9231. while ( (elem = elems[i++]) ) {
  9232. node = elem.getAttributeNode("id");
  9233. if ( node && node.value === id ) {
  9234. return [ elem ];
  9235. }
  9236. }
  9237. }
  9238. return [];
  9239. }
  9240. };
  9241. }
  9242. // Tag
  9243. Expr.find["TAG"] = support.getElementsByTagName ?
  9244. function( tag, context ) {
  9245. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9246. return context.getElementsByTagName( tag );
  9247. // DocumentFragment nodes don't have gEBTN
  9248. } else if ( support.qsa ) {
  9249. return context.querySelectorAll( tag );
  9250. }
  9251. } :
  9252. function( tag, context ) {
  9253. var elem,
  9254. tmp = [],
  9255. i = 0,
  9256. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9257. results = context.getElementsByTagName( tag );
  9258. // Filter out possible comments
  9259. if ( tag === "*" ) {
  9260. while ( (elem = results[i++]) ) {
  9261. if ( elem.nodeType === 1 ) {
  9262. tmp.push( elem );
  9263. }
  9264. }
  9265. return tmp;
  9266. }
  9267. return results;
  9268. };
  9269. // Class
  9270. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9271. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9272. return context.getElementsByClassName( className );
  9273. }
  9274. };
  9275. /* QSA/matchesSelector
  9276. ---------------------------------------------------------------------- */
  9277. // QSA and matchesSelector support
  9278. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9279. rbuggyMatches = [];
  9280. // qSa(:focus) reports false when true (Chrome 21)
  9281. // We allow this because of a bug in IE8/9 that throws an error
  9282. // whenever `document.activeElement` is accessed on an iframe
  9283. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9284. // See https://bugs.jquery.com/ticket/13378
  9285. rbuggyQSA = [];
  9286. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9287. // Build QSA regex
  9288. // Regex strategy adopted from Diego Perini
  9289. assert(function( el ) {
  9290. // Select is set to empty string on purpose
  9291. // This is to test IE's treatment of not explicitly
  9292. // setting a boolean content attribute,
  9293. // since its presence should be enough
  9294. // https://bugs.jquery.com/ticket/12359
  9295. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9296. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9297. "<option selected=''></option></select>";
  9298. // Support: IE8, Opera 11-12.16
  9299. // Nothing should be selected when empty strings follow ^= or $= or *=
  9300. // The test attribute must be unknown in Opera but "safe" for WinRT
  9301. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9302. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9303. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9304. }
  9305. // Support: IE8
  9306. // Boolean attributes and "value" are not treated correctly
  9307. if ( !el.querySelectorAll("[selected]").length ) {
  9308. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9309. }
  9310. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9311. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9312. rbuggyQSA.push("~=");
  9313. }
  9314. // Webkit/Opera - :checked should return selected option elements
  9315. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9316. // IE8 throws error here and will not see later tests
  9317. if ( !el.querySelectorAll(":checked").length ) {
  9318. rbuggyQSA.push(":checked");
  9319. }
  9320. // Support: Safari 8+, iOS 8+
  9321. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9322. // In-page `selector#id sibling-combinator selector` fails
  9323. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9324. rbuggyQSA.push(".#.+[+~]");
  9325. }
  9326. });
  9327. assert(function( el ) {
  9328. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9329. "<select disabled='disabled'><option/></select>";
  9330. // Support: Windows 8 Native Apps
  9331. // The type and name attributes are restricted during .innerHTML assignment
  9332. var input = document.createElement("input");
  9333. input.setAttribute( "type", "hidden" );
  9334. el.appendChild( input ).setAttribute( "name", "D" );
  9335. // Support: IE8
  9336. // Enforce case-sensitivity of name attribute
  9337. if ( el.querySelectorAll("[name=d]").length ) {
  9338. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9339. }
  9340. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9341. // IE8 throws error here and will not see later tests
  9342. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9343. rbuggyQSA.push( ":enabled", ":disabled" );
  9344. }
  9345. // Support: IE9-11+
  9346. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9347. docElem.appendChild( el ).disabled = true;
  9348. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9349. rbuggyQSA.push( ":enabled", ":disabled" );
  9350. }
  9351. // Opera 10-11 does not throw on post-comma invalid pseudos
  9352. el.querySelectorAll("*,:x");
  9353. rbuggyQSA.push(",.*:");
  9354. });
  9355. }
  9356. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9357. docElem.webkitMatchesSelector ||
  9358. docElem.mozMatchesSelector ||
  9359. docElem.oMatchesSelector ||
  9360. docElem.msMatchesSelector) )) ) {
  9361. assert(function( el ) {
  9362. // Check to see if it's possible to do matchesSelector
  9363. // on a disconnected node (IE 9)
  9364. support.disconnectedMatch = matches.call( el, "*" );
  9365. // This should fail with an exception
  9366. // Gecko does not error, returns false instead
  9367. matches.call( el, "[s!='']:x" );
  9368. rbuggyMatches.push( "!=", pseudos );
  9369. });
  9370. }
  9371. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9372. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9373. /* Contains
  9374. ---------------------------------------------------------------------- */
  9375. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9376. // Element contains another
  9377. // Purposefully self-exclusive
  9378. // As in, an element does not contain itself
  9379. contains = hasCompare || rnative.test( docElem.contains ) ?
  9380. function( a, b ) {
  9381. var adown = a.nodeType === 9 ? a.documentElement : a,
  9382. bup = b && b.parentNode;
  9383. return a === bup || !!( bup && bup.nodeType === 1 && (
  9384. adown.contains ?
  9385. adown.contains( bup ) :
  9386. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9387. ));
  9388. } :
  9389. function( a, b ) {
  9390. if ( b ) {
  9391. while ( (b = b.parentNode) ) {
  9392. if ( b === a ) {
  9393. return true;
  9394. }
  9395. }
  9396. }
  9397. return false;
  9398. };
  9399. /* Sorting
  9400. ---------------------------------------------------------------------- */
  9401. // Document order sorting
  9402. sortOrder = hasCompare ?
  9403. function( a, b ) {
  9404. // Flag for duplicate removal
  9405. if ( a === b ) {
  9406. hasDuplicate = true;
  9407. return 0;
  9408. }
  9409. // Sort on method existence if only one input has compareDocumentPosition
  9410. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9411. if ( compare ) {
  9412. return compare;
  9413. }
  9414. // Calculate position if both inputs belong to the same document
  9415. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9416. a.compareDocumentPosition( b ) :
  9417. // Otherwise we know they are disconnected
  9418. 1;
  9419. // Disconnected nodes
  9420. if ( compare & 1 ||
  9421. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9422. // Choose the first element that is related to our preferred document
  9423. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9424. return -1;
  9425. }
  9426. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9427. return 1;
  9428. }
  9429. // Maintain original order
  9430. return sortInput ?
  9431. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9432. 0;
  9433. }
  9434. return compare & 4 ? -1 : 1;
  9435. } :
  9436. function( a, b ) {
  9437. // Exit early if the nodes are identical
  9438. if ( a === b ) {
  9439. hasDuplicate = true;
  9440. return 0;
  9441. }
  9442. var cur,
  9443. i = 0,
  9444. aup = a.parentNode,
  9445. bup = b.parentNode,
  9446. ap = [ a ],
  9447. bp = [ b ];
  9448. // Parentless nodes are either documents or disconnected
  9449. if ( !aup || !bup ) {
  9450. return a === document ? -1 :
  9451. b === document ? 1 :
  9452. aup ? -1 :
  9453. bup ? 1 :
  9454. sortInput ?
  9455. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9456. 0;
  9457. // If the nodes are siblings, we can do a quick check
  9458. } else if ( aup === bup ) {
  9459. return siblingCheck( a, b );
  9460. }
  9461. // Otherwise we need full lists of their ancestors for comparison
  9462. cur = a;
  9463. while ( (cur = cur.parentNode) ) {
  9464. ap.unshift( cur );
  9465. }
  9466. cur = b;
  9467. while ( (cur = cur.parentNode) ) {
  9468. bp.unshift( cur );
  9469. }
  9470. // Walk down the tree looking for a discrepancy
  9471. while ( ap[i] === bp[i] ) {
  9472. i++;
  9473. }
  9474. return i ?
  9475. // Do a sibling check if the nodes have a common ancestor
  9476. siblingCheck( ap[i], bp[i] ) :
  9477. // Otherwise nodes in our document sort first
  9478. ap[i] === preferredDoc ? -1 :
  9479. bp[i] === preferredDoc ? 1 :
  9480. 0;
  9481. };
  9482. return document;
  9483. };
  9484. Sizzle.matches = function( expr, elements ) {
  9485. return Sizzle( expr, null, null, elements );
  9486. };
  9487. Sizzle.matchesSelector = function( elem, expr ) {
  9488. // Set document vars if needed
  9489. if ( ( elem.ownerDocument || elem ) !== document ) {
  9490. setDocument( elem );
  9491. }
  9492. if ( support.matchesSelector && documentIsHTML &&
  9493. !nonnativeSelectorCache[ expr + " " ] &&
  9494. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9495. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9496. try {
  9497. var ret = matches.call( elem, expr );
  9498. // IE 9's matchesSelector returns false on disconnected nodes
  9499. if ( ret || support.disconnectedMatch ||
  9500. // As well, disconnected nodes are said to be in a document
  9501. // fragment in IE 9
  9502. elem.document && elem.document.nodeType !== 11 ) {
  9503. return ret;
  9504. }
  9505. } catch (e) {
  9506. nonnativeSelectorCache( expr, true );
  9507. }
  9508. }
  9509. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9510. };
  9511. Sizzle.contains = function( context, elem ) {
  9512. // Set document vars if needed
  9513. if ( ( context.ownerDocument || context ) !== document ) {
  9514. setDocument( context );
  9515. }
  9516. return contains( context, elem );
  9517. };
  9518. Sizzle.attr = function( elem, name ) {
  9519. // Set document vars if needed
  9520. if ( ( elem.ownerDocument || elem ) !== document ) {
  9521. setDocument( elem );
  9522. }
  9523. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9524. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9525. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9526. fn( elem, name, !documentIsHTML ) :
  9527. undefined;
  9528. return val !== undefined ?
  9529. val :
  9530. support.attributes || !documentIsHTML ?
  9531. elem.getAttribute( name ) :
  9532. (val = elem.getAttributeNode(name)) && val.specified ?
  9533. val.value :
  9534. null;
  9535. };
  9536. Sizzle.escape = function( sel ) {
  9537. return (sel + "").replace( rcssescape, fcssescape );
  9538. };
  9539. Sizzle.error = function( msg ) {
  9540. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9541. };
  9542. /**
  9543. * Document sorting and removing duplicates
  9544. * @param {ArrayLike} results
  9545. */
  9546. Sizzle.uniqueSort = function( results ) {
  9547. var elem,
  9548. duplicates = [],
  9549. j = 0,
  9550. i = 0;
  9551. // Unless we *know* we can detect duplicates, assume their presence
  9552. hasDuplicate = !support.detectDuplicates;
  9553. sortInput = !support.sortStable && results.slice( 0 );
  9554. results.sort( sortOrder );
  9555. if ( hasDuplicate ) {
  9556. while ( (elem = results[i++]) ) {
  9557. if ( elem === results[ i ] ) {
  9558. j = duplicates.push( i );
  9559. }
  9560. }
  9561. while ( j-- ) {
  9562. results.splice( duplicates[ j ], 1 );
  9563. }
  9564. }
  9565. // Clear input after sorting to release objects
  9566. // See https://github.com/jquery/sizzle/pull/225
  9567. sortInput = null;
  9568. return results;
  9569. };
  9570. /**
  9571. * Utility function for retrieving the text value of an array of DOM nodes
  9572. * @param {Array|Element} elem
  9573. */
  9574. getText = Sizzle.getText = function( elem ) {
  9575. var node,
  9576. ret = "",
  9577. i = 0,
  9578. nodeType = elem.nodeType;
  9579. if ( !nodeType ) {
  9580. // If no nodeType, this is expected to be an array
  9581. while ( (node = elem[i++]) ) {
  9582. // Do not traverse comment nodes
  9583. ret += getText( node );
  9584. }
  9585. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9586. // Use textContent for elements
  9587. // innerText usage removed for consistency of new lines (jQuery #11153)
  9588. if ( typeof elem.textContent === "string" ) {
  9589. return elem.textContent;
  9590. } else {
  9591. // Traverse its children
  9592. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9593. ret += getText( elem );
  9594. }
  9595. }
  9596. } else if ( nodeType === 3 || nodeType === 4 ) {
  9597. return elem.nodeValue;
  9598. }
  9599. // Do not include comment or processing instruction nodes
  9600. return ret;
  9601. };
  9602. Expr = Sizzle.selectors = {
  9603. // Can be adjusted by the user
  9604. cacheLength: 50,
  9605. createPseudo: markFunction,
  9606. match: matchExpr,
  9607. attrHandle: {},
  9608. find: {},
  9609. relative: {
  9610. ">": { dir: "parentNode", first: true },
  9611. " ": { dir: "parentNode" },
  9612. "+": { dir: "previousSibling", first: true },
  9613. "~": { dir: "previousSibling" }
  9614. },
  9615. preFilter: {
  9616. "ATTR": function( match ) {
  9617. match[1] = match[1].replace( runescape, funescape );
  9618. // Move the given value to match[3] whether quoted or unquoted
  9619. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9620. if ( match[2] === "~=" ) {
  9621. match[3] = " " + match[3] + " ";
  9622. }
  9623. return match.slice( 0, 4 );
  9624. },
  9625. "CHILD": function( match ) {
  9626. /* matches from matchExpr["CHILD"]
  9627. 1 type (only|nth|...)
  9628. 2 what (child|of-type)
  9629. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9630. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9631. 5 sign of xn-component
  9632. 6 x of xn-component
  9633. 7 sign of y-component
  9634. 8 y of y-component
  9635. */
  9636. match[1] = match[1].toLowerCase();
  9637. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9638. // nth-* requires argument
  9639. if ( !match[3] ) {
  9640. Sizzle.error( match[0] );
  9641. }
  9642. // numeric x and y parameters for Expr.filter.CHILD
  9643. // remember that false/true cast respectively to 0/1
  9644. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9645. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9646. // other types prohibit arguments
  9647. } else if ( match[3] ) {
  9648. Sizzle.error( match[0] );
  9649. }
  9650. return match;
  9651. },
  9652. "PSEUDO": function( match ) {
  9653. var excess,
  9654. unquoted = !match[6] && match[2];
  9655. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9656. return null;
  9657. }
  9658. // Accept quoted arguments as-is
  9659. if ( match[3] ) {
  9660. match[2] = match[4] || match[5] || "";
  9661. // Strip excess characters from unquoted arguments
  9662. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9663. // Get excess from tokenize (recursively)
  9664. (excess = tokenize( unquoted, true )) &&
  9665. // advance to the next closing parenthesis
  9666. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9667. // excess is a negative index
  9668. match[0] = match[0].slice( 0, excess );
  9669. match[2] = unquoted.slice( 0, excess );
  9670. }
  9671. // Return only captures needed by the pseudo filter method (type and argument)
  9672. return match.slice( 0, 3 );
  9673. }
  9674. },
  9675. filter: {
  9676. "TAG": function( nodeNameSelector ) {
  9677. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9678. return nodeNameSelector === "*" ?
  9679. function() { return true; } :
  9680. function( elem ) {
  9681. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9682. };
  9683. },
  9684. "CLASS": function( className ) {
  9685. var pattern = classCache[ className + " " ];
  9686. return pattern ||
  9687. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9688. classCache( className, function( elem ) {
  9689. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9690. });
  9691. },
  9692. "ATTR": function( name, operator, check ) {
  9693. return function( elem ) {
  9694. var result = Sizzle.attr( elem, name );
  9695. if ( result == null ) {
  9696. return operator === "!=";
  9697. }
  9698. if ( !operator ) {
  9699. return true;
  9700. }
  9701. result += "";
  9702. return operator === "=" ? result === check :
  9703. operator === "!=" ? result !== check :
  9704. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9705. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9706. operator === "$=" ? check && result.slice( -check.length ) === check :
  9707. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9708. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9709. false;
  9710. };
  9711. },
  9712. "CHILD": function( type, what, argument, first, last ) {
  9713. var simple = type.slice( 0, 3 ) !== "nth",
  9714. forward = type.slice( -4 ) !== "last",
  9715. ofType = what === "of-type";
  9716. return first === 1 && last === 0 ?
  9717. // Shortcut for :nth-*(n)
  9718. function( elem ) {
  9719. return !!elem.parentNode;
  9720. } :
  9721. function( elem, context, xml ) {
  9722. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  9723. dir = simple !== forward ? "nextSibling" : "previousSibling",
  9724. parent = elem.parentNode,
  9725. name = ofType && elem.nodeName.toLowerCase(),
  9726. useCache = !xml && !ofType,
  9727. diff = false;
  9728. if ( parent ) {
  9729. // :(first|last|only)-(child|of-type)
  9730. if ( simple ) {
  9731. while ( dir ) {
  9732. node = elem;
  9733. while ( (node = node[ dir ]) ) {
  9734. if ( ofType ?
  9735. node.nodeName.toLowerCase() === name :
  9736. node.nodeType === 1 ) {
  9737. return false;
  9738. }
  9739. }
  9740. // Reverse direction for :only-* (if we haven't yet done so)
  9741. start = dir = type === "only" && !start && "nextSibling";
  9742. }
  9743. return true;
  9744. }
  9745. start = [ forward ? parent.firstChild : parent.lastChild ];
  9746. // non-xml :nth-child(...) stores cache data on `parent`
  9747. if ( forward && useCache ) {
  9748. // Seek `elem` from a previously-cached index
  9749. // ...in a gzip-friendly way
  9750. node = parent;
  9751. outerCache = node[ expando ] || (node[ expando ] = {});
  9752. // Support: IE <9 only
  9753. // Defend against cloned attroperties (jQuery gh-1709)
  9754. uniqueCache = outerCache[ node.uniqueID ] ||
  9755. (outerCache[ node.uniqueID ] = {});
  9756. cache = uniqueCache[ type ] || [];
  9757. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9758. diff = nodeIndex && cache[ 2 ];
  9759. node = nodeIndex && parent.childNodes[ nodeIndex ];
  9760. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9761. // Fallback to seeking `elem` from the start
  9762. (diff = nodeIndex = 0) || start.pop()) ) {
  9763. // When found, cache indexes on `parent` and break
  9764. if ( node.nodeType === 1 && ++diff && node === elem ) {
  9765. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  9766. break;
  9767. }
  9768. }
  9769. } else {
  9770. // Use previously-cached element index if available
  9771. if ( useCache ) {
  9772. // ...in a gzip-friendly way
  9773. node = elem;
  9774. outerCache = node[ expando ] || (node[ expando ] = {});
  9775. // Support: IE <9 only
  9776. // Defend against cloned attroperties (jQuery gh-1709)
  9777. uniqueCache = outerCache[ node.uniqueID ] ||
  9778. (outerCache[ node.uniqueID ] = {});
  9779. cache = uniqueCache[ type ] || [];
  9780. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9781. diff = nodeIndex;
  9782. }
  9783. // xml :nth-child(...)
  9784. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  9785. if ( diff === false ) {
  9786. // Use the same loop as above to seek `elem` from the start
  9787. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9788. (diff = nodeIndex = 0) || start.pop()) ) {
  9789. if ( ( ofType ?
  9790. node.nodeName.toLowerCase() === name :
  9791. node.nodeType === 1 ) &&
  9792. ++diff ) {
  9793. // Cache the index of each encountered element
  9794. if ( useCache ) {
  9795. outerCache = node[ expando ] || (node[ expando ] = {});
  9796. // Support: IE <9 only
  9797. // Defend against cloned attroperties (jQuery gh-1709)
  9798. uniqueCache = outerCache[ node.uniqueID ] ||
  9799. (outerCache[ node.uniqueID ] = {});
  9800. uniqueCache[ type ] = [ dirruns, diff ];
  9801. }
  9802. if ( node === elem ) {
  9803. break;
  9804. }
  9805. }
  9806. }
  9807. }
  9808. }
  9809. // Incorporate the offset, then check against cycle size
  9810. diff -= last;
  9811. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  9812. }
  9813. };
  9814. },
  9815. "PSEUDO": function( pseudo, argument ) {
  9816. // pseudo-class names are case-insensitive
  9817. // http://www.w3.org/TR/selectors/#pseudo-classes
  9818. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  9819. // Remember that setFilters inherits from pseudos
  9820. var args,
  9821. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  9822. Sizzle.error( "unsupported pseudo: " + pseudo );
  9823. // The user may use createPseudo to indicate that
  9824. // arguments are needed to create the filter function
  9825. // just as Sizzle does
  9826. if ( fn[ expando ] ) {
  9827. return fn( argument );
  9828. }
  9829. // But maintain support for old signatures
  9830. if ( fn.length > 1 ) {
  9831. args = [ pseudo, pseudo, "", argument ];
  9832. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  9833. markFunction(function( seed, matches ) {
  9834. var idx,
  9835. matched = fn( seed, argument ),
  9836. i = matched.length;
  9837. while ( i-- ) {
  9838. idx = indexOf( seed, matched[i] );
  9839. seed[ idx ] = !( matches[ idx ] = matched[i] );
  9840. }
  9841. }) :
  9842. function( elem ) {
  9843. return fn( elem, 0, args );
  9844. };
  9845. }
  9846. return fn;
  9847. }
  9848. },
  9849. pseudos: {
  9850. // Potentially complex pseudos
  9851. "not": markFunction(function( selector ) {
  9852. // Trim the selector passed to compile
  9853. // to avoid treating leading and trailing
  9854. // spaces as combinators
  9855. var input = [],
  9856. results = [],
  9857. matcher = compile( selector.replace( rtrim, "$1" ) );
  9858. return matcher[ expando ] ?
  9859. markFunction(function( seed, matches, context, xml ) {
  9860. var elem,
  9861. unmatched = matcher( seed, null, xml, [] ),
  9862. i = seed.length;
  9863. // Match elements unmatched by `matcher`
  9864. while ( i-- ) {
  9865. if ( (elem = unmatched[i]) ) {
  9866. seed[i] = !(matches[i] = elem);
  9867. }
  9868. }
  9869. }) :
  9870. function( elem, context, xml ) {
  9871. input[0] = elem;
  9872. matcher( input, null, xml, results );
  9873. // Don't keep the element (issue #299)
  9874. input[0] = null;
  9875. return !results.pop();
  9876. };
  9877. }),
  9878. "has": markFunction(function( selector ) {
  9879. return function( elem ) {
  9880. return Sizzle( selector, elem ).length > 0;
  9881. };
  9882. }),
  9883. "contains": markFunction(function( text ) {
  9884. text = text.replace( runescape, funescape );
  9885. return function( elem ) {
  9886. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  9887. };
  9888. }),
  9889. // "Whether an element is represented by a :lang() selector
  9890. // is based solely on the element's language value
  9891. // being equal to the identifier C,
  9892. // or beginning with the identifier C immediately followed by "-".
  9893. // The matching of C against the element's language value is performed case-insensitively.
  9894. // The identifier C does not have to be a valid language name."
  9895. // http://www.w3.org/TR/selectors/#lang-pseudo
  9896. "lang": markFunction( function( lang ) {
  9897. // lang value must be a valid identifier
  9898. if ( !ridentifier.test(lang || "") ) {
  9899. Sizzle.error( "unsupported lang: " + lang );
  9900. }
  9901. lang = lang.replace( runescape, funescape ).toLowerCase();
  9902. return function( elem ) {
  9903. var elemLang;
  9904. do {
  9905. if ( (elemLang = documentIsHTML ?
  9906. elem.lang :
  9907. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  9908. elemLang = elemLang.toLowerCase();
  9909. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  9910. }
  9911. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  9912. return false;
  9913. };
  9914. }),
  9915. // Miscellaneous
  9916. "target": function( elem ) {
  9917. var hash = window.location && window.location.hash;
  9918. return hash && hash.slice( 1 ) === elem.id;
  9919. },
  9920. "root": function( elem ) {
  9921. return elem === docElem;
  9922. },
  9923. "focus": function( elem ) {
  9924. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  9925. },
  9926. // Boolean properties
  9927. "enabled": createDisabledPseudo( false ),
  9928. "disabled": createDisabledPseudo( true ),
  9929. "checked": function( elem ) {
  9930. // In CSS3, :checked should return both checked and selected elements
  9931. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9932. var nodeName = elem.nodeName.toLowerCase();
  9933. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  9934. },
  9935. "selected": function( elem ) {
  9936. // Accessing this property makes selected-by-default
  9937. // options in Safari work properly
  9938. if ( elem.parentNode ) {
  9939. elem.parentNode.selectedIndex;
  9940. }
  9941. return elem.selected === true;
  9942. },
  9943. // Contents
  9944. "empty": function( elem ) {
  9945. // http://www.w3.org/TR/selectors/#empty-pseudo
  9946. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  9947. // but not by others (comment: 8; processing instruction: 7; etc.)
  9948. // nodeType < 6 works because attributes (2) do not appear as children
  9949. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9950. if ( elem.nodeType < 6 ) {
  9951. return false;
  9952. }
  9953. }
  9954. return true;
  9955. },
  9956. "parent": function( elem ) {
  9957. return !Expr.pseudos["empty"]( elem );
  9958. },
  9959. // Element/input types
  9960. "header": function( elem ) {
  9961. return rheader.test( elem.nodeName );
  9962. },
  9963. "input": function( elem ) {
  9964. return rinputs.test( elem.nodeName );
  9965. },
  9966. "button": function( elem ) {
  9967. var name = elem.nodeName.toLowerCase();
  9968. return name === "input" && elem.type === "button" || name === "button";
  9969. },
  9970. "text": function( elem ) {
  9971. var attr;
  9972. return elem.nodeName.toLowerCase() === "input" &&
  9973. elem.type === "text" &&
  9974. // Support: IE<8
  9975. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  9976. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  9977. },
  9978. // Position-in-collection
  9979. "first": createPositionalPseudo(function() {
  9980. return [ 0 ];
  9981. }),
  9982. "last": createPositionalPseudo(function( matchIndexes, length ) {
  9983. return [ length - 1 ];
  9984. }),
  9985. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9986. return [ argument < 0 ? argument + length : argument ];
  9987. }),
  9988. "even": createPositionalPseudo(function( matchIndexes, length ) {
  9989. var i = 0;
  9990. for ( ; i < length; i += 2 ) {
  9991. matchIndexes.push( i );
  9992. }
  9993. return matchIndexes;
  9994. }),
  9995. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  9996. var i = 1;
  9997. for ( ; i < length; i += 2 ) {
  9998. matchIndexes.push( i );
  9999. }
  10000. return matchIndexes;
  10001. }),
  10002. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10003. var i = argument < 0 ?
  10004. argument + length :
  10005. argument > length ?
  10006. length :
  10007. argument;
  10008. for ( ; --i >= 0; ) {
  10009. matchIndexes.push( i );
  10010. }
  10011. return matchIndexes;
  10012. }),
  10013. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10014. var i = argument < 0 ? argument + length : argument;
  10015. for ( ; ++i < length; ) {
  10016. matchIndexes.push( i );
  10017. }
  10018. return matchIndexes;
  10019. })
  10020. }
  10021. };
  10022. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10023. // Add button/input type pseudos
  10024. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10025. Expr.pseudos[ i ] = createInputPseudo( i );
  10026. }
  10027. for ( i in { submit: true, reset: true } ) {
  10028. Expr.pseudos[ i ] = createButtonPseudo( i );
  10029. }
  10030. // Easy API for creating new setFilters
  10031. function setFilters() {}
  10032. setFilters.prototype = Expr.filters = Expr.pseudos;
  10033. Expr.setFilters = new setFilters();
  10034. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10035. var matched, match, tokens, type,
  10036. soFar, groups, preFilters,
  10037. cached = tokenCache[ selector + " " ];
  10038. if ( cached ) {
  10039. return parseOnly ? 0 : cached.slice( 0 );
  10040. }
  10041. soFar = selector;
  10042. groups = [];
  10043. preFilters = Expr.preFilter;
  10044. while ( soFar ) {
  10045. // Comma and first run
  10046. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10047. if ( match ) {
  10048. // Don't consume trailing commas as valid
  10049. soFar = soFar.slice( match[0].length ) || soFar;
  10050. }
  10051. groups.push( (tokens = []) );
  10052. }
  10053. matched = false;
  10054. // Combinators
  10055. if ( (match = rcombinators.exec( soFar )) ) {
  10056. matched = match.shift();
  10057. tokens.push({
  10058. value: matched,
  10059. // Cast descendant combinators to space
  10060. type: match[0].replace( rtrim, " " )
  10061. });
  10062. soFar = soFar.slice( matched.length );
  10063. }
  10064. // Filters
  10065. for ( type in Expr.filter ) {
  10066. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10067. (match = preFilters[ type ]( match ))) ) {
  10068. matched = match.shift();
  10069. tokens.push({
  10070. value: matched,
  10071. type: type,
  10072. matches: match
  10073. });
  10074. soFar = soFar.slice( matched.length );
  10075. }
  10076. }
  10077. if ( !matched ) {
  10078. break;
  10079. }
  10080. }
  10081. // Return the length of the invalid excess
  10082. // if we're just parsing
  10083. // Otherwise, throw an error or return tokens
  10084. return parseOnly ?
  10085. soFar.length :
  10086. soFar ?
  10087. Sizzle.error( selector ) :
  10088. // Cache the tokens
  10089. tokenCache( selector, groups ).slice( 0 );
  10090. };
  10091. function toSelector( tokens ) {
  10092. var i = 0,
  10093. len = tokens.length,
  10094. selector = "";
  10095. for ( ; i < len; i++ ) {
  10096. selector += tokens[i].value;
  10097. }
  10098. return selector;
  10099. }
  10100. function addCombinator( matcher, combinator, base ) {
  10101. var dir = combinator.dir,
  10102. skip = combinator.next,
  10103. key = skip || dir,
  10104. checkNonElements = base && key === "parentNode",
  10105. doneName = done++;
  10106. return combinator.first ?
  10107. // Check against closest ancestor/preceding element
  10108. function( elem, context, xml ) {
  10109. while ( (elem = elem[ dir ]) ) {
  10110. if ( elem.nodeType === 1 || checkNonElements ) {
  10111. return matcher( elem, context, xml );
  10112. }
  10113. }
  10114. return false;
  10115. } :
  10116. // Check against all ancestor/preceding elements
  10117. function( elem, context, xml ) {
  10118. var oldCache, uniqueCache, outerCache,
  10119. newCache = [ dirruns, doneName ];
  10120. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10121. if ( xml ) {
  10122. while ( (elem = elem[ dir ]) ) {
  10123. if ( elem.nodeType === 1 || checkNonElements ) {
  10124. if ( matcher( elem, context, xml ) ) {
  10125. return true;
  10126. }
  10127. }
  10128. }
  10129. } else {
  10130. while ( (elem = elem[ dir ]) ) {
  10131. if ( elem.nodeType === 1 || checkNonElements ) {
  10132. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10133. // Support: IE <9 only
  10134. // Defend against cloned attroperties (jQuery gh-1709)
  10135. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10136. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10137. elem = elem[ dir ] || elem;
  10138. } else if ( (oldCache = uniqueCache[ key ]) &&
  10139. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10140. // Assign to newCache so results back-propagate to previous elements
  10141. return (newCache[ 2 ] = oldCache[ 2 ]);
  10142. } else {
  10143. // Reuse newcache so results back-propagate to previous elements
  10144. uniqueCache[ key ] = newCache;
  10145. // A match means we're done; a fail means we have to keep checking
  10146. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10147. return true;
  10148. }
  10149. }
  10150. }
  10151. }
  10152. }
  10153. return false;
  10154. };
  10155. }
  10156. function elementMatcher( matchers ) {
  10157. return matchers.length > 1 ?
  10158. function( elem, context, xml ) {
  10159. var i = matchers.length;
  10160. while ( i-- ) {
  10161. if ( !matchers[i]( elem, context, xml ) ) {
  10162. return false;
  10163. }
  10164. }
  10165. return true;
  10166. } :
  10167. matchers[0];
  10168. }
  10169. function multipleContexts( selector, contexts, results ) {
  10170. var i = 0,
  10171. len = contexts.length;
  10172. for ( ; i < len; i++ ) {
  10173. Sizzle( selector, contexts[i], results );
  10174. }
  10175. return results;
  10176. }
  10177. function condense( unmatched, map, filter, context, xml ) {
  10178. var elem,
  10179. newUnmatched = [],
  10180. i = 0,
  10181. len = unmatched.length,
  10182. mapped = map != null;
  10183. for ( ; i < len; i++ ) {
  10184. if ( (elem = unmatched[i]) ) {
  10185. if ( !filter || filter( elem, context, xml ) ) {
  10186. newUnmatched.push( elem );
  10187. if ( mapped ) {
  10188. map.push( i );
  10189. }
  10190. }
  10191. }
  10192. }
  10193. return newUnmatched;
  10194. }
  10195. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10196. if ( postFilter && !postFilter[ expando ] ) {
  10197. postFilter = setMatcher( postFilter );
  10198. }
  10199. if ( postFinder && !postFinder[ expando ] ) {
  10200. postFinder = setMatcher( postFinder, postSelector );
  10201. }
  10202. return markFunction(function( seed, results, context, xml ) {
  10203. var temp, i, elem,
  10204. preMap = [],
  10205. postMap = [],
  10206. preexisting = results.length,
  10207. // Get initial elements from seed or context
  10208. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10209. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10210. matcherIn = preFilter && ( seed || !selector ) ?
  10211. condense( elems, preMap, preFilter, context, xml ) :
  10212. elems,
  10213. matcherOut = matcher ?
  10214. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10215. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10216. // ...intermediate processing is necessary
  10217. [] :
  10218. // ...otherwise use results directly
  10219. results :
  10220. matcherIn;
  10221. // Find primary matches
  10222. if ( matcher ) {
  10223. matcher( matcherIn, matcherOut, context, xml );
  10224. }
  10225. // Apply postFilter
  10226. if ( postFilter ) {
  10227. temp = condense( matcherOut, postMap );
  10228. postFilter( temp, [], context, xml );
  10229. // Un-match failing elements by moving them back to matcherIn
  10230. i = temp.length;
  10231. while ( i-- ) {
  10232. if ( (elem = temp[i]) ) {
  10233. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10234. }
  10235. }
  10236. }
  10237. if ( seed ) {
  10238. if ( postFinder || preFilter ) {
  10239. if ( postFinder ) {
  10240. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10241. temp = [];
  10242. i = matcherOut.length;
  10243. while ( i-- ) {
  10244. if ( (elem = matcherOut[i]) ) {
  10245. // Restore matcherIn since elem is not yet a final match
  10246. temp.push( (matcherIn[i] = elem) );
  10247. }
  10248. }
  10249. postFinder( null, (matcherOut = []), temp, xml );
  10250. }
  10251. // Move matched elements from seed to results to keep them synchronized
  10252. i = matcherOut.length;
  10253. while ( i-- ) {
  10254. if ( (elem = matcherOut[i]) &&
  10255. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10256. seed[temp] = !(results[temp] = elem);
  10257. }
  10258. }
  10259. }
  10260. // Add elements to results, through postFinder if defined
  10261. } else {
  10262. matcherOut = condense(
  10263. matcherOut === results ?
  10264. matcherOut.splice( preexisting, matcherOut.length ) :
  10265. matcherOut
  10266. );
  10267. if ( postFinder ) {
  10268. postFinder( null, results, matcherOut, xml );
  10269. } else {
  10270. push.apply( results, matcherOut );
  10271. }
  10272. }
  10273. });
  10274. }
  10275. function matcherFromTokens( tokens ) {
  10276. var checkContext, matcher, j,
  10277. len = tokens.length,
  10278. leadingRelative = Expr.relative[ tokens[0].type ],
  10279. implicitRelative = leadingRelative || Expr.relative[" "],
  10280. i = leadingRelative ? 1 : 0,
  10281. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10282. matchContext = addCombinator( function( elem ) {
  10283. return elem === checkContext;
  10284. }, implicitRelative, true ),
  10285. matchAnyContext = addCombinator( function( elem ) {
  10286. return indexOf( checkContext, elem ) > -1;
  10287. }, implicitRelative, true ),
  10288. matchers = [ function( elem, context, xml ) {
  10289. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10290. (checkContext = context).nodeType ?
  10291. matchContext( elem, context, xml ) :
  10292. matchAnyContext( elem, context, xml ) );
  10293. // Avoid hanging onto element (issue #299)
  10294. checkContext = null;
  10295. return ret;
  10296. } ];
  10297. for ( ; i < len; i++ ) {
  10298. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10299. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10300. } else {
  10301. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10302. // Return special upon seeing a positional matcher
  10303. if ( matcher[ expando ] ) {
  10304. // Find the next relative operator (if any) for proper handling
  10305. j = ++i;
  10306. for ( ; j < len; j++ ) {
  10307. if ( Expr.relative[ tokens[j].type ] ) {
  10308. break;
  10309. }
  10310. }
  10311. return setMatcher(
  10312. i > 1 && elementMatcher( matchers ),
  10313. i > 1 && toSelector(
  10314. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10315. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10316. ).replace( rtrim, "$1" ),
  10317. matcher,
  10318. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10319. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10320. j < len && toSelector( tokens )
  10321. );
  10322. }
  10323. matchers.push( matcher );
  10324. }
  10325. }
  10326. return elementMatcher( matchers );
  10327. }
  10328. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10329. var bySet = setMatchers.length > 0,
  10330. byElement = elementMatchers.length > 0,
  10331. superMatcher = function( seed, context, xml, results, outermost ) {
  10332. var elem, j, matcher,
  10333. matchedCount = 0,
  10334. i = "0",
  10335. unmatched = seed && [],
  10336. setMatched = [],
  10337. contextBackup = outermostContext,
  10338. // We must always have either seed elements or outermost context
  10339. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10340. // Use integer dirruns iff this is the outermost matcher
  10341. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10342. len = elems.length;
  10343. if ( outermost ) {
  10344. outermostContext = context === document || context || outermost;
  10345. }
  10346. // Add elements passing elementMatchers directly to results
  10347. // Support: IE<9, Safari
  10348. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10349. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10350. if ( byElement && elem ) {
  10351. j = 0;
  10352. if ( !context && elem.ownerDocument !== document ) {
  10353. setDocument( elem );
  10354. xml = !documentIsHTML;
  10355. }
  10356. while ( (matcher = elementMatchers[j++]) ) {
  10357. if ( matcher( elem, context || document, xml) ) {
  10358. results.push( elem );
  10359. break;
  10360. }
  10361. }
  10362. if ( outermost ) {
  10363. dirruns = dirrunsUnique;
  10364. }
  10365. }
  10366. // Track unmatched elements for set filters
  10367. if ( bySet ) {
  10368. // They will have gone through all possible matchers
  10369. if ( (elem = !matcher && elem) ) {
  10370. matchedCount--;
  10371. }
  10372. // Lengthen the array for every element, matched or not
  10373. if ( seed ) {
  10374. unmatched.push( elem );
  10375. }
  10376. }
  10377. }
  10378. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10379. // makes the latter nonnegative.
  10380. matchedCount += i;
  10381. // Apply set filters to unmatched elements
  10382. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10383. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10384. // no element matchers and no seed.
  10385. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10386. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10387. // numerically zero.
  10388. if ( bySet && i !== matchedCount ) {
  10389. j = 0;
  10390. while ( (matcher = setMatchers[j++]) ) {
  10391. matcher( unmatched, setMatched, context, xml );
  10392. }
  10393. if ( seed ) {
  10394. // Reintegrate element matches to eliminate the need for sorting
  10395. if ( matchedCount > 0 ) {
  10396. while ( i-- ) {
  10397. if ( !(unmatched[i] || setMatched[i]) ) {
  10398. setMatched[i] = pop.call( results );
  10399. }
  10400. }
  10401. }
  10402. // Discard index placeholder values to get only actual matches
  10403. setMatched = condense( setMatched );
  10404. }
  10405. // Add matches to results
  10406. push.apply( results, setMatched );
  10407. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10408. if ( outermost && !seed && setMatched.length > 0 &&
  10409. ( matchedCount + setMatchers.length ) > 1 ) {
  10410. Sizzle.uniqueSort( results );
  10411. }
  10412. }
  10413. // Override manipulation of globals by nested matchers
  10414. if ( outermost ) {
  10415. dirruns = dirrunsUnique;
  10416. outermostContext = contextBackup;
  10417. }
  10418. return unmatched;
  10419. };
  10420. return bySet ?
  10421. markFunction( superMatcher ) :
  10422. superMatcher;
  10423. }
  10424. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10425. var i,
  10426. setMatchers = [],
  10427. elementMatchers = [],
  10428. cached = compilerCache[ selector + " " ];
  10429. if ( !cached ) {
  10430. // Generate a function of recursive functions that can be used to check each element
  10431. if ( !match ) {
  10432. match = tokenize( selector );
  10433. }
  10434. i = match.length;
  10435. while ( i-- ) {
  10436. cached = matcherFromTokens( match[i] );
  10437. if ( cached[ expando ] ) {
  10438. setMatchers.push( cached );
  10439. } else {
  10440. elementMatchers.push( cached );
  10441. }
  10442. }
  10443. // Cache the compiled function
  10444. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10445. // Save selector and tokenization
  10446. cached.selector = selector;
  10447. }
  10448. return cached;
  10449. };
  10450. /**
  10451. * A low-level selection function that works with Sizzle's compiled
  10452. * selector functions
  10453. * @param {String|Function} selector A selector or a pre-compiled
  10454. * selector function built with Sizzle.compile
  10455. * @param {Element} context
  10456. * @param {Array} [results]
  10457. * @param {Array} [seed] A set of elements to match against
  10458. */
  10459. select = Sizzle.select = function( selector, context, results, seed ) {
  10460. var i, tokens, token, type, find,
  10461. compiled = typeof selector === "function" && selector,
  10462. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10463. results = results || [];
  10464. // Try to minimize operations if there is only one selector in the list and no seed
  10465. // (the latter of which guarantees us context)
  10466. if ( match.length === 1 ) {
  10467. // Reduce context if the leading compound selector is an ID
  10468. tokens = match[0] = match[0].slice( 0 );
  10469. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10470. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10471. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10472. if ( !context ) {
  10473. return results;
  10474. // Precompiled matchers will still verify ancestry, so step up a level
  10475. } else if ( compiled ) {
  10476. context = context.parentNode;
  10477. }
  10478. selector = selector.slice( tokens.shift().value.length );
  10479. }
  10480. // Fetch a seed set for right-to-left matching
  10481. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10482. while ( i-- ) {
  10483. token = tokens[i];
  10484. // Abort if we hit a combinator
  10485. if ( Expr.relative[ (type = token.type) ] ) {
  10486. break;
  10487. }
  10488. if ( (find = Expr.find[ type ]) ) {
  10489. // Search, expanding context for leading sibling combinators
  10490. if ( (seed = find(
  10491. token.matches[0].replace( runescape, funescape ),
  10492. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10493. )) ) {
  10494. // If seed is empty or no tokens remain, we can return early
  10495. tokens.splice( i, 1 );
  10496. selector = seed.length && toSelector( tokens );
  10497. if ( !selector ) {
  10498. push.apply( results, seed );
  10499. return results;
  10500. }
  10501. break;
  10502. }
  10503. }
  10504. }
  10505. }
  10506. // Compile and execute a filtering function if one is not provided
  10507. // Provide `match` to avoid retokenization if we modified the selector above
  10508. ( compiled || compile( selector, match ) )(
  10509. seed,
  10510. context,
  10511. !documentIsHTML,
  10512. results,
  10513. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10514. );
  10515. return results;
  10516. };
  10517. // One-time assignments
  10518. // Sort stability
  10519. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10520. // Support: Chrome 14-35+
  10521. // Always assume duplicates if they aren't passed to the comparison function
  10522. support.detectDuplicates = !!hasDuplicate;
  10523. // Initialize against the default document
  10524. setDocument();
  10525. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10526. // Detached nodes confoundingly follow *each other*
  10527. support.sortDetached = assert(function( el ) {
  10528. // Should return 1, but returns 4 (following)
  10529. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10530. });
  10531. // Support: IE<8
  10532. // Prevent attribute/property "interpolation"
  10533. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10534. if ( !assert(function( el ) {
  10535. el.innerHTML = "<a href='#'></a>";
  10536. return el.firstChild.getAttribute("href") === "#" ;
  10537. }) ) {
  10538. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10539. if ( !isXML ) {
  10540. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10541. }
  10542. });
  10543. }
  10544. // Support: IE<9
  10545. // Use defaultValue in place of getAttribute("value")
  10546. if ( !support.attributes || !assert(function( el ) {
  10547. el.innerHTML = "<input/>";
  10548. el.firstChild.setAttribute( "value", "" );
  10549. return el.firstChild.getAttribute( "value" ) === "";
  10550. }) ) {
  10551. addHandle( "value", function( elem, name, isXML ) {
  10552. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10553. return elem.defaultValue;
  10554. }
  10555. });
  10556. }
  10557. // Support: IE<9
  10558. // Use getAttributeNode to fetch booleans when getAttribute lies
  10559. if ( !assert(function( el ) {
  10560. return el.getAttribute("disabled") == null;
  10561. }) ) {
  10562. addHandle( booleans, function( elem, name, isXML ) {
  10563. var val;
  10564. if ( !isXML ) {
  10565. return elem[ name ] === true ? name.toLowerCase() :
  10566. (val = elem.getAttributeNode( name )) && val.specified ?
  10567. val.value :
  10568. null;
  10569. }
  10570. });
  10571. }
  10572. return Sizzle;
  10573. })( window );
  10574. jQuery.find = Sizzle;
  10575. jQuery.expr = Sizzle.selectors;
  10576. // Deprecated
  10577. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10578. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10579. jQuery.text = Sizzle.getText;
  10580. jQuery.isXMLDoc = Sizzle.isXML;
  10581. jQuery.contains = Sizzle.contains;
  10582. jQuery.escapeSelector = Sizzle.escape;
  10583. var dir = function( elem, dir, until ) {
  10584. var matched = [],
  10585. truncate = until !== undefined;
  10586. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10587. if ( elem.nodeType === 1 ) {
  10588. if ( truncate && jQuery( elem ).is( until ) ) {
  10589. break;
  10590. }
  10591. matched.push( elem );
  10592. }
  10593. }
  10594. return matched;
  10595. };
  10596. var siblings = function( n, elem ) {
  10597. var matched = [];
  10598. for ( ; n; n = n.nextSibling ) {
  10599. if ( n.nodeType === 1 && n !== elem ) {
  10600. matched.push( n );
  10601. }
  10602. }
  10603. return matched;
  10604. };
  10605. var rneedsContext = jQuery.expr.match.needsContext;
  10606. function nodeName( elem, name ) {
  10607. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10608. };
  10609. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10610. // Implement the identical functionality for filter and not
  10611. function winnow( elements, qualifier, not ) {
  10612. if ( isFunction( qualifier ) ) {
  10613. return jQuery.grep( elements, function( elem, i ) {
  10614. return !!qualifier.call( elem, i, elem ) !== not;
  10615. } );
  10616. }
  10617. // Single element
  10618. if ( qualifier.nodeType ) {
  10619. return jQuery.grep( elements, function( elem ) {
  10620. return ( elem === qualifier ) !== not;
  10621. } );
  10622. }
  10623. // Arraylike of elements (jQuery, arguments, Array)
  10624. if ( typeof qualifier !== "string" ) {
  10625. return jQuery.grep( elements, function( elem ) {
  10626. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10627. } );
  10628. }
  10629. // Filtered directly for both simple and complex selectors
  10630. return jQuery.filter( qualifier, elements, not );
  10631. }
  10632. jQuery.filter = function( expr, elems, not ) {
  10633. var elem = elems[ 0 ];
  10634. if ( not ) {
  10635. expr = ":not(" + expr + ")";
  10636. }
  10637. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10638. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10639. }
  10640. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10641. return elem.nodeType === 1;
  10642. } ) );
  10643. };
  10644. jQuery.fn.extend( {
  10645. find: function( selector ) {
  10646. var i, ret,
  10647. len = this.length,
  10648. self = this;
  10649. if ( typeof selector !== "string" ) {
  10650. return this.pushStack( jQuery( selector ).filter( function() {
  10651. for ( i = 0; i < len; i++ ) {
  10652. if ( jQuery.contains( self[ i ], this ) ) {
  10653. return true;
  10654. }
  10655. }
  10656. } ) );
  10657. }
  10658. ret = this.pushStack( [] );
  10659. for ( i = 0; i < len; i++ ) {
  10660. jQuery.find( selector, self[ i ], ret );
  10661. }
  10662. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10663. },
  10664. filter: function( selector ) {
  10665. return this.pushStack( winnow( this, selector || [], false ) );
  10666. },
  10667. not: function( selector ) {
  10668. return this.pushStack( winnow( this, selector || [], true ) );
  10669. },
  10670. is: function( selector ) {
  10671. return !!winnow(
  10672. this,
  10673. // If this is a positional/relative selector, check membership in the returned set
  10674. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10675. typeof selector === "string" && rneedsContext.test( selector ) ?
  10676. jQuery( selector ) :
  10677. selector || [],
  10678. false
  10679. ).length;
  10680. }
  10681. } );
  10682. // Initialize a jQuery object
  10683. // A central reference to the root jQuery(document)
  10684. var rootjQuery,
  10685. // A simple way to check for HTML strings
  10686. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10687. // Strict HTML recognition (#11290: must start with <)
  10688. // Shortcut simple #id case for speed
  10689. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10690. init = jQuery.fn.init = function( selector, context, root ) {
  10691. var match, elem;
  10692. // HANDLE: $(""), $(null), $(undefined), $(false)
  10693. if ( !selector ) {
  10694. return this;
  10695. }
  10696. // Method init() accepts an alternate rootjQuery
  10697. // so migrate can support jQuery.sub (gh-2101)
  10698. root = root || rootjQuery;
  10699. // Handle HTML strings
  10700. if ( typeof selector === "string" ) {
  10701. if ( selector[ 0 ] === "<" &&
  10702. selector[ selector.length - 1 ] === ">" &&
  10703. selector.length >= 3 ) {
  10704. // Assume that strings that start and end with <> are HTML and skip the regex check
  10705. match = [ null, selector, null ];
  10706. } else {
  10707. match = rquickExpr.exec( selector );
  10708. }
  10709. // Match html or make sure no context is specified for #id
  10710. if ( match && ( match[ 1 ] || !context ) ) {
  10711. // HANDLE: $(html) -> $(array)
  10712. if ( match[ 1 ] ) {
  10713. context = context instanceof jQuery ? context[ 0 ] : context;
  10714. // Option to run scripts is true for back-compat
  10715. // Intentionally let the error be thrown if parseHTML is not present
  10716. jQuery.merge( this, jQuery.parseHTML(
  10717. match[ 1 ],
  10718. context && context.nodeType ? context.ownerDocument || context : document,
  10719. true
  10720. ) );
  10721. // HANDLE: $(html, props)
  10722. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  10723. for ( match in context ) {
  10724. // Properties of context are called as methods if possible
  10725. if ( isFunction( this[ match ] ) ) {
  10726. this[ match ]( context[ match ] );
  10727. // ...and otherwise set as attributes
  10728. } else {
  10729. this.attr( match, context[ match ] );
  10730. }
  10731. }
  10732. }
  10733. return this;
  10734. // HANDLE: $(#id)
  10735. } else {
  10736. elem = document.getElementById( match[ 2 ] );
  10737. if ( elem ) {
  10738. // Inject the element directly into the jQuery object
  10739. this[ 0 ] = elem;
  10740. this.length = 1;
  10741. }
  10742. return this;
  10743. }
  10744. // HANDLE: $(expr, $(...))
  10745. } else if ( !context || context.jquery ) {
  10746. return ( context || root ).find( selector );
  10747. // HANDLE: $(expr, context)
  10748. // (which is just equivalent to: $(context).find(expr)
  10749. } else {
  10750. return this.constructor( context ).find( selector );
  10751. }
  10752. // HANDLE: $(DOMElement)
  10753. } else if ( selector.nodeType ) {
  10754. this[ 0 ] = selector;
  10755. this.length = 1;
  10756. return this;
  10757. // HANDLE: $(function)
  10758. // Shortcut for document ready
  10759. } else if ( isFunction( selector ) ) {
  10760. return root.ready !== undefined ?
  10761. root.ready( selector ) :
  10762. // Execute immediately if ready is not present
  10763. selector( jQuery );
  10764. }
  10765. return jQuery.makeArray( selector, this );
  10766. };
  10767. // Give the init function the jQuery prototype for later instantiation
  10768. init.prototype = jQuery.fn;
  10769. // Initialize central reference
  10770. rootjQuery = jQuery( document );
  10771. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  10772. // Methods guaranteed to produce a unique set when starting from a unique set
  10773. guaranteedUnique = {
  10774. children: true,
  10775. contents: true,
  10776. next: true,
  10777. prev: true
  10778. };
  10779. jQuery.fn.extend( {
  10780. has: function( target ) {
  10781. var targets = jQuery( target, this ),
  10782. l = targets.length;
  10783. return this.filter( function() {
  10784. var i = 0;
  10785. for ( ; i < l; i++ ) {
  10786. if ( jQuery.contains( this, targets[ i ] ) ) {
  10787. return true;
  10788. }
  10789. }
  10790. } );
  10791. },
  10792. closest: function( selectors, context ) {
  10793. var cur,
  10794. i = 0,
  10795. l = this.length,
  10796. matched = [],
  10797. targets = typeof selectors !== "string" && jQuery( selectors );
  10798. // Positional selectors never match, since there's no _selection_ context
  10799. if ( !rneedsContext.test( selectors ) ) {
  10800. for ( ; i < l; i++ ) {
  10801. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  10802. // Always skip document fragments
  10803. if ( cur.nodeType < 11 && ( targets ?
  10804. targets.index( cur ) > -1 :
  10805. // Don't pass non-elements to Sizzle
  10806. cur.nodeType === 1 &&
  10807. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  10808. matched.push( cur );
  10809. break;
  10810. }
  10811. }
  10812. }
  10813. }
  10814. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  10815. },
  10816. // Determine the position of an element within the set
  10817. index: function( elem ) {
  10818. // No argument, return index in parent
  10819. if ( !elem ) {
  10820. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  10821. }
  10822. // Index in selector
  10823. if ( typeof elem === "string" ) {
  10824. return indexOf.call( jQuery( elem ), this[ 0 ] );
  10825. }
  10826. // Locate the position of the desired element
  10827. return indexOf.call( this,
  10828. // If it receives a jQuery object, the first element is used
  10829. elem.jquery ? elem[ 0 ] : elem
  10830. );
  10831. },
  10832. add: function( selector, context ) {
  10833. return this.pushStack(
  10834. jQuery.uniqueSort(
  10835. jQuery.merge( this.get(), jQuery( selector, context ) )
  10836. )
  10837. );
  10838. },
  10839. addBack: function( selector ) {
  10840. return this.add( selector == null ?
  10841. this.prevObject : this.prevObject.filter( selector )
  10842. );
  10843. }
  10844. } );
  10845. function sibling( cur, dir ) {
  10846. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  10847. return cur;
  10848. }
  10849. jQuery.each( {
  10850. parent: function( elem ) {
  10851. var parent = elem.parentNode;
  10852. return parent && parent.nodeType !== 11 ? parent : null;
  10853. },
  10854. parents: function( elem ) {
  10855. return dir( elem, "parentNode" );
  10856. },
  10857. parentsUntil: function( elem, i, until ) {
  10858. return dir( elem, "parentNode", until );
  10859. },
  10860. next: function( elem ) {
  10861. return sibling( elem, "nextSibling" );
  10862. },
  10863. prev: function( elem ) {
  10864. return sibling( elem, "previousSibling" );
  10865. },
  10866. nextAll: function( elem ) {
  10867. return dir( elem, "nextSibling" );
  10868. },
  10869. prevAll: function( elem ) {
  10870. return dir( elem, "previousSibling" );
  10871. },
  10872. nextUntil: function( elem, i, until ) {
  10873. return dir( elem, "nextSibling", until );
  10874. },
  10875. prevUntil: function( elem, i, until ) {
  10876. return dir( elem, "previousSibling", until );
  10877. },
  10878. siblings: function( elem ) {
  10879. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  10880. },
  10881. children: function( elem ) {
  10882. return siblings( elem.firstChild );
  10883. },
  10884. contents: function( elem ) {
  10885. if ( typeof elem.contentDocument !== "undefined" ) {
  10886. return elem.contentDocument;
  10887. }
  10888. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  10889. // Treat the template element as a regular one in browsers that
  10890. // don't support it.
  10891. if ( nodeName( elem, "template" ) ) {
  10892. elem = elem.content || elem;
  10893. }
  10894. return jQuery.merge( [], elem.childNodes );
  10895. }
  10896. }, function( name, fn ) {
  10897. jQuery.fn[ name ] = function( until, selector ) {
  10898. var matched = jQuery.map( this, fn, until );
  10899. if ( name.slice( -5 ) !== "Until" ) {
  10900. selector = until;
  10901. }
  10902. if ( selector && typeof selector === "string" ) {
  10903. matched = jQuery.filter( selector, matched );
  10904. }
  10905. if ( this.length > 1 ) {
  10906. // Remove duplicates
  10907. if ( !guaranteedUnique[ name ] ) {
  10908. jQuery.uniqueSort( matched );
  10909. }
  10910. // Reverse order for parents* and prev-derivatives
  10911. if ( rparentsprev.test( name ) ) {
  10912. matched.reverse();
  10913. }
  10914. }
  10915. return this.pushStack( matched );
  10916. };
  10917. } );
  10918. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  10919. // Convert String-formatted options into Object-formatted ones
  10920. function createOptions( options ) {
  10921. var object = {};
  10922. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  10923. object[ flag ] = true;
  10924. } );
  10925. return object;
  10926. }
  10927. /*
  10928. * Create a callback list using the following parameters:
  10929. *
  10930. * options: an optional list of space-separated options that will change how
  10931. * the callback list behaves or a more traditional option object
  10932. *
  10933. * By default a callback list will act like an event callback list and can be
  10934. * "fired" multiple times.
  10935. *
  10936. * Possible options:
  10937. *
  10938. * once: will ensure the callback list can only be fired once (like a Deferred)
  10939. *
  10940. * memory: will keep track of previous values and will call any callback added
  10941. * after the list has been fired right away with the latest "memorized"
  10942. * values (like a Deferred)
  10943. *
  10944. * unique: will ensure a callback can only be added once (no duplicate in the list)
  10945. *
  10946. * stopOnFalse: interrupt callings when a callback returns false
  10947. *
  10948. */
  10949. jQuery.Callbacks = function( options ) {
  10950. // Convert options from String-formatted to Object-formatted if needed
  10951. // (we check in cache first)
  10952. options = typeof options === "string" ?
  10953. createOptions( options ) :
  10954. jQuery.extend( {}, options );
  10955. var // Flag to know if list is currently firing
  10956. firing,
  10957. // Last fire value for non-forgettable lists
  10958. memory,
  10959. // Flag to know if list was already fired
  10960. fired,
  10961. // Flag to prevent firing
  10962. locked,
  10963. // Actual callback list
  10964. list = [],
  10965. // Queue of execution data for repeatable lists
  10966. queue = [],
  10967. // Index of currently firing callback (modified by add/remove as needed)
  10968. firingIndex = -1,
  10969. // Fire callbacks
  10970. fire = function() {
  10971. // Enforce single-firing
  10972. locked = locked || options.once;
  10973. // Execute callbacks for all pending executions,
  10974. // respecting firingIndex overrides and runtime changes
  10975. fired = firing = true;
  10976. for ( ; queue.length; firingIndex = -1 ) {
  10977. memory = queue.shift();
  10978. while ( ++firingIndex < list.length ) {
  10979. // Run callback and check for early termination
  10980. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  10981. options.stopOnFalse ) {
  10982. // Jump to end and forget the data so .add doesn't re-fire
  10983. firingIndex = list.length;
  10984. memory = false;
  10985. }
  10986. }
  10987. }
  10988. // Forget the data if we're done with it
  10989. if ( !options.memory ) {
  10990. memory = false;
  10991. }
  10992. firing = false;
  10993. // Clean up if we're done firing for good
  10994. if ( locked ) {
  10995. // Keep an empty list if we have data for future add calls
  10996. if ( memory ) {
  10997. list = [];
  10998. // Otherwise, this object is spent
  10999. } else {
  11000. list = "";
  11001. }
  11002. }
  11003. },
  11004. // Actual Callbacks object
  11005. self = {
  11006. // Add a callback or a collection of callbacks to the list
  11007. add: function() {
  11008. if ( list ) {
  11009. // If we have memory from a past run, we should fire after adding
  11010. if ( memory && !firing ) {
  11011. firingIndex = list.length - 1;
  11012. queue.push( memory );
  11013. }
  11014. ( function add( args ) {
  11015. jQuery.each( args, function( _, arg ) {
  11016. if ( isFunction( arg ) ) {
  11017. if ( !options.unique || !self.has( arg ) ) {
  11018. list.push( arg );
  11019. }
  11020. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11021. // Inspect recursively
  11022. add( arg );
  11023. }
  11024. } );
  11025. } )( arguments );
  11026. if ( memory && !firing ) {
  11027. fire();
  11028. }
  11029. }
  11030. return this;
  11031. },
  11032. // Remove a callback from the list
  11033. remove: function() {
  11034. jQuery.each( arguments, function( _, arg ) {
  11035. var index;
  11036. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11037. list.splice( index, 1 );
  11038. // Handle firing indexes
  11039. if ( index <= firingIndex ) {
  11040. firingIndex--;
  11041. }
  11042. }
  11043. } );
  11044. return this;
  11045. },
  11046. // Check if a given callback is in the list.
  11047. // If no argument is given, return whether or not list has callbacks attached.
  11048. has: function( fn ) {
  11049. return fn ?
  11050. jQuery.inArray( fn, list ) > -1 :
  11051. list.length > 0;
  11052. },
  11053. // Remove all callbacks from the list
  11054. empty: function() {
  11055. if ( list ) {
  11056. list = [];
  11057. }
  11058. return this;
  11059. },
  11060. // Disable .fire and .add
  11061. // Abort any current/pending executions
  11062. // Clear all callbacks and values
  11063. disable: function() {
  11064. locked = queue = [];
  11065. list = memory = "";
  11066. return this;
  11067. },
  11068. disabled: function() {
  11069. return !list;
  11070. },
  11071. // Disable .fire
  11072. // Also disable .add unless we have memory (since it would have no effect)
  11073. // Abort any pending executions
  11074. lock: function() {
  11075. locked = queue = [];
  11076. if ( !memory && !firing ) {
  11077. list = memory = "";
  11078. }
  11079. return this;
  11080. },
  11081. locked: function() {
  11082. return !!locked;
  11083. },
  11084. // Call all callbacks with the given context and arguments
  11085. fireWith: function( context, args ) {
  11086. if ( !locked ) {
  11087. args = args || [];
  11088. args = [ context, args.slice ? args.slice() : args ];
  11089. queue.push( args );
  11090. if ( !firing ) {
  11091. fire();
  11092. }
  11093. }
  11094. return this;
  11095. },
  11096. // Call all the callbacks with the given arguments
  11097. fire: function() {
  11098. self.fireWith( this, arguments );
  11099. return this;
  11100. },
  11101. // To know if the callbacks have already been called at least once
  11102. fired: function() {
  11103. return !!fired;
  11104. }
  11105. };
  11106. return self;
  11107. };
  11108. function Identity( v ) {
  11109. return v;
  11110. }
  11111. function Thrower( ex ) {
  11112. throw ex;
  11113. }
  11114. function adoptValue( value, resolve, reject, noValue ) {
  11115. var method;
  11116. try {
  11117. // Check for promise aspect first to privilege synchronous behavior
  11118. if ( value && isFunction( ( method = value.promise ) ) ) {
  11119. method.call( value ).done( resolve ).fail( reject );
  11120. // Other thenables
  11121. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11122. method.call( value, resolve, reject );
  11123. // Other non-thenables
  11124. } else {
  11125. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11126. // * false: [ value ].slice( 0 ) => resolve( value )
  11127. // * true: [ value ].slice( 1 ) => resolve()
  11128. resolve.apply( undefined, [ value ].slice( noValue ) );
  11129. }
  11130. // For Promises/A+, convert exceptions into rejections
  11131. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11132. // Deferred#then to conditionally suppress rejection.
  11133. } catch ( value ) {
  11134. // Support: Android 4.0 only
  11135. // Strict mode functions invoked without .call/.apply get global-object context
  11136. reject.apply( undefined, [ value ] );
  11137. }
  11138. }
  11139. jQuery.extend( {
  11140. Deferred: function( func ) {
  11141. var tuples = [
  11142. // action, add listener, callbacks,
  11143. // ... .then handlers, argument index, [final state]
  11144. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11145. jQuery.Callbacks( "memory" ), 2 ],
  11146. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11147. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11148. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11149. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11150. ],
  11151. state = "pending",
  11152. promise = {
  11153. state: function() {
  11154. return state;
  11155. },
  11156. always: function() {
  11157. deferred.done( arguments ).fail( arguments );
  11158. return this;
  11159. },
  11160. "catch": function( fn ) {
  11161. return promise.then( null, fn );
  11162. },
  11163. // Keep pipe for back-compat
  11164. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11165. var fns = arguments;
  11166. return jQuery.Deferred( function( newDefer ) {
  11167. jQuery.each( tuples, function( i, tuple ) {
  11168. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11169. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11170. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11171. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11172. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11173. deferred[ tuple[ 1 ] ]( function() {
  11174. var returned = fn && fn.apply( this, arguments );
  11175. if ( returned && isFunction( returned.promise ) ) {
  11176. returned.promise()
  11177. .progress( newDefer.notify )
  11178. .done( newDefer.resolve )
  11179. .fail( newDefer.reject );
  11180. } else {
  11181. newDefer[ tuple[ 0 ] + "With" ](
  11182. this,
  11183. fn ? [ returned ] : arguments
  11184. );
  11185. }
  11186. } );
  11187. } );
  11188. fns = null;
  11189. } ).promise();
  11190. },
  11191. then: function( onFulfilled, onRejected, onProgress ) {
  11192. var maxDepth = 0;
  11193. function resolve( depth, deferred, handler, special ) {
  11194. return function() {
  11195. var that = this,
  11196. args = arguments,
  11197. mightThrow = function() {
  11198. var returned, then;
  11199. // Support: Promises/A+ section 2.3.3.3.3
  11200. // https://promisesaplus.com/#point-59
  11201. // Ignore double-resolution attempts
  11202. if ( depth < maxDepth ) {
  11203. return;
  11204. }
  11205. returned = handler.apply( that, args );
  11206. // Support: Promises/A+ section 2.3.1
  11207. // https://promisesaplus.com/#point-48
  11208. if ( returned === deferred.promise() ) {
  11209. throw new TypeError( "Thenable self-resolution" );
  11210. }
  11211. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11212. // https://promisesaplus.com/#point-54
  11213. // https://promisesaplus.com/#point-75
  11214. // Retrieve `then` only once
  11215. then = returned &&
  11216. // Support: Promises/A+ section 2.3.4
  11217. // https://promisesaplus.com/#point-64
  11218. // Only check objects and functions for thenability
  11219. ( typeof returned === "object" ||
  11220. typeof returned === "function" ) &&
  11221. returned.then;
  11222. // Handle a returned thenable
  11223. if ( isFunction( then ) ) {
  11224. // Special processors (notify) just wait for resolution
  11225. if ( special ) {
  11226. then.call(
  11227. returned,
  11228. resolve( maxDepth, deferred, Identity, special ),
  11229. resolve( maxDepth, deferred, Thrower, special )
  11230. );
  11231. // Normal processors (resolve) also hook into progress
  11232. } else {
  11233. // ...and disregard older resolution values
  11234. maxDepth++;
  11235. then.call(
  11236. returned,
  11237. resolve( maxDepth, deferred, Identity, special ),
  11238. resolve( maxDepth, deferred, Thrower, special ),
  11239. resolve( maxDepth, deferred, Identity,
  11240. deferred.notifyWith )
  11241. );
  11242. }
  11243. // Handle all other returned values
  11244. } else {
  11245. // Only substitute handlers pass on context
  11246. // and multiple values (non-spec behavior)
  11247. if ( handler !== Identity ) {
  11248. that = undefined;
  11249. args = [ returned ];
  11250. }
  11251. // Process the value(s)
  11252. // Default process is resolve
  11253. ( special || deferred.resolveWith )( that, args );
  11254. }
  11255. },
  11256. // Only normal processors (resolve) catch and reject exceptions
  11257. process = special ?
  11258. mightThrow :
  11259. function() {
  11260. try {
  11261. mightThrow();
  11262. } catch ( e ) {
  11263. if ( jQuery.Deferred.exceptionHook ) {
  11264. jQuery.Deferred.exceptionHook( e,
  11265. process.stackTrace );
  11266. }
  11267. // Support: Promises/A+ section 2.3.3.3.4.1
  11268. // https://promisesaplus.com/#point-61
  11269. // Ignore post-resolution exceptions
  11270. if ( depth + 1 >= maxDepth ) {
  11271. // Only substitute handlers pass on context
  11272. // and multiple values (non-spec behavior)
  11273. if ( handler !== Thrower ) {
  11274. that = undefined;
  11275. args = [ e ];
  11276. }
  11277. deferred.rejectWith( that, args );
  11278. }
  11279. }
  11280. };
  11281. // Support: Promises/A+ section 2.3.3.3.1
  11282. // https://promisesaplus.com/#point-57
  11283. // Re-resolve promises immediately to dodge false rejection from
  11284. // subsequent errors
  11285. if ( depth ) {
  11286. process();
  11287. } else {
  11288. // Call an optional hook to record the stack, in case of exception
  11289. // since it's otherwise lost when execution goes async
  11290. if ( jQuery.Deferred.getStackHook ) {
  11291. process.stackTrace = jQuery.Deferred.getStackHook();
  11292. }
  11293. window.setTimeout( process );
  11294. }
  11295. };
  11296. }
  11297. return jQuery.Deferred( function( newDefer ) {
  11298. // progress_handlers.add( ... )
  11299. tuples[ 0 ][ 3 ].add(
  11300. resolve(
  11301. 0,
  11302. newDefer,
  11303. isFunction( onProgress ) ?
  11304. onProgress :
  11305. Identity,
  11306. newDefer.notifyWith
  11307. )
  11308. );
  11309. // fulfilled_handlers.add( ... )
  11310. tuples[ 1 ][ 3 ].add(
  11311. resolve(
  11312. 0,
  11313. newDefer,
  11314. isFunction( onFulfilled ) ?
  11315. onFulfilled :
  11316. Identity
  11317. )
  11318. );
  11319. // rejected_handlers.add( ... )
  11320. tuples[ 2 ][ 3 ].add(
  11321. resolve(
  11322. 0,
  11323. newDefer,
  11324. isFunction( onRejected ) ?
  11325. onRejected :
  11326. Thrower
  11327. )
  11328. );
  11329. } ).promise();
  11330. },
  11331. // Get a promise for this deferred
  11332. // If obj is provided, the promise aspect is added to the object
  11333. promise: function( obj ) {
  11334. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11335. }
  11336. },
  11337. deferred = {};
  11338. // Add list-specific methods
  11339. jQuery.each( tuples, function( i, tuple ) {
  11340. var list = tuple[ 2 ],
  11341. stateString = tuple[ 5 ];
  11342. // promise.progress = list.add
  11343. // promise.done = list.add
  11344. // promise.fail = list.add
  11345. promise[ tuple[ 1 ] ] = list.add;
  11346. // Handle state
  11347. if ( stateString ) {
  11348. list.add(
  11349. function() {
  11350. // state = "resolved" (i.e., fulfilled)
  11351. // state = "rejected"
  11352. state = stateString;
  11353. },
  11354. // rejected_callbacks.disable
  11355. // fulfilled_callbacks.disable
  11356. tuples[ 3 - i ][ 2 ].disable,
  11357. // rejected_handlers.disable
  11358. // fulfilled_handlers.disable
  11359. tuples[ 3 - i ][ 3 ].disable,
  11360. // progress_callbacks.lock
  11361. tuples[ 0 ][ 2 ].lock,
  11362. // progress_handlers.lock
  11363. tuples[ 0 ][ 3 ].lock
  11364. );
  11365. }
  11366. // progress_handlers.fire
  11367. // fulfilled_handlers.fire
  11368. // rejected_handlers.fire
  11369. list.add( tuple[ 3 ].fire );
  11370. // deferred.notify = function() { deferred.notifyWith(...) }
  11371. // deferred.resolve = function() { deferred.resolveWith(...) }
  11372. // deferred.reject = function() { deferred.rejectWith(...) }
  11373. deferred[ tuple[ 0 ] ] = function() {
  11374. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11375. return this;
  11376. };
  11377. // deferred.notifyWith = list.fireWith
  11378. // deferred.resolveWith = list.fireWith
  11379. // deferred.rejectWith = list.fireWith
  11380. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11381. } );
  11382. // Make the deferred a promise
  11383. promise.promise( deferred );
  11384. // Call given func if any
  11385. if ( func ) {
  11386. func.call( deferred, deferred );
  11387. }
  11388. // All done!
  11389. return deferred;
  11390. },
  11391. // Deferred helper
  11392. when: function( singleValue ) {
  11393. var
  11394. // count of uncompleted subordinates
  11395. remaining = arguments.length,
  11396. // count of unprocessed arguments
  11397. i = remaining,
  11398. // subordinate fulfillment data
  11399. resolveContexts = Array( i ),
  11400. resolveValues = slice.call( arguments ),
  11401. // the master Deferred
  11402. master = jQuery.Deferred(),
  11403. // subordinate callback factory
  11404. updateFunc = function( i ) {
  11405. return function( value ) {
  11406. resolveContexts[ i ] = this;
  11407. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11408. if ( !( --remaining ) ) {
  11409. master.resolveWith( resolveContexts, resolveValues );
  11410. }
  11411. };
  11412. };
  11413. // Single- and empty arguments are adopted like Promise.resolve
  11414. if ( remaining <= 1 ) {
  11415. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11416. !remaining );
  11417. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11418. if ( master.state() === "pending" ||
  11419. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11420. return master.then();
  11421. }
  11422. }
  11423. // Multiple arguments are aggregated like Promise.all array elements
  11424. while ( i-- ) {
  11425. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11426. }
  11427. return master.promise();
  11428. }
  11429. } );
  11430. // These usually indicate a programmer mistake during development,
  11431. // warn about them ASAP rather than swallowing them by default.
  11432. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11433. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11434. // Support: IE 8 - 9 only
  11435. // Console exists when dev tools are open, which can happen at any time
  11436. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11437. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11438. }
  11439. };
  11440. jQuery.readyException = function( error ) {
  11441. window.setTimeout( function() {
  11442. throw error;
  11443. } );
  11444. };
  11445. // The deferred used on DOM ready
  11446. var readyList = jQuery.Deferred();
  11447. jQuery.fn.ready = function( fn ) {
  11448. readyList
  11449. .then( fn )
  11450. // Wrap jQuery.readyException in a function so that the lookup
  11451. // happens at the time of error handling instead of callback
  11452. // registration.
  11453. .catch( function( error ) {
  11454. jQuery.readyException( error );
  11455. } );
  11456. return this;
  11457. };
  11458. jQuery.extend( {
  11459. // Is the DOM ready to be used? Set to true once it occurs.
  11460. isReady: false,
  11461. // A counter to track how many items to wait for before
  11462. // the ready event fires. See #6781
  11463. readyWait: 1,
  11464. // Handle when the DOM is ready
  11465. ready: function( wait ) {
  11466. // Abort if there are pending holds or we're already ready
  11467. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11468. return;
  11469. }
  11470. // Remember that the DOM is ready
  11471. jQuery.isReady = true;
  11472. // If a normal DOM Ready event fired, decrement, and wait if need be
  11473. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11474. return;
  11475. }
  11476. // If there are functions bound, to execute
  11477. readyList.resolveWith( document, [ jQuery ] );
  11478. }
  11479. } );
  11480. jQuery.ready.then = readyList.then;
  11481. // The ready event handler and self cleanup method
  11482. function completed() {
  11483. document.removeEventListener( "DOMContentLoaded", completed );
  11484. window.removeEventListener( "load", completed );
  11485. jQuery.ready();
  11486. }
  11487. // Catch cases where $(document).ready() is called
  11488. // after the browser event has already occurred.
  11489. // Support: IE <=9 - 10 only
  11490. // Older IE sometimes signals "interactive" too soon
  11491. if ( document.readyState === "complete" ||
  11492. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11493. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11494. window.setTimeout( jQuery.ready );
  11495. } else {
  11496. // Use the handy event callback
  11497. document.addEventListener( "DOMContentLoaded", completed );
  11498. // A fallback to window.onload, that will always work
  11499. window.addEventListener( "load", completed );
  11500. }
  11501. // Multifunctional method to get and set values of a collection
  11502. // The value/s can optionally be executed if it's a function
  11503. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11504. var i = 0,
  11505. len = elems.length,
  11506. bulk = key == null;
  11507. // Sets many values
  11508. if ( toType( key ) === "object" ) {
  11509. chainable = true;
  11510. for ( i in key ) {
  11511. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11512. }
  11513. // Sets one value
  11514. } else if ( value !== undefined ) {
  11515. chainable = true;
  11516. if ( !isFunction( value ) ) {
  11517. raw = true;
  11518. }
  11519. if ( bulk ) {
  11520. // Bulk operations run against the entire set
  11521. if ( raw ) {
  11522. fn.call( elems, value );
  11523. fn = null;
  11524. // ...except when executing function values
  11525. } else {
  11526. bulk = fn;
  11527. fn = function( elem, key, value ) {
  11528. return bulk.call( jQuery( elem ), value );
  11529. };
  11530. }
  11531. }
  11532. if ( fn ) {
  11533. for ( ; i < len; i++ ) {
  11534. fn(
  11535. elems[ i ], key, raw ?
  11536. value :
  11537. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11538. );
  11539. }
  11540. }
  11541. }
  11542. if ( chainable ) {
  11543. return elems;
  11544. }
  11545. // Gets
  11546. if ( bulk ) {
  11547. return fn.call( elems );
  11548. }
  11549. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11550. };
  11551. // Matches dashed string for camelizing
  11552. var rmsPrefix = /^-ms-/,
  11553. rdashAlpha = /-([a-z])/g;
  11554. // Used by camelCase as callback to replace()
  11555. function fcamelCase( all, letter ) {
  11556. return letter.toUpperCase();
  11557. }
  11558. // Convert dashed to camelCase; used by the css and data modules
  11559. // Support: IE <=9 - 11, Edge 12 - 15
  11560. // Microsoft forgot to hump their vendor prefix (#9572)
  11561. function camelCase( string ) {
  11562. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11563. }
  11564. var acceptData = function( owner ) {
  11565. // Accepts only:
  11566. // - Node
  11567. // - Node.ELEMENT_NODE
  11568. // - Node.DOCUMENT_NODE
  11569. // - Object
  11570. // - Any
  11571. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11572. };
  11573. function Data() {
  11574. this.expando = jQuery.expando + Data.uid++;
  11575. }
  11576. Data.uid = 1;
  11577. Data.prototype = {
  11578. cache: function( owner ) {
  11579. // Check if the owner object already has a cache
  11580. var value = owner[ this.expando ];
  11581. // If not, create one
  11582. if ( !value ) {
  11583. value = {};
  11584. // We can accept data for non-element nodes in modern browsers,
  11585. // but we should not, see #8335.
  11586. // Always return an empty object.
  11587. if ( acceptData( owner ) ) {
  11588. // If it is a node unlikely to be stringify-ed or looped over
  11589. // use plain assignment
  11590. if ( owner.nodeType ) {
  11591. owner[ this.expando ] = value;
  11592. // Otherwise secure it in a non-enumerable property
  11593. // configurable must be true to allow the property to be
  11594. // deleted when data is removed
  11595. } else {
  11596. Object.defineProperty( owner, this.expando, {
  11597. value: value,
  11598. configurable: true
  11599. } );
  11600. }
  11601. }
  11602. }
  11603. return value;
  11604. },
  11605. set: function( owner, data, value ) {
  11606. var prop,
  11607. cache = this.cache( owner );
  11608. // Handle: [ owner, key, value ] args
  11609. // Always use camelCase key (gh-2257)
  11610. if ( typeof data === "string" ) {
  11611. cache[ camelCase( data ) ] = value;
  11612. // Handle: [ owner, { properties } ] args
  11613. } else {
  11614. // Copy the properties one-by-one to the cache object
  11615. for ( prop in data ) {
  11616. cache[ camelCase( prop ) ] = data[ prop ];
  11617. }
  11618. }
  11619. return cache;
  11620. },
  11621. get: function( owner, key ) {
  11622. return key === undefined ?
  11623. this.cache( owner ) :
  11624. // Always use camelCase key (gh-2257)
  11625. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11626. },
  11627. access: function( owner, key, value ) {
  11628. // In cases where either:
  11629. //
  11630. // 1. No key was specified
  11631. // 2. A string key was specified, but no value provided
  11632. //
  11633. // Take the "read" path and allow the get method to determine
  11634. // which value to return, respectively either:
  11635. //
  11636. // 1. The entire cache object
  11637. // 2. The data stored at the key
  11638. //
  11639. if ( key === undefined ||
  11640. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11641. return this.get( owner, key );
  11642. }
  11643. // When the key is not a string, or both a key and value
  11644. // are specified, set or extend (existing objects) with either:
  11645. //
  11646. // 1. An object of properties
  11647. // 2. A key and value
  11648. //
  11649. this.set( owner, key, value );
  11650. // Since the "set" path can have two possible entry points
  11651. // return the expected data based on which path was taken[*]
  11652. return value !== undefined ? value : key;
  11653. },
  11654. remove: function( owner, key ) {
  11655. var i,
  11656. cache = owner[ this.expando ];
  11657. if ( cache === undefined ) {
  11658. return;
  11659. }
  11660. if ( key !== undefined ) {
  11661. // Support array or space separated string of keys
  11662. if ( Array.isArray( key ) ) {
  11663. // If key is an array of keys...
  11664. // We always set camelCase keys, so remove that.
  11665. key = key.map( camelCase );
  11666. } else {
  11667. key = camelCase( key );
  11668. // If a key with the spaces exists, use it.
  11669. // Otherwise, create an array by matching non-whitespace
  11670. key = key in cache ?
  11671. [ key ] :
  11672. ( key.match( rnothtmlwhite ) || [] );
  11673. }
  11674. i = key.length;
  11675. while ( i-- ) {
  11676. delete cache[ key[ i ] ];
  11677. }
  11678. }
  11679. // Remove the expando if there's no more data
  11680. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11681. // Support: Chrome <=35 - 45
  11682. // Webkit & Blink performance suffers when deleting properties
  11683. // from DOM nodes, so set to undefined instead
  11684. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11685. if ( owner.nodeType ) {
  11686. owner[ this.expando ] = undefined;
  11687. } else {
  11688. delete owner[ this.expando ];
  11689. }
  11690. }
  11691. },
  11692. hasData: function( owner ) {
  11693. var cache = owner[ this.expando ];
  11694. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11695. }
  11696. };
  11697. var dataPriv = new Data();
  11698. var dataUser = new Data();
  11699. // Implementation Summary
  11700. //
  11701. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11702. // 2. Improve the module's maintainability by reducing the storage
  11703. // paths to a single mechanism.
  11704. // 3. Use the same single mechanism to support "private" and "user" data.
  11705. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11706. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11707. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11708. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11709. rmultiDash = /[A-Z]/g;
  11710. function getData( data ) {
  11711. if ( data === "true" ) {
  11712. return true;
  11713. }
  11714. if ( data === "false" ) {
  11715. return false;
  11716. }
  11717. if ( data === "null" ) {
  11718. return null;
  11719. }
  11720. // Only convert to a number if it doesn't change the string
  11721. if ( data === +data + "" ) {
  11722. return +data;
  11723. }
  11724. if ( rbrace.test( data ) ) {
  11725. return JSON.parse( data );
  11726. }
  11727. return data;
  11728. }
  11729. function dataAttr( elem, key, data ) {
  11730. var name;
  11731. // If nothing was found internally, try to fetch any
  11732. // data from the HTML5 data-* attribute
  11733. if ( data === undefined && elem.nodeType === 1 ) {
  11734. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  11735. data = elem.getAttribute( name );
  11736. if ( typeof data === "string" ) {
  11737. try {
  11738. data = getData( data );
  11739. } catch ( e ) {}
  11740. // Make sure we set the data so it isn't changed later
  11741. dataUser.set( elem, key, data );
  11742. } else {
  11743. data = undefined;
  11744. }
  11745. }
  11746. return data;
  11747. }
  11748. jQuery.extend( {
  11749. hasData: function( elem ) {
  11750. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  11751. },
  11752. data: function( elem, name, data ) {
  11753. return dataUser.access( elem, name, data );
  11754. },
  11755. removeData: function( elem, name ) {
  11756. dataUser.remove( elem, name );
  11757. },
  11758. // TODO: Now that all calls to _data and _removeData have been replaced
  11759. // with direct calls to dataPriv methods, these can be deprecated.
  11760. _data: function( elem, name, data ) {
  11761. return dataPriv.access( elem, name, data );
  11762. },
  11763. _removeData: function( elem, name ) {
  11764. dataPriv.remove( elem, name );
  11765. }
  11766. } );
  11767. jQuery.fn.extend( {
  11768. data: function( key, value ) {
  11769. var i, name, data,
  11770. elem = this[ 0 ],
  11771. attrs = elem && elem.attributes;
  11772. // Gets all values
  11773. if ( key === undefined ) {
  11774. if ( this.length ) {
  11775. data = dataUser.get( elem );
  11776. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  11777. i = attrs.length;
  11778. while ( i-- ) {
  11779. // Support: IE 11 only
  11780. // The attrs elements can be null (#14894)
  11781. if ( attrs[ i ] ) {
  11782. name = attrs[ i ].name;
  11783. if ( name.indexOf( "data-" ) === 0 ) {
  11784. name = camelCase( name.slice( 5 ) );
  11785. dataAttr( elem, name, data[ name ] );
  11786. }
  11787. }
  11788. }
  11789. dataPriv.set( elem, "hasDataAttrs", true );
  11790. }
  11791. }
  11792. return data;
  11793. }
  11794. // Sets multiple values
  11795. if ( typeof key === "object" ) {
  11796. return this.each( function() {
  11797. dataUser.set( this, key );
  11798. } );
  11799. }
  11800. return access( this, function( value ) {
  11801. var data;
  11802. // The calling jQuery object (element matches) is not empty
  11803. // (and therefore has an element appears at this[ 0 ]) and the
  11804. // `value` parameter was not undefined. An empty jQuery object
  11805. // will result in `undefined` for elem = this[ 0 ] which will
  11806. // throw an exception if an attempt to read a data cache is made.
  11807. if ( elem && value === undefined ) {
  11808. // Attempt to get data from the cache
  11809. // The key will always be camelCased in Data
  11810. data = dataUser.get( elem, key );
  11811. if ( data !== undefined ) {
  11812. return data;
  11813. }
  11814. // Attempt to "discover" the data in
  11815. // HTML5 custom data-* attrs
  11816. data = dataAttr( elem, key );
  11817. if ( data !== undefined ) {
  11818. return data;
  11819. }
  11820. // We tried really hard, but the data doesn't exist.
  11821. return;
  11822. }
  11823. // Set the data...
  11824. this.each( function() {
  11825. // We always store the camelCased key
  11826. dataUser.set( this, key, value );
  11827. } );
  11828. }, null, value, arguments.length > 1, null, true );
  11829. },
  11830. removeData: function( key ) {
  11831. return this.each( function() {
  11832. dataUser.remove( this, key );
  11833. } );
  11834. }
  11835. } );
  11836. jQuery.extend( {
  11837. queue: function( elem, type, data ) {
  11838. var queue;
  11839. if ( elem ) {
  11840. type = ( type || "fx" ) + "queue";
  11841. queue = dataPriv.get( elem, type );
  11842. // Speed up dequeue by getting out quickly if this is just a lookup
  11843. if ( data ) {
  11844. if ( !queue || Array.isArray( data ) ) {
  11845. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  11846. } else {
  11847. queue.push( data );
  11848. }
  11849. }
  11850. return queue || [];
  11851. }
  11852. },
  11853. dequeue: function( elem, type ) {
  11854. type = type || "fx";
  11855. var queue = jQuery.queue( elem, type ),
  11856. startLength = queue.length,
  11857. fn = queue.shift(),
  11858. hooks = jQuery._queueHooks( elem, type ),
  11859. next = function() {
  11860. jQuery.dequeue( elem, type );
  11861. };
  11862. // If the fx queue is dequeued, always remove the progress sentinel
  11863. if ( fn === "inprogress" ) {
  11864. fn = queue.shift();
  11865. startLength--;
  11866. }
  11867. if ( fn ) {
  11868. // Add a progress sentinel to prevent the fx queue from being
  11869. // automatically dequeued
  11870. if ( type === "fx" ) {
  11871. queue.unshift( "inprogress" );
  11872. }
  11873. // Clear up the last queue stop function
  11874. delete hooks.stop;
  11875. fn.call( elem, next, hooks );
  11876. }
  11877. if ( !startLength && hooks ) {
  11878. hooks.empty.fire();
  11879. }
  11880. },
  11881. // Not public - generate a queueHooks object, or return the current one
  11882. _queueHooks: function( elem, type ) {
  11883. var key = type + "queueHooks";
  11884. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  11885. empty: jQuery.Callbacks( "once memory" ).add( function() {
  11886. dataPriv.remove( elem, [ type + "queue", key ] );
  11887. } )
  11888. } );
  11889. }
  11890. } );
  11891. jQuery.fn.extend( {
  11892. queue: function( type, data ) {
  11893. var setter = 2;
  11894. if ( typeof type !== "string" ) {
  11895. data = type;
  11896. type = "fx";
  11897. setter--;
  11898. }
  11899. if ( arguments.length < setter ) {
  11900. return jQuery.queue( this[ 0 ], type );
  11901. }
  11902. return data === undefined ?
  11903. this :
  11904. this.each( function() {
  11905. var queue = jQuery.queue( this, type, data );
  11906. // Ensure a hooks for this queue
  11907. jQuery._queueHooks( this, type );
  11908. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  11909. jQuery.dequeue( this, type );
  11910. }
  11911. } );
  11912. },
  11913. dequeue: function( type ) {
  11914. return this.each( function() {
  11915. jQuery.dequeue( this, type );
  11916. } );
  11917. },
  11918. clearQueue: function( type ) {
  11919. return this.queue( type || "fx", [] );
  11920. },
  11921. // Get a promise resolved when queues of a certain type
  11922. // are emptied (fx is the type by default)
  11923. promise: function( type, obj ) {
  11924. var tmp,
  11925. count = 1,
  11926. defer = jQuery.Deferred(),
  11927. elements = this,
  11928. i = this.length,
  11929. resolve = function() {
  11930. if ( !( --count ) ) {
  11931. defer.resolveWith( elements, [ elements ] );
  11932. }
  11933. };
  11934. if ( typeof type !== "string" ) {
  11935. obj = type;
  11936. type = undefined;
  11937. }
  11938. type = type || "fx";
  11939. while ( i-- ) {
  11940. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  11941. if ( tmp && tmp.empty ) {
  11942. count++;
  11943. tmp.empty.add( resolve );
  11944. }
  11945. }
  11946. resolve();
  11947. return defer.promise( obj );
  11948. }
  11949. } );
  11950. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  11951. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  11952. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  11953. var documentElement = document.documentElement;
  11954. var isAttached = function( elem ) {
  11955. return jQuery.contains( elem.ownerDocument, elem );
  11956. },
  11957. composed = { composed: true };
  11958. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  11959. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  11960. // Support: iOS 10.0-10.2 only
  11961. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  11962. // leading to errors. We need to check for `getRootNode`.
  11963. if ( documentElement.getRootNode ) {
  11964. isAttached = function( elem ) {
  11965. return jQuery.contains( elem.ownerDocument, elem ) ||
  11966. elem.getRootNode( composed ) === elem.ownerDocument;
  11967. };
  11968. }
  11969. var isHiddenWithinTree = function( elem, el ) {
  11970. // isHiddenWithinTree might be called from jQuery#filter function;
  11971. // in that case, element will be second argument
  11972. elem = el || elem;
  11973. // Inline style trumps all
  11974. return elem.style.display === "none" ||
  11975. elem.style.display === "" &&
  11976. // Otherwise, check computed style
  11977. // Support: Firefox <=43 - 45
  11978. // Disconnected elements can have computed display: none, so first confirm that elem is
  11979. // in the document.
  11980. isAttached( elem ) &&
  11981. jQuery.css( elem, "display" ) === "none";
  11982. };
  11983. var swap = function( elem, options, callback, args ) {
  11984. var ret, name,
  11985. old = {};
  11986. // Remember the old values, and insert the new ones
  11987. for ( name in options ) {
  11988. old[ name ] = elem.style[ name ];
  11989. elem.style[ name ] = options[ name ];
  11990. }
  11991. ret = callback.apply( elem, args || [] );
  11992. // Revert the old values
  11993. for ( name in options ) {
  11994. elem.style[ name ] = old[ name ];
  11995. }
  11996. return ret;
  11997. };
  11998. function adjustCSS( elem, prop, valueParts, tween ) {
  11999. var adjusted, scale,
  12000. maxIterations = 20,
  12001. currentValue = tween ?
  12002. function() {
  12003. return tween.cur();
  12004. } :
  12005. function() {
  12006. return jQuery.css( elem, prop, "" );
  12007. },
  12008. initial = currentValue(),
  12009. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12010. // Starting value computation is required for potential unit mismatches
  12011. initialInUnit = elem.nodeType &&
  12012. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12013. rcssNum.exec( jQuery.css( elem, prop ) );
  12014. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12015. // Support: Firefox <=54
  12016. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12017. initial = initial / 2;
  12018. // Trust units reported by jQuery.css
  12019. unit = unit || initialInUnit[ 3 ];
  12020. // Iteratively approximate from a nonzero starting point
  12021. initialInUnit = +initial || 1;
  12022. while ( maxIterations-- ) {
  12023. // Evaluate and update our best guess (doubling guesses that zero out).
  12024. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12025. jQuery.style( elem, prop, initialInUnit + unit );
  12026. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12027. maxIterations = 0;
  12028. }
  12029. initialInUnit = initialInUnit / scale;
  12030. }
  12031. initialInUnit = initialInUnit * 2;
  12032. jQuery.style( elem, prop, initialInUnit + unit );
  12033. // Make sure we update the tween properties later on
  12034. valueParts = valueParts || [];
  12035. }
  12036. if ( valueParts ) {
  12037. initialInUnit = +initialInUnit || +initial || 0;
  12038. // Apply relative offset (+=/-=) if specified
  12039. adjusted = valueParts[ 1 ] ?
  12040. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12041. +valueParts[ 2 ];
  12042. if ( tween ) {
  12043. tween.unit = unit;
  12044. tween.start = initialInUnit;
  12045. tween.end = adjusted;
  12046. }
  12047. }
  12048. return adjusted;
  12049. }
  12050. var defaultDisplayMap = {};
  12051. function getDefaultDisplay( elem ) {
  12052. var temp,
  12053. doc = elem.ownerDocument,
  12054. nodeName = elem.nodeName,
  12055. display = defaultDisplayMap[ nodeName ];
  12056. if ( display ) {
  12057. return display;
  12058. }
  12059. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12060. display = jQuery.css( temp, "display" );
  12061. temp.parentNode.removeChild( temp );
  12062. if ( display === "none" ) {
  12063. display = "block";
  12064. }
  12065. defaultDisplayMap[ nodeName ] = display;
  12066. return display;
  12067. }
  12068. function showHide( elements, show ) {
  12069. var display, elem,
  12070. values = [],
  12071. index = 0,
  12072. length = elements.length;
  12073. // Determine new display value for elements that need to change
  12074. for ( ; index < length; index++ ) {
  12075. elem = elements[ index ];
  12076. if ( !elem.style ) {
  12077. continue;
  12078. }
  12079. display = elem.style.display;
  12080. if ( show ) {
  12081. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12082. // check is required in this first loop unless we have a nonempty display value (either
  12083. // inline or about-to-be-restored)
  12084. if ( display === "none" ) {
  12085. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12086. if ( !values[ index ] ) {
  12087. elem.style.display = "";
  12088. }
  12089. }
  12090. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12091. values[ index ] = getDefaultDisplay( elem );
  12092. }
  12093. } else {
  12094. if ( display !== "none" ) {
  12095. values[ index ] = "none";
  12096. // Remember what we're overwriting
  12097. dataPriv.set( elem, "display", display );
  12098. }
  12099. }
  12100. }
  12101. // Set the display of the elements in a second loop to avoid constant reflow
  12102. for ( index = 0; index < length; index++ ) {
  12103. if ( values[ index ] != null ) {
  12104. elements[ index ].style.display = values[ index ];
  12105. }
  12106. }
  12107. return elements;
  12108. }
  12109. jQuery.fn.extend( {
  12110. show: function() {
  12111. return showHide( this, true );
  12112. },
  12113. hide: function() {
  12114. return showHide( this );
  12115. },
  12116. toggle: function( state ) {
  12117. if ( typeof state === "boolean" ) {
  12118. return state ? this.show() : this.hide();
  12119. }
  12120. return this.each( function() {
  12121. if ( isHiddenWithinTree( this ) ) {
  12122. jQuery( this ).show();
  12123. } else {
  12124. jQuery( this ).hide();
  12125. }
  12126. } );
  12127. }
  12128. } );
  12129. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12130. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12131. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12132. // We have to close these tags to support XHTML (#13200)
  12133. var wrapMap = {
  12134. // Support: IE <=9 only
  12135. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12136. // XHTML parsers do not magically insert elements in the
  12137. // same way that tag soup parsers do. So we cannot shorten
  12138. // this by omitting <tbody> or other required elements.
  12139. thead: [ 1, "<table>", "</table>" ],
  12140. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12141. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12142. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12143. _default: [ 0, "", "" ]
  12144. };
  12145. // Support: IE <=9 only
  12146. wrapMap.optgroup = wrapMap.option;
  12147. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12148. wrapMap.th = wrapMap.td;
  12149. function getAll( context, tag ) {
  12150. // Support: IE <=9 - 11 only
  12151. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12152. var ret;
  12153. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12154. ret = context.getElementsByTagName( tag || "*" );
  12155. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12156. ret = context.querySelectorAll( tag || "*" );
  12157. } else {
  12158. ret = [];
  12159. }
  12160. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12161. return jQuery.merge( [ context ], ret );
  12162. }
  12163. return ret;
  12164. }
  12165. // Mark scripts as having already been evaluated
  12166. function setGlobalEval( elems, refElements ) {
  12167. var i = 0,
  12168. l = elems.length;
  12169. for ( ; i < l; i++ ) {
  12170. dataPriv.set(
  12171. elems[ i ],
  12172. "globalEval",
  12173. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12174. );
  12175. }
  12176. }
  12177. var rhtml = /<|&#?\w+;/;
  12178. function buildFragment( elems, context, scripts, selection, ignored ) {
  12179. var elem, tmp, tag, wrap, attached, j,
  12180. fragment = context.createDocumentFragment(),
  12181. nodes = [],
  12182. i = 0,
  12183. l = elems.length;
  12184. for ( ; i < l; i++ ) {
  12185. elem = elems[ i ];
  12186. if ( elem || elem === 0 ) {
  12187. // Add nodes directly
  12188. if ( toType( elem ) === "object" ) {
  12189. // Support: Android <=4.0 only, PhantomJS 1 only
  12190. // push.apply(_, arraylike) throws on ancient WebKit
  12191. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12192. // Convert non-html into a text node
  12193. } else if ( !rhtml.test( elem ) ) {
  12194. nodes.push( context.createTextNode( elem ) );
  12195. // Convert html into DOM nodes
  12196. } else {
  12197. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12198. // Deserialize a standard representation
  12199. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12200. wrap = wrapMap[ tag ] || wrapMap._default;
  12201. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12202. // Descend through wrappers to the right content
  12203. j = wrap[ 0 ];
  12204. while ( j-- ) {
  12205. tmp = tmp.lastChild;
  12206. }
  12207. // Support: Android <=4.0 only, PhantomJS 1 only
  12208. // push.apply(_, arraylike) throws on ancient WebKit
  12209. jQuery.merge( nodes, tmp.childNodes );
  12210. // Remember the top-level container
  12211. tmp = fragment.firstChild;
  12212. // Ensure the created nodes are orphaned (#12392)
  12213. tmp.textContent = "";
  12214. }
  12215. }
  12216. }
  12217. // Remove wrapper from fragment
  12218. fragment.textContent = "";
  12219. i = 0;
  12220. while ( ( elem = nodes[ i++ ] ) ) {
  12221. // Skip elements already in the context collection (trac-4087)
  12222. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12223. if ( ignored ) {
  12224. ignored.push( elem );
  12225. }
  12226. continue;
  12227. }
  12228. attached = isAttached( elem );
  12229. // Append to fragment
  12230. tmp = getAll( fragment.appendChild( elem ), "script" );
  12231. // Preserve script evaluation history
  12232. if ( attached ) {
  12233. setGlobalEval( tmp );
  12234. }
  12235. // Capture executables
  12236. if ( scripts ) {
  12237. j = 0;
  12238. while ( ( elem = tmp[ j++ ] ) ) {
  12239. if ( rscriptType.test( elem.type || "" ) ) {
  12240. scripts.push( elem );
  12241. }
  12242. }
  12243. }
  12244. }
  12245. return fragment;
  12246. }
  12247. ( function() {
  12248. var fragment = document.createDocumentFragment(),
  12249. div = fragment.appendChild( document.createElement( "div" ) ),
  12250. input = document.createElement( "input" );
  12251. // Support: Android 4.0 - 4.3 only
  12252. // Check state lost if the name is set (#11217)
  12253. // Support: Windows Web Apps (WWA)
  12254. // `name` and `type` must use .setAttribute for WWA (#14901)
  12255. input.setAttribute( "type", "radio" );
  12256. input.setAttribute( "checked", "checked" );
  12257. input.setAttribute( "name", "t" );
  12258. div.appendChild( input );
  12259. // Support: Android <=4.1 only
  12260. // Older WebKit doesn't clone checked state correctly in fragments
  12261. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12262. // Support: IE <=11 only
  12263. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12264. div.innerHTML = "<textarea>x</textarea>";
  12265. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12266. } )();
  12267. var
  12268. rkeyEvent = /^key/,
  12269. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12270. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12271. function returnTrue() {
  12272. return true;
  12273. }
  12274. function returnFalse() {
  12275. return false;
  12276. }
  12277. // Support: IE <=9 - 11+
  12278. // focus() and blur() are asynchronous, except when they are no-op.
  12279. // So expect focus to be synchronous when the element is already active,
  12280. // and blur to be synchronous when the element is not already active.
  12281. // (focus and blur are always synchronous in other supported browsers,
  12282. // this just defines when we can count on it).
  12283. function expectSync( elem, type ) {
  12284. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12285. }
  12286. // Support: IE <=9 only
  12287. // Accessing document.activeElement can throw unexpectedly
  12288. // https://bugs.jquery.com/ticket/13393
  12289. function safeActiveElement() {
  12290. try {
  12291. return document.activeElement;
  12292. } catch ( err ) { }
  12293. }
  12294. function on( elem, types, selector, data, fn, one ) {
  12295. var origFn, type;
  12296. // Types can be a map of types/handlers
  12297. if ( typeof types === "object" ) {
  12298. // ( types-Object, selector, data )
  12299. if ( typeof selector !== "string" ) {
  12300. // ( types-Object, data )
  12301. data = data || selector;
  12302. selector = undefined;
  12303. }
  12304. for ( type in types ) {
  12305. on( elem, type, selector, data, types[ type ], one );
  12306. }
  12307. return elem;
  12308. }
  12309. if ( data == null && fn == null ) {
  12310. // ( types, fn )
  12311. fn = selector;
  12312. data = selector = undefined;
  12313. } else if ( fn == null ) {
  12314. if ( typeof selector === "string" ) {
  12315. // ( types, selector, fn )
  12316. fn = data;
  12317. data = undefined;
  12318. } else {
  12319. // ( types, data, fn )
  12320. fn = data;
  12321. data = selector;
  12322. selector = undefined;
  12323. }
  12324. }
  12325. if ( fn === false ) {
  12326. fn = returnFalse;
  12327. } else if ( !fn ) {
  12328. return elem;
  12329. }
  12330. if ( one === 1 ) {
  12331. origFn = fn;
  12332. fn = function( event ) {
  12333. // Can use an empty set, since event contains the info
  12334. jQuery().off( event );
  12335. return origFn.apply( this, arguments );
  12336. };
  12337. // Use same guid so caller can remove using origFn
  12338. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12339. }
  12340. return elem.each( function() {
  12341. jQuery.event.add( this, types, fn, data, selector );
  12342. } );
  12343. }
  12344. /*
  12345. * Helper functions for managing events -- not part of the public interface.
  12346. * Props to Dean Edwards' addEvent library for many of the ideas.
  12347. */
  12348. jQuery.event = {
  12349. global: {},
  12350. add: function( elem, types, handler, data, selector ) {
  12351. var handleObjIn, eventHandle, tmp,
  12352. events, t, handleObj,
  12353. special, handlers, type, namespaces, origType,
  12354. elemData = dataPriv.get( elem );
  12355. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12356. if ( !elemData ) {
  12357. return;
  12358. }
  12359. // Caller can pass in an object of custom data in lieu of the handler
  12360. if ( handler.handler ) {
  12361. handleObjIn = handler;
  12362. handler = handleObjIn.handler;
  12363. selector = handleObjIn.selector;
  12364. }
  12365. // Ensure that invalid selectors throw exceptions at attach time
  12366. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12367. if ( selector ) {
  12368. jQuery.find.matchesSelector( documentElement, selector );
  12369. }
  12370. // Make sure that the handler has a unique ID, used to find/remove it later
  12371. if ( !handler.guid ) {
  12372. handler.guid = jQuery.guid++;
  12373. }
  12374. // Init the element's event structure and main handler, if this is the first
  12375. if ( !( events = elemData.events ) ) {
  12376. events = elemData.events = {};
  12377. }
  12378. if ( !( eventHandle = elemData.handle ) ) {
  12379. eventHandle = elemData.handle = function( e ) {
  12380. // Discard the second event of a jQuery.event.trigger() and
  12381. // when an event is called after a page has unloaded
  12382. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12383. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12384. };
  12385. }
  12386. // Handle multiple events separated by a space
  12387. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12388. t = types.length;
  12389. while ( t-- ) {
  12390. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12391. type = origType = tmp[ 1 ];
  12392. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12393. // There *must* be a type, no attaching namespace-only handlers
  12394. if ( !type ) {
  12395. continue;
  12396. }
  12397. // If event changes its type, use the special event handlers for the changed type
  12398. special = jQuery.event.special[ type ] || {};
  12399. // If selector defined, determine special event api type, otherwise given type
  12400. type = ( selector ? special.delegateType : special.bindType ) || type;
  12401. // Update special based on newly reset type
  12402. special = jQuery.event.special[ type ] || {};
  12403. // handleObj is passed to all event handlers
  12404. handleObj = jQuery.extend( {
  12405. type: type,
  12406. origType: origType,
  12407. data: data,
  12408. handler: handler,
  12409. guid: handler.guid,
  12410. selector: selector,
  12411. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12412. namespace: namespaces.join( "." )
  12413. }, handleObjIn );
  12414. // Init the event handler queue if we're the first
  12415. if ( !( handlers = events[ type ] ) ) {
  12416. handlers = events[ type ] = [];
  12417. handlers.delegateCount = 0;
  12418. // Only use addEventListener if the special events handler returns false
  12419. if ( !special.setup ||
  12420. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12421. if ( elem.addEventListener ) {
  12422. elem.addEventListener( type, eventHandle );
  12423. }
  12424. }
  12425. }
  12426. if ( special.add ) {
  12427. special.add.call( elem, handleObj );
  12428. if ( !handleObj.handler.guid ) {
  12429. handleObj.handler.guid = handler.guid;
  12430. }
  12431. }
  12432. // Add to the element's handler list, delegates in front
  12433. if ( selector ) {
  12434. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12435. } else {
  12436. handlers.push( handleObj );
  12437. }
  12438. // Keep track of which events have ever been used, for event optimization
  12439. jQuery.event.global[ type ] = true;
  12440. }
  12441. },
  12442. // Detach an event or set of events from an element
  12443. remove: function( elem, types, handler, selector, mappedTypes ) {
  12444. var j, origCount, tmp,
  12445. events, t, handleObj,
  12446. special, handlers, type, namespaces, origType,
  12447. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12448. if ( !elemData || !( events = elemData.events ) ) {
  12449. return;
  12450. }
  12451. // Once for each type.namespace in types; type may be omitted
  12452. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12453. t = types.length;
  12454. while ( t-- ) {
  12455. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12456. type = origType = tmp[ 1 ];
  12457. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12458. // Unbind all events (on this namespace, if provided) for the element
  12459. if ( !type ) {
  12460. for ( type in events ) {
  12461. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12462. }
  12463. continue;
  12464. }
  12465. special = jQuery.event.special[ type ] || {};
  12466. type = ( selector ? special.delegateType : special.bindType ) || type;
  12467. handlers = events[ type ] || [];
  12468. tmp = tmp[ 2 ] &&
  12469. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12470. // Remove matching events
  12471. origCount = j = handlers.length;
  12472. while ( j-- ) {
  12473. handleObj = handlers[ j ];
  12474. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12475. ( !handler || handler.guid === handleObj.guid ) &&
  12476. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12477. ( !selector || selector === handleObj.selector ||
  12478. selector === "**" && handleObj.selector ) ) {
  12479. handlers.splice( j, 1 );
  12480. if ( handleObj.selector ) {
  12481. handlers.delegateCount--;
  12482. }
  12483. if ( special.remove ) {
  12484. special.remove.call( elem, handleObj );
  12485. }
  12486. }
  12487. }
  12488. // Remove generic event handler if we removed something and no more handlers exist
  12489. // (avoids potential for endless recursion during removal of special event handlers)
  12490. if ( origCount && !handlers.length ) {
  12491. if ( !special.teardown ||
  12492. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12493. jQuery.removeEvent( elem, type, elemData.handle );
  12494. }
  12495. delete events[ type ];
  12496. }
  12497. }
  12498. // Remove data and the expando if it's no longer used
  12499. if ( jQuery.isEmptyObject( events ) ) {
  12500. dataPriv.remove( elem, "handle events" );
  12501. }
  12502. },
  12503. dispatch: function( nativeEvent ) {
  12504. // Make a writable jQuery.Event from the native event object
  12505. var event = jQuery.event.fix( nativeEvent );
  12506. var i, j, ret, matched, handleObj, handlerQueue,
  12507. args = new Array( arguments.length ),
  12508. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12509. special = jQuery.event.special[ event.type ] || {};
  12510. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12511. args[ 0 ] = event;
  12512. for ( i = 1; i < arguments.length; i++ ) {
  12513. args[ i ] = arguments[ i ];
  12514. }
  12515. event.delegateTarget = this;
  12516. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12517. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12518. return;
  12519. }
  12520. // Determine handlers
  12521. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12522. // Run delegates first; they may want to stop propagation beneath us
  12523. i = 0;
  12524. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12525. event.currentTarget = matched.elem;
  12526. j = 0;
  12527. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12528. !event.isImmediatePropagationStopped() ) {
  12529. // If the event is namespaced, then each handler is only invoked if it is
  12530. // specially universal or its namespaces are a superset of the event's.
  12531. if ( !event.rnamespace || handleObj.namespace === false ||
  12532. event.rnamespace.test( handleObj.namespace ) ) {
  12533. event.handleObj = handleObj;
  12534. event.data = handleObj.data;
  12535. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12536. handleObj.handler ).apply( matched.elem, args );
  12537. if ( ret !== undefined ) {
  12538. if ( ( event.result = ret ) === false ) {
  12539. event.preventDefault();
  12540. event.stopPropagation();
  12541. }
  12542. }
  12543. }
  12544. }
  12545. }
  12546. // Call the postDispatch hook for the mapped type
  12547. if ( special.postDispatch ) {
  12548. special.postDispatch.call( this, event );
  12549. }
  12550. return event.result;
  12551. },
  12552. handlers: function( event, handlers ) {
  12553. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12554. handlerQueue = [],
  12555. delegateCount = handlers.delegateCount,
  12556. cur = event.target;
  12557. // Find delegate handlers
  12558. if ( delegateCount &&
  12559. // Support: IE <=9
  12560. // Black-hole SVG <use> instance trees (trac-13180)
  12561. cur.nodeType &&
  12562. // Support: Firefox <=42
  12563. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12564. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12565. // Support: IE 11 only
  12566. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12567. !( event.type === "click" && event.button >= 1 ) ) {
  12568. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12569. // Don't check non-elements (#13208)
  12570. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12571. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12572. matchedHandlers = [];
  12573. matchedSelectors = {};
  12574. for ( i = 0; i < delegateCount; i++ ) {
  12575. handleObj = handlers[ i ];
  12576. // Don't conflict with Object.prototype properties (#13203)
  12577. sel = handleObj.selector + " ";
  12578. if ( matchedSelectors[ sel ] === undefined ) {
  12579. matchedSelectors[ sel ] = handleObj.needsContext ?
  12580. jQuery( sel, this ).index( cur ) > -1 :
  12581. jQuery.find( sel, this, null, [ cur ] ).length;
  12582. }
  12583. if ( matchedSelectors[ sel ] ) {
  12584. matchedHandlers.push( handleObj );
  12585. }
  12586. }
  12587. if ( matchedHandlers.length ) {
  12588. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12589. }
  12590. }
  12591. }
  12592. }
  12593. // Add the remaining (directly-bound) handlers
  12594. cur = this;
  12595. if ( delegateCount < handlers.length ) {
  12596. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12597. }
  12598. return handlerQueue;
  12599. },
  12600. addProp: function( name, hook ) {
  12601. Object.defineProperty( jQuery.Event.prototype, name, {
  12602. enumerable: true,
  12603. configurable: true,
  12604. get: isFunction( hook ) ?
  12605. function() {
  12606. if ( this.originalEvent ) {
  12607. return hook( this.originalEvent );
  12608. }
  12609. } :
  12610. function() {
  12611. if ( this.originalEvent ) {
  12612. return this.originalEvent[ name ];
  12613. }
  12614. },
  12615. set: function( value ) {
  12616. Object.defineProperty( this, name, {
  12617. enumerable: true,
  12618. configurable: true,
  12619. writable: true,
  12620. value: value
  12621. } );
  12622. }
  12623. } );
  12624. },
  12625. fix: function( originalEvent ) {
  12626. return originalEvent[ jQuery.expando ] ?
  12627. originalEvent :
  12628. new jQuery.Event( originalEvent );
  12629. },
  12630. special: {
  12631. load: {
  12632. // Prevent triggered image.load events from bubbling to window.load
  12633. noBubble: true
  12634. },
  12635. click: {
  12636. // Utilize native event to ensure correct state for checkable inputs
  12637. setup: function( data ) {
  12638. // For mutual compressibility with _default, replace `this` access with a local var.
  12639. // `|| data` is dead code meant only to preserve the variable through minification.
  12640. var el = this || data;
  12641. // Claim the first handler
  12642. if ( rcheckableType.test( el.type ) &&
  12643. el.click && nodeName( el, "input" ) ) {
  12644. // dataPriv.set( el, "click", ... )
  12645. leverageNative( el, "click", returnTrue );
  12646. }
  12647. // Return false to allow normal processing in the caller
  12648. return false;
  12649. },
  12650. trigger: function( data ) {
  12651. // For mutual compressibility with _default, replace `this` access with a local var.
  12652. // `|| data` is dead code meant only to preserve the variable through minification.
  12653. var el = this || data;
  12654. // Force setup before triggering a click
  12655. if ( rcheckableType.test( el.type ) &&
  12656. el.click && nodeName( el, "input" ) ) {
  12657. leverageNative( el, "click" );
  12658. }
  12659. // Return non-false to allow normal event-path propagation
  12660. return true;
  12661. },
  12662. // For cross-browser consistency, suppress native .click() on links
  12663. // Also prevent it if we're currently inside a leveraged native-event stack
  12664. _default: function( event ) {
  12665. var target = event.target;
  12666. return rcheckableType.test( target.type ) &&
  12667. target.click && nodeName( target, "input" ) &&
  12668. dataPriv.get( target, "click" ) ||
  12669. nodeName( target, "a" );
  12670. }
  12671. },
  12672. beforeunload: {
  12673. postDispatch: function( event ) {
  12674. // Support: Firefox 20+
  12675. // Firefox doesn't alert if the returnValue field is not set.
  12676. if ( event.result !== undefined && event.originalEvent ) {
  12677. event.originalEvent.returnValue = event.result;
  12678. }
  12679. }
  12680. }
  12681. }
  12682. };
  12683. // Ensure the presence of an event listener that handles manually-triggered
  12684. // synthetic events by interrupting progress until reinvoked in response to
  12685. // *native* events that it fires directly, ensuring that state changes have
  12686. // already occurred before other listeners are invoked.
  12687. function leverageNative( el, type, expectSync ) {
  12688. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12689. if ( !expectSync ) {
  12690. if ( dataPriv.get( el, type ) === undefined ) {
  12691. jQuery.event.add( el, type, returnTrue );
  12692. }
  12693. return;
  12694. }
  12695. // Register the controller as a special universal handler for all event namespaces
  12696. dataPriv.set( el, type, false );
  12697. jQuery.event.add( el, type, {
  12698. namespace: false,
  12699. handler: function( event ) {
  12700. var notAsync, result,
  12701. saved = dataPriv.get( this, type );
  12702. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12703. // Interrupt processing of the outer synthetic .trigger()ed event
  12704. // Saved data should be false in such cases, but might be a leftover capture object
  12705. // from an async native handler (gh-4350)
  12706. if ( !saved.length ) {
  12707. // Store arguments for use when handling the inner native event
  12708. // There will always be at least one argument (an event object), so this array
  12709. // will not be confused with a leftover capture object.
  12710. saved = slice.call( arguments );
  12711. dataPriv.set( this, type, saved );
  12712. // Trigger the native event and capture its result
  12713. // Support: IE <=9 - 11+
  12714. // focus() and blur() are asynchronous
  12715. notAsync = expectSync( this, type );
  12716. this[ type ]();
  12717. result = dataPriv.get( this, type );
  12718. if ( saved !== result || notAsync ) {
  12719. dataPriv.set( this, type, false );
  12720. } else {
  12721. result = {};
  12722. }
  12723. if ( saved !== result ) {
  12724. // Cancel the outer synthetic event
  12725. event.stopImmediatePropagation();
  12726. event.preventDefault();
  12727. return result.value;
  12728. }
  12729. // If this is an inner synthetic event for an event with a bubbling surrogate
  12730. // (focus or blur), assume that the surrogate already propagated from triggering the
  12731. // native event and prevent that from happening again here.
  12732. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  12733. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  12734. // less bad than duplication.
  12735. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  12736. event.stopPropagation();
  12737. }
  12738. // If this is a native event triggered above, everything is now in order
  12739. // Fire an inner synthetic event with the original arguments
  12740. } else if ( saved.length ) {
  12741. // ...and capture the result
  12742. dataPriv.set( this, type, {
  12743. value: jQuery.event.trigger(
  12744. // Support: IE <=9 - 11+
  12745. // Extend with the prototype to reset the above stopImmediatePropagation()
  12746. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  12747. saved.slice( 1 ),
  12748. this
  12749. )
  12750. } );
  12751. // Abort handling of the native event
  12752. event.stopImmediatePropagation();
  12753. }
  12754. }
  12755. } );
  12756. }
  12757. jQuery.removeEvent = function( elem, type, handle ) {
  12758. // This "if" is needed for plain objects
  12759. if ( elem.removeEventListener ) {
  12760. elem.removeEventListener( type, handle );
  12761. }
  12762. };
  12763. jQuery.Event = function( src, props ) {
  12764. // Allow instantiation without the 'new' keyword
  12765. if ( !( this instanceof jQuery.Event ) ) {
  12766. return new jQuery.Event( src, props );
  12767. }
  12768. // Event object
  12769. if ( src && src.type ) {
  12770. this.originalEvent = src;
  12771. this.type = src.type;
  12772. // Events bubbling up the document may have been marked as prevented
  12773. // by a handler lower down the tree; reflect the correct value.
  12774. this.isDefaultPrevented = src.defaultPrevented ||
  12775. src.defaultPrevented === undefined &&
  12776. // Support: Android <=2.3 only
  12777. src.returnValue === false ?
  12778. returnTrue :
  12779. returnFalse;
  12780. // Create target properties
  12781. // Support: Safari <=6 - 7 only
  12782. // Target should not be a text node (#504, #13143)
  12783. this.target = ( src.target && src.target.nodeType === 3 ) ?
  12784. src.target.parentNode :
  12785. src.target;
  12786. this.currentTarget = src.currentTarget;
  12787. this.relatedTarget = src.relatedTarget;
  12788. // Event type
  12789. } else {
  12790. this.type = src;
  12791. }
  12792. // Put explicitly provided properties onto the event object
  12793. if ( props ) {
  12794. jQuery.extend( this, props );
  12795. }
  12796. // Create a timestamp if incoming event doesn't have one
  12797. this.timeStamp = src && src.timeStamp || Date.now();
  12798. // Mark it as fixed
  12799. this[ jQuery.expando ] = true;
  12800. };
  12801. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  12802. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  12803. jQuery.Event.prototype = {
  12804. constructor: jQuery.Event,
  12805. isDefaultPrevented: returnFalse,
  12806. isPropagationStopped: returnFalse,
  12807. isImmediatePropagationStopped: returnFalse,
  12808. isSimulated: false,
  12809. preventDefault: function() {
  12810. var e = this.originalEvent;
  12811. this.isDefaultPrevented = returnTrue;
  12812. if ( e && !this.isSimulated ) {
  12813. e.preventDefault();
  12814. }
  12815. },
  12816. stopPropagation: function() {
  12817. var e = this.originalEvent;
  12818. this.isPropagationStopped = returnTrue;
  12819. if ( e && !this.isSimulated ) {
  12820. e.stopPropagation();
  12821. }
  12822. },
  12823. stopImmediatePropagation: function() {
  12824. var e = this.originalEvent;
  12825. this.isImmediatePropagationStopped = returnTrue;
  12826. if ( e && !this.isSimulated ) {
  12827. e.stopImmediatePropagation();
  12828. }
  12829. this.stopPropagation();
  12830. }
  12831. };
  12832. // Includes all common event props including KeyEvent and MouseEvent specific props
  12833. jQuery.each( {
  12834. altKey: true,
  12835. bubbles: true,
  12836. cancelable: true,
  12837. changedTouches: true,
  12838. ctrlKey: true,
  12839. detail: true,
  12840. eventPhase: true,
  12841. metaKey: true,
  12842. pageX: true,
  12843. pageY: true,
  12844. shiftKey: true,
  12845. view: true,
  12846. "char": true,
  12847. code: true,
  12848. charCode: true,
  12849. key: true,
  12850. keyCode: true,
  12851. button: true,
  12852. buttons: true,
  12853. clientX: true,
  12854. clientY: true,
  12855. offsetX: true,
  12856. offsetY: true,
  12857. pointerId: true,
  12858. pointerType: true,
  12859. screenX: true,
  12860. screenY: true,
  12861. targetTouches: true,
  12862. toElement: true,
  12863. touches: true,
  12864. which: function( event ) {
  12865. var button = event.button;
  12866. // Add which for key events
  12867. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  12868. return event.charCode != null ? event.charCode : event.keyCode;
  12869. }
  12870. // Add which for click: 1 === left; 2 === middle; 3 === right
  12871. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  12872. if ( button & 1 ) {
  12873. return 1;
  12874. }
  12875. if ( button & 2 ) {
  12876. return 3;
  12877. }
  12878. if ( button & 4 ) {
  12879. return 2;
  12880. }
  12881. return 0;
  12882. }
  12883. return event.which;
  12884. }
  12885. }, jQuery.event.addProp );
  12886. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  12887. jQuery.event.special[ type ] = {
  12888. // Utilize native event if possible so blur/focus sequence is correct
  12889. setup: function() {
  12890. // Claim the first handler
  12891. // dataPriv.set( this, "focus", ... )
  12892. // dataPriv.set( this, "blur", ... )
  12893. leverageNative( this, type, expectSync );
  12894. // Return false to allow normal processing in the caller
  12895. return false;
  12896. },
  12897. trigger: function() {
  12898. // Force setup before trigger
  12899. leverageNative( this, type );
  12900. // Return non-false to allow normal event-path propagation
  12901. return true;
  12902. },
  12903. delegateType: delegateType
  12904. };
  12905. } );
  12906. // Create mouseenter/leave events using mouseover/out and event-time checks
  12907. // so that event delegation works in jQuery.
  12908. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  12909. //
  12910. // Support: Safari 7 only
  12911. // Safari sends mouseenter too often; see:
  12912. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  12913. // for the description of the bug (it existed in older Chrome versions as well).
  12914. jQuery.each( {
  12915. mouseenter: "mouseover",
  12916. mouseleave: "mouseout",
  12917. pointerenter: "pointerover",
  12918. pointerleave: "pointerout"
  12919. }, function( orig, fix ) {
  12920. jQuery.event.special[ orig ] = {
  12921. delegateType: fix,
  12922. bindType: fix,
  12923. handle: function( event ) {
  12924. var ret,
  12925. target = this,
  12926. related = event.relatedTarget,
  12927. handleObj = event.handleObj;
  12928. // For mouseenter/leave call the handler if related is outside the target.
  12929. // NB: No relatedTarget if the mouse left/entered the browser window
  12930. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  12931. event.type = handleObj.origType;
  12932. ret = handleObj.handler.apply( this, arguments );
  12933. event.type = fix;
  12934. }
  12935. return ret;
  12936. }
  12937. };
  12938. } );
  12939. jQuery.fn.extend( {
  12940. on: function( types, selector, data, fn ) {
  12941. return on( this, types, selector, data, fn );
  12942. },
  12943. one: function( types, selector, data, fn ) {
  12944. return on( this, types, selector, data, fn, 1 );
  12945. },
  12946. off: function( types, selector, fn ) {
  12947. var handleObj, type;
  12948. if ( types && types.preventDefault && types.handleObj ) {
  12949. // ( event ) dispatched jQuery.Event
  12950. handleObj = types.handleObj;
  12951. jQuery( types.delegateTarget ).off(
  12952. handleObj.namespace ?
  12953. handleObj.origType + "." + handleObj.namespace :
  12954. handleObj.origType,
  12955. handleObj.selector,
  12956. handleObj.handler
  12957. );
  12958. return this;
  12959. }
  12960. if ( typeof types === "object" ) {
  12961. // ( types-object [, selector] )
  12962. for ( type in types ) {
  12963. this.off( type, selector, types[ type ] );
  12964. }
  12965. return this;
  12966. }
  12967. if ( selector === false || typeof selector === "function" ) {
  12968. // ( types [, fn] )
  12969. fn = selector;
  12970. selector = undefined;
  12971. }
  12972. if ( fn === false ) {
  12973. fn = returnFalse;
  12974. }
  12975. return this.each( function() {
  12976. jQuery.event.remove( this, types, fn, selector );
  12977. } );
  12978. }
  12979. } );
  12980. var
  12981. /* eslint-disable max-len */
  12982. // See https://github.com/eslint/eslint/issues/3229
  12983. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  12984. /* eslint-enable */
  12985. // Support: IE <=10 - 11, Edge 12 - 13 only
  12986. // In IE/Edge using regex groups here causes severe slowdowns.
  12987. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  12988. rnoInnerhtml = /<script|<style|<link/i,
  12989. // checked="checked" or checked
  12990. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  12991. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  12992. // Prefer a tbody over its parent table for containing new rows
  12993. function manipulationTarget( elem, content ) {
  12994. if ( nodeName( elem, "table" ) &&
  12995. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  12996. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  12997. }
  12998. return elem;
  12999. }
  13000. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13001. function disableScript( elem ) {
  13002. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13003. return elem;
  13004. }
  13005. function restoreScript( elem ) {
  13006. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13007. elem.type = elem.type.slice( 5 );
  13008. } else {
  13009. elem.removeAttribute( "type" );
  13010. }
  13011. return elem;
  13012. }
  13013. function cloneCopyEvent( src, dest ) {
  13014. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13015. if ( dest.nodeType !== 1 ) {
  13016. return;
  13017. }
  13018. // 1. Copy private data: events, handlers, etc.
  13019. if ( dataPriv.hasData( src ) ) {
  13020. pdataOld = dataPriv.access( src );
  13021. pdataCur = dataPriv.set( dest, pdataOld );
  13022. events = pdataOld.events;
  13023. if ( events ) {
  13024. delete pdataCur.handle;
  13025. pdataCur.events = {};
  13026. for ( type in events ) {
  13027. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13028. jQuery.event.add( dest, type, events[ type ][ i ] );
  13029. }
  13030. }
  13031. }
  13032. }
  13033. // 2. Copy user data
  13034. if ( dataUser.hasData( src ) ) {
  13035. udataOld = dataUser.access( src );
  13036. udataCur = jQuery.extend( {}, udataOld );
  13037. dataUser.set( dest, udataCur );
  13038. }
  13039. }
  13040. // Fix IE bugs, see support tests
  13041. function fixInput( src, dest ) {
  13042. var nodeName = dest.nodeName.toLowerCase();
  13043. // Fails to persist the checked state of a cloned checkbox or radio button.
  13044. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13045. dest.checked = src.checked;
  13046. // Fails to return the selected option to the default selected state when cloning options
  13047. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13048. dest.defaultValue = src.defaultValue;
  13049. }
  13050. }
  13051. function domManip( collection, args, callback, ignored ) {
  13052. // Flatten any nested arrays
  13053. args = concat.apply( [], args );
  13054. var fragment, first, scripts, hasScripts, node, doc,
  13055. i = 0,
  13056. l = collection.length,
  13057. iNoClone = l - 1,
  13058. value = args[ 0 ],
  13059. valueIsFunction = isFunction( value );
  13060. // We can't cloneNode fragments that contain checked, in WebKit
  13061. if ( valueIsFunction ||
  13062. ( l > 1 && typeof value === "string" &&
  13063. !support.checkClone && rchecked.test( value ) ) ) {
  13064. return collection.each( function( index ) {
  13065. var self = collection.eq( index );
  13066. if ( valueIsFunction ) {
  13067. args[ 0 ] = value.call( this, index, self.html() );
  13068. }
  13069. domManip( self, args, callback, ignored );
  13070. } );
  13071. }
  13072. if ( l ) {
  13073. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13074. first = fragment.firstChild;
  13075. if ( fragment.childNodes.length === 1 ) {
  13076. fragment = first;
  13077. }
  13078. // Require either new content or an interest in ignored elements to invoke the callback
  13079. if ( first || ignored ) {
  13080. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13081. hasScripts = scripts.length;
  13082. // Use the original fragment for the last item
  13083. // instead of the first because it can end up
  13084. // being emptied incorrectly in certain situations (#8070).
  13085. for ( ; i < l; i++ ) {
  13086. node = fragment;
  13087. if ( i !== iNoClone ) {
  13088. node = jQuery.clone( node, true, true );
  13089. // Keep references to cloned scripts for later restoration
  13090. if ( hasScripts ) {
  13091. // Support: Android <=4.0 only, PhantomJS 1 only
  13092. // push.apply(_, arraylike) throws on ancient WebKit
  13093. jQuery.merge( scripts, getAll( node, "script" ) );
  13094. }
  13095. }
  13096. callback.call( collection[ i ], node, i );
  13097. }
  13098. if ( hasScripts ) {
  13099. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13100. // Reenable scripts
  13101. jQuery.map( scripts, restoreScript );
  13102. // Evaluate executable scripts on first document insertion
  13103. for ( i = 0; i < hasScripts; i++ ) {
  13104. node = scripts[ i ];
  13105. if ( rscriptType.test( node.type || "" ) &&
  13106. !dataPriv.access( node, "globalEval" ) &&
  13107. jQuery.contains( doc, node ) ) {
  13108. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13109. // Optional AJAX dependency, but won't run scripts if not present
  13110. if ( jQuery._evalUrl && !node.noModule ) {
  13111. jQuery._evalUrl( node.src, {
  13112. nonce: node.nonce || node.getAttribute( "nonce" )
  13113. } );
  13114. }
  13115. } else {
  13116. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13117. }
  13118. }
  13119. }
  13120. }
  13121. }
  13122. }
  13123. return collection;
  13124. }
  13125. function remove( elem, selector, keepData ) {
  13126. var node,
  13127. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13128. i = 0;
  13129. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13130. if ( !keepData && node.nodeType === 1 ) {
  13131. jQuery.cleanData( getAll( node ) );
  13132. }
  13133. if ( node.parentNode ) {
  13134. if ( keepData && isAttached( node ) ) {
  13135. setGlobalEval( getAll( node, "script" ) );
  13136. }
  13137. node.parentNode.removeChild( node );
  13138. }
  13139. }
  13140. return elem;
  13141. }
  13142. jQuery.extend( {
  13143. htmlPrefilter: function( html ) {
  13144. return html.replace( rxhtmlTag, "<$1></$2>" );
  13145. },
  13146. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13147. var i, l, srcElements, destElements,
  13148. clone = elem.cloneNode( true ),
  13149. inPage = isAttached( elem );
  13150. // Fix IE cloning issues
  13151. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13152. !jQuery.isXMLDoc( elem ) ) {
  13153. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13154. destElements = getAll( clone );
  13155. srcElements = getAll( elem );
  13156. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13157. fixInput( srcElements[ i ], destElements[ i ] );
  13158. }
  13159. }
  13160. // Copy the events from the original to the clone
  13161. if ( dataAndEvents ) {
  13162. if ( deepDataAndEvents ) {
  13163. srcElements = srcElements || getAll( elem );
  13164. destElements = destElements || getAll( clone );
  13165. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13166. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13167. }
  13168. } else {
  13169. cloneCopyEvent( elem, clone );
  13170. }
  13171. }
  13172. // Preserve script evaluation history
  13173. destElements = getAll( clone, "script" );
  13174. if ( destElements.length > 0 ) {
  13175. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13176. }
  13177. // Return the cloned set
  13178. return clone;
  13179. },
  13180. cleanData: function( elems ) {
  13181. var data, elem, type,
  13182. special = jQuery.event.special,
  13183. i = 0;
  13184. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13185. if ( acceptData( elem ) ) {
  13186. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13187. if ( data.events ) {
  13188. for ( type in data.events ) {
  13189. if ( special[ type ] ) {
  13190. jQuery.event.remove( elem, type );
  13191. // This is a shortcut to avoid jQuery.event.remove's overhead
  13192. } else {
  13193. jQuery.removeEvent( elem, type, data.handle );
  13194. }
  13195. }
  13196. }
  13197. // Support: Chrome <=35 - 45+
  13198. // Assign undefined instead of using delete, see Data#remove
  13199. elem[ dataPriv.expando ] = undefined;
  13200. }
  13201. if ( elem[ dataUser.expando ] ) {
  13202. // Support: Chrome <=35 - 45+
  13203. // Assign undefined instead of using delete, see Data#remove
  13204. elem[ dataUser.expando ] = undefined;
  13205. }
  13206. }
  13207. }
  13208. }
  13209. } );
  13210. jQuery.fn.extend( {
  13211. detach: function( selector ) {
  13212. return remove( this, selector, true );
  13213. },
  13214. remove: function( selector ) {
  13215. return remove( this, selector );
  13216. },
  13217. text: function( value ) {
  13218. return access( this, function( value ) {
  13219. return value === undefined ?
  13220. jQuery.text( this ) :
  13221. this.empty().each( function() {
  13222. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13223. this.textContent = value;
  13224. }
  13225. } );
  13226. }, null, value, arguments.length );
  13227. },
  13228. append: function() {
  13229. return domManip( this, arguments, function( elem ) {
  13230. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13231. var target = manipulationTarget( this, elem );
  13232. target.appendChild( elem );
  13233. }
  13234. } );
  13235. },
  13236. prepend: function() {
  13237. return domManip( this, arguments, function( elem ) {
  13238. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13239. var target = manipulationTarget( this, elem );
  13240. target.insertBefore( elem, target.firstChild );
  13241. }
  13242. } );
  13243. },
  13244. before: function() {
  13245. return domManip( this, arguments, function( elem ) {
  13246. if ( this.parentNode ) {
  13247. this.parentNode.insertBefore( elem, this );
  13248. }
  13249. } );
  13250. },
  13251. after: function() {
  13252. return domManip( this, arguments, function( elem ) {
  13253. if ( this.parentNode ) {
  13254. this.parentNode.insertBefore( elem, this.nextSibling );
  13255. }
  13256. } );
  13257. },
  13258. empty: function() {
  13259. var elem,
  13260. i = 0;
  13261. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13262. if ( elem.nodeType === 1 ) {
  13263. // Prevent memory leaks
  13264. jQuery.cleanData( getAll( elem, false ) );
  13265. // Remove any remaining nodes
  13266. elem.textContent = "";
  13267. }
  13268. }
  13269. return this;
  13270. },
  13271. clone: function( dataAndEvents, deepDataAndEvents ) {
  13272. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13273. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13274. return this.map( function() {
  13275. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13276. } );
  13277. },
  13278. html: function( value ) {
  13279. return access( this, function( value ) {
  13280. var elem = this[ 0 ] || {},
  13281. i = 0,
  13282. l = this.length;
  13283. if ( value === undefined && elem.nodeType === 1 ) {
  13284. return elem.innerHTML;
  13285. }
  13286. // See if we can take a shortcut and just use innerHTML
  13287. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13288. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13289. value = jQuery.htmlPrefilter( value );
  13290. try {
  13291. for ( ; i < l; i++ ) {
  13292. elem = this[ i ] || {};
  13293. // Remove element nodes and prevent memory leaks
  13294. if ( elem.nodeType === 1 ) {
  13295. jQuery.cleanData( getAll( elem, false ) );
  13296. elem.innerHTML = value;
  13297. }
  13298. }
  13299. elem = 0;
  13300. // If using innerHTML throws an exception, use the fallback method
  13301. } catch ( e ) {}
  13302. }
  13303. if ( elem ) {
  13304. this.empty().append( value );
  13305. }
  13306. }, null, value, arguments.length );
  13307. },
  13308. replaceWith: function() {
  13309. var ignored = [];
  13310. // Make the changes, replacing each non-ignored context element with the new content
  13311. return domManip( this, arguments, function( elem ) {
  13312. var parent = this.parentNode;
  13313. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13314. jQuery.cleanData( getAll( this ) );
  13315. if ( parent ) {
  13316. parent.replaceChild( elem, this );
  13317. }
  13318. }
  13319. // Force callback invocation
  13320. }, ignored );
  13321. }
  13322. } );
  13323. jQuery.each( {
  13324. appendTo: "append",
  13325. prependTo: "prepend",
  13326. insertBefore: "before",
  13327. insertAfter: "after",
  13328. replaceAll: "replaceWith"
  13329. }, function( name, original ) {
  13330. jQuery.fn[ name ] = function( selector ) {
  13331. var elems,
  13332. ret = [],
  13333. insert = jQuery( selector ),
  13334. last = insert.length - 1,
  13335. i = 0;
  13336. for ( ; i <= last; i++ ) {
  13337. elems = i === last ? this : this.clone( true );
  13338. jQuery( insert[ i ] )[ original ]( elems );
  13339. // Support: Android <=4.0 only, PhantomJS 1 only
  13340. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13341. push.apply( ret, elems.get() );
  13342. }
  13343. return this.pushStack( ret );
  13344. };
  13345. } );
  13346. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13347. var getStyles = function( elem ) {
  13348. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13349. // IE throws on elements created in popups
  13350. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13351. var view = elem.ownerDocument.defaultView;
  13352. if ( !view || !view.opener ) {
  13353. view = window;
  13354. }
  13355. return view.getComputedStyle( elem );
  13356. };
  13357. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13358. ( function() {
  13359. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13360. // so they're executed at the same time to save the second computation.
  13361. function computeStyleTests() {
  13362. // This is a singleton, we need to execute it only once
  13363. if ( !div ) {
  13364. return;
  13365. }
  13366. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13367. "margin-top:1px;padding:0;border:0";
  13368. div.style.cssText =
  13369. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13370. "margin:auto;border:1px;padding:1px;" +
  13371. "width:60%;top:1%";
  13372. documentElement.appendChild( container ).appendChild( div );
  13373. var divStyle = window.getComputedStyle( div );
  13374. pixelPositionVal = divStyle.top !== "1%";
  13375. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13376. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13377. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13378. // Some styles come back with percentage values, even though they shouldn't
  13379. div.style.right = "60%";
  13380. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13381. // Support: IE 9 - 11 only
  13382. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13383. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13384. // Support: IE 9 only
  13385. // Detect overflow:scroll screwiness (gh-3699)
  13386. // Support: Chrome <=64
  13387. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13388. div.style.position = "absolute";
  13389. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13390. documentElement.removeChild( container );
  13391. // Nullify the div so it wouldn't be stored in the memory and
  13392. // it will also be a sign that checks already performed
  13393. div = null;
  13394. }
  13395. function roundPixelMeasures( measure ) {
  13396. return Math.round( parseFloat( measure ) );
  13397. }
  13398. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13399. reliableMarginLeftVal,
  13400. container = document.createElement( "div" ),
  13401. div = document.createElement( "div" );
  13402. // Finish early in limited (non-browser) environments
  13403. if ( !div.style ) {
  13404. return;
  13405. }
  13406. // Support: IE <=9 - 11 only
  13407. // Style of cloned element affects source element cloned (#8908)
  13408. div.style.backgroundClip = "content-box";
  13409. div.cloneNode( true ).style.backgroundClip = "";
  13410. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13411. jQuery.extend( support, {
  13412. boxSizingReliable: function() {
  13413. computeStyleTests();
  13414. return boxSizingReliableVal;
  13415. },
  13416. pixelBoxStyles: function() {
  13417. computeStyleTests();
  13418. return pixelBoxStylesVal;
  13419. },
  13420. pixelPosition: function() {
  13421. computeStyleTests();
  13422. return pixelPositionVal;
  13423. },
  13424. reliableMarginLeft: function() {
  13425. computeStyleTests();
  13426. return reliableMarginLeftVal;
  13427. },
  13428. scrollboxSize: function() {
  13429. computeStyleTests();
  13430. return scrollboxSizeVal;
  13431. }
  13432. } );
  13433. } )();
  13434. function curCSS( elem, name, computed ) {
  13435. var width, minWidth, maxWidth, ret,
  13436. // Support: Firefox 51+
  13437. // Retrieving style before computed somehow
  13438. // fixes an issue with getting wrong values
  13439. // on detached elements
  13440. style = elem.style;
  13441. computed = computed || getStyles( elem );
  13442. // getPropertyValue is needed for:
  13443. // .css('filter') (IE 9 only, #12537)
  13444. // .css('--customProperty) (#3144)
  13445. if ( computed ) {
  13446. ret = computed.getPropertyValue( name ) || computed[ name ];
  13447. if ( ret === "" && !isAttached( elem ) ) {
  13448. ret = jQuery.style( elem, name );
  13449. }
  13450. // A tribute to the "awesome hack by Dean Edwards"
  13451. // Android Browser returns percentage for some values,
  13452. // but width seems to be reliably pixels.
  13453. // This is against the CSSOM draft spec:
  13454. // https://drafts.csswg.org/cssom/#resolved-values
  13455. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13456. // Remember the original values
  13457. width = style.width;
  13458. minWidth = style.minWidth;
  13459. maxWidth = style.maxWidth;
  13460. // Put in the new values to get a computed value out
  13461. style.minWidth = style.maxWidth = style.width = ret;
  13462. ret = computed.width;
  13463. // Revert the changed values
  13464. style.width = width;
  13465. style.minWidth = minWidth;
  13466. style.maxWidth = maxWidth;
  13467. }
  13468. }
  13469. return ret !== undefined ?
  13470. // Support: IE <=9 - 11 only
  13471. // IE returns zIndex value as an integer.
  13472. ret + "" :
  13473. ret;
  13474. }
  13475. function addGetHookIf( conditionFn, hookFn ) {
  13476. // Define the hook, we'll check on the first run if it's really needed.
  13477. return {
  13478. get: function() {
  13479. if ( conditionFn() ) {
  13480. // Hook not needed (or it's not possible to use it due
  13481. // to missing dependency), remove it.
  13482. delete this.get;
  13483. return;
  13484. }
  13485. // Hook needed; redefine it so that the support test is not executed again.
  13486. return ( this.get = hookFn ).apply( this, arguments );
  13487. }
  13488. };
  13489. }
  13490. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13491. emptyStyle = document.createElement( "div" ).style,
  13492. vendorProps = {};
  13493. // Return a vendor-prefixed property or undefined
  13494. function vendorPropName( name ) {
  13495. // Check for vendor prefixed names
  13496. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13497. i = cssPrefixes.length;
  13498. while ( i-- ) {
  13499. name = cssPrefixes[ i ] + capName;
  13500. if ( name in emptyStyle ) {
  13501. return name;
  13502. }
  13503. }
  13504. }
  13505. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13506. function finalPropName( name ) {
  13507. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13508. if ( final ) {
  13509. return final;
  13510. }
  13511. if ( name in emptyStyle ) {
  13512. return name;
  13513. }
  13514. return vendorProps[ name ] = vendorPropName( name ) || name;
  13515. }
  13516. var
  13517. // Swappable if display is none or starts with table
  13518. // except "table", "table-cell", or "table-caption"
  13519. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13520. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13521. rcustomProp = /^--/,
  13522. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13523. cssNormalTransform = {
  13524. letterSpacing: "0",
  13525. fontWeight: "400"
  13526. };
  13527. function setPositiveNumber( elem, value, subtract ) {
  13528. // Any relative (+/-) values have already been
  13529. // normalized at this point
  13530. var matches = rcssNum.exec( value );
  13531. return matches ?
  13532. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13533. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13534. value;
  13535. }
  13536. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13537. var i = dimension === "width" ? 1 : 0,
  13538. extra = 0,
  13539. delta = 0;
  13540. // Adjustment may not be necessary
  13541. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13542. return 0;
  13543. }
  13544. for ( ; i < 4; i += 2 ) {
  13545. // Both box models exclude margin
  13546. if ( box === "margin" ) {
  13547. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13548. }
  13549. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13550. if ( !isBorderBox ) {
  13551. // Add padding
  13552. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13553. // For "border" or "margin", add border
  13554. if ( box !== "padding" ) {
  13555. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13556. // But still keep track of it otherwise
  13557. } else {
  13558. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13559. }
  13560. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13561. // "padding" or "margin"
  13562. } else {
  13563. // For "content", subtract padding
  13564. if ( box === "content" ) {
  13565. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13566. }
  13567. // For "content" or "padding", subtract border
  13568. if ( box !== "margin" ) {
  13569. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13570. }
  13571. }
  13572. }
  13573. // Account for positive content-box scroll gutter when requested by providing computedVal
  13574. if ( !isBorderBox && computedVal >= 0 ) {
  13575. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13576. // Assuming integer scroll gutter, subtract the rest and round down
  13577. delta += Math.max( 0, Math.ceil(
  13578. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13579. computedVal -
  13580. delta -
  13581. extra -
  13582. 0.5
  13583. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13584. // Use an explicit zero to avoid NaN (gh-3964)
  13585. ) ) || 0;
  13586. }
  13587. return delta;
  13588. }
  13589. function getWidthOrHeight( elem, dimension, extra ) {
  13590. // Start with computed style
  13591. var styles = getStyles( elem ),
  13592. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13593. // Fake content-box until we know it's needed to know the true value.
  13594. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13595. isBorderBox = boxSizingNeeded &&
  13596. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13597. valueIsBorderBox = isBorderBox,
  13598. val = curCSS( elem, dimension, styles ),
  13599. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13600. // Support: Firefox <=54
  13601. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13602. if ( rnumnonpx.test( val ) ) {
  13603. if ( !extra ) {
  13604. return val;
  13605. }
  13606. val = "auto";
  13607. }
  13608. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13609. // This happens for inline elements with no explicit setting (gh-3571)
  13610. // Support: Android <=4.1 - 4.3 only
  13611. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13612. // Support: IE 9-11 only
  13613. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13614. // We use getClientRects() to check for hidden/disconnected.
  13615. // In those cases, the computed value can be trusted to be border-box
  13616. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13617. val === "auto" ||
  13618. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13619. elem.getClientRects().length ) {
  13620. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13621. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13622. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13623. // retrieved value as a content box dimension.
  13624. valueIsBorderBox = offsetProp in elem;
  13625. if ( valueIsBorderBox ) {
  13626. val = elem[ offsetProp ];
  13627. }
  13628. }
  13629. // Normalize "" and auto
  13630. val = parseFloat( val ) || 0;
  13631. // Adjust for the element's box model
  13632. return ( val +
  13633. boxModelAdjustment(
  13634. elem,
  13635. dimension,
  13636. extra || ( isBorderBox ? "border" : "content" ),
  13637. valueIsBorderBox,
  13638. styles,
  13639. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13640. val
  13641. )
  13642. ) + "px";
  13643. }
  13644. jQuery.extend( {
  13645. // Add in style property hooks for overriding the default
  13646. // behavior of getting and setting a style property
  13647. cssHooks: {
  13648. opacity: {
  13649. get: function( elem, computed ) {
  13650. if ( computed ) {
  13651. // We should always get a number back from opacity
  13652. var ret = curCSS( elem, "opacity" );
  13653. return ret === "" ? "1" : ret;
  13654. }
  13655. }
  13656. }
  13657. },
  13658. // Don't automatically add "px" to these possibly-unitless properties
  13659. cssNumber: {
  13660. "animationIterationCount": true,
  13661. "columnCount": true,
  13662. "fillOpacity": true,
  13663. "flexGrow": true,
  13664. "flexShrink": true,
  13665. "fontWeight": true,
  13666. "gridArea": true,
  13667. "gridColumn": true,
  13668. "gridColumnEnd": true,
  13669. "gridColumnStart": true,
  13670. "gridRow": true,
  13671. "gridRowEnd": true,
  13672. "gridRowStart": true,
  13673. "lineHeight": true,
  13674. "opacity": true,
  13675. "order": true,
  13676. "orphans": true,
  13677. "widows": true,
  13678. "zIndex": true,
  13679. "zoom": true
  13680. },
  13681. // Add in properties whose names you wish to fix before
  13682. // setting or getting the value
  13683. cssProps: {},
  13684. // Get and set the style property on a DOM Node
  13685. style: function( elem, name, value, extra ) {
  13686. // Don't set styles on text and comment nodes
  13687. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13688. return;
  13689. }
  13690. // Make sure that we're working with the right name
  13691. var ret, type, hooks,
  13692. origName = camelCase( name ),
  13693. isCustomProp = rcustomProp.test( name ),
  13694. style = elem.style;
  13695. // Make sure that we're working with the right name. We don't
  13696. // want to query the value if it is a CSS custom property
  13697. // since they are user-defined.
  13698. if ( !isCustomProp ) {
  13699. name = finalPropName( origName );
  13700. }
  13701. // Gets hook for the prefixed version, then unprefixed version
  13702. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13703. // Check if we're setting a value
  13704. if ( value !== undefined ) {
  13705. type = typeof value;
  13706. // Convert "+=" or "-=" to relative numbers (#7345)
  13707. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13708. value = adjustCSS( elem, name, ret );
  13709. // Fixes bug #9237
  13710. type = "number";
  13711. }
  13712. // Make sure that null and NaN values aren't set (#7116)
  13713. if ( value == null || value !== value ) {
  13714. return;
  13715. }
  13716. // If a number was passed in, add the unit (except for certain CSS properties)
  13717. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  13718. // "px" to a few hardcoded values.
  13719. if ( type === "number" && !isCustomProp ) {
  13720. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  13721. }
  13722. // background-* props affect original clone's values
  13723. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  13724. style[ name ] = "inherit";
  13725. }
  13726. // If a hook was provided, use that value, otherwise just set the specified value
  13727. if ( !hooks || !( "set" in hooks ) ||
  13728. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  13729. if ( isCustomProp ) {
  13730. style.setProperty( name, value );
  13731. } else {
  13732. style[ name ] = value;
  13733. }
  13734. }
  13735. } else {
  13736. // If a hook was provided get the non-computed value from there
  13737. if ( hooks && "get" in hooks &&
  13738. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  13739. return ret;
  13740. }
  13741. // Otherwise just get the value from the style object
  13742. return style[ name ];
  13743. }
  13744. },
  13745. css: function( elem, name, extra, styles ) {
  13746. var val, num, hooks,
  13747. origName = camelCase( name ),
  13748. isCustomProp = rcustomProp.test( name );
  13749. // Make sure that we're working with the right name. We don't
  13750. // want to modify the value if it is a CSS custom property
  13751. // since they are user-defined.
  13752. if ( !isCustomProp ) {
  13753. name = finalPropName( origName );
  13754. }
  13755. // Try prefixed name followed by the unprefixed name
  13756. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13757. // If a hook was provided get the computed value from there
  13758. if ( hooks && "get" in hooks ) {
  13759. val = hooks.get( elem, true, extra );
  13760. }
  13761. // Otherwise, if a way to get the computed value exists, use that
  13762. if ( val === undefined ) {
  13763. val = curCSS( elem, name, styles );
  13764. }
  13765. // Convert "normal" to computed value
  13766. if ( val === "normal" && name in cssNormalTransform ) {
  13767. val = cssNormalTransform[ name ];
  13768. }
  13769. // Make numeric if forced or a qualifier was provided and val looks numeric
  13770. if ( extra === "" || extra ) {
  13771. num = parseFloat( val );
  13772. return extra === true || isFinite( num ) ? num || 0 : val;
  13773. }
  13774. return val;
  13775. }
  13776. } );
  13777. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  13778. jQuery.cssHooks[ dimension ] = {
  13779. get: function( elem, computed, extra ) {
  13780. if ( computed ) {
  13781. // Certain elements can have dimension info if we invisibly show them
  13782. // but it must have a current display style that would benefit
  13783. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  13784. // Support: Safari 8+
  13785. // Table columns in Safari have non-zero offsetWidth & zero
  13786. // getBoundingClientRect().width unless display is changed.
  13787. // Support: IE <=11 only
  13788. // Running getBoundingClientRect on a disconnected node
  13789. // in IE throws an error.
  13790. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  13791. swap( elem, cssShow, function() {
  13792. return getWidthOrHeight( elem, dimension, extra );
  13793. } ) :
  13794. getWidthOrHeight( elem, dimension, extra );
  13795. }
  13796. },
  13797. set: function( elem, value, extra ) {
  13798. var matches,
  13799. styles = getStyles( elem ),
  13800. // Only read styles.position if the test has a chance to fail
  13801. // to avoid forcing a reflow.
  13802. scrollboxSizeBuggy = !support.scrollboxSize() &&
  13803. styles.position === "absolute",
  13804. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  13805. boxSizingNeeded = scrollboxSizeBuggy || extra,
  13806. isBorderBox = boxSizingNeeded &&
  13807. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13808. subtract = extra ?
  13809. boxModelAdjustment(
  13810. elem,
  13811. dimension,
  13812. extra,
  13813. isBorderBox,
  13814. styles
  13815. ) :
  13816. 0;
  13817. // Account for unreliable border-box dimensions by comparing offset* to computed and
  13818. // faking a content-box to get border and padding (gh-3699)
  13819. if ( isBorderBox && scrollboxSizeBuggy ) {
  13820. subtract -= Math.ceil(
  13821. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13822. parseFloat( styles[ dimension ] ) -
  13823. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  13824. 0.5
  13825. );
  13826. }
  13827. // Convert to pixels if value adjustment is needed
  13828. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  13829. ( matches[ 3 ] || "px" ) !== "px" ) {
  13830. elem.style[ dimension ] = value;
  13831. value = jQuery.css( elem, dimension );
  13832. }
  13833. return setPositiveNumber( elem, value, subtract );
  13834. }
  13835. };
  13836. } );
  13837. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  13838. function( elem, computed ) {
  13839. if ( computed ) {
  13840. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  13841. elem.getBoundingClientRect().left -
  13842. swap( elem, { marginLeft: 0 }, function() {
  13843. return elem.getBoundingClientRect().left;
  13844. } )
  13845. ) + "px";
  13846. }
  13847. }
  13848. );
  13849. // These hooks are used by animate to expand properties
  13850. jQuery.each( {
  13851. margin: "",
  13852. padding: "",
  13853. border: "Width"
  13854. }, function( prefix, suffix ) {
  13855. jQuery.cssHooks[ prefix + suffix ] = {
  13856. expand: function( value ) {
  13857. var i = 0,
  13858. expanded = {},
  13859. // Assumes a single number if not a string
  13860. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  13861. for ( ; i < 4; i++ ) {
  13862. expanded[ prefix + cssExpand[ i ] + suffix ] =
  13863. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  13864. }
  13865. return expanded;
  13866. }
  13867. };
  13868. if ( prefix !== "margin" ) {
  13869. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  13870. }
  13871. } );
  13872. jQuery.fn.extend( {
  13873. css: function( name, value ) {
  13874. return access( this, function( elem, name, value ) {
  13875. var styles, len,
  13876. map = {},
  13877. i = 0;
  13878. if ( Array.isArray( name ) ) {
  13879. styles = getStyles( elem );
  13880. len = name.length;
  13881. for ( ; i < len; i++ ) {
  13882. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  13883. }
  13884. return map;
  13885. }
  13886. return value !== undefined ?
  13887. jQuery.style( elem, name, value ) :
  13888. jQuery.css( elem, name );
  13889. }, name, value, arguments.length > 1 );
  13890. }
  13891. } );
  13892. function Tween( elem, options, prop, end, easing ) {
  13893. return new Tween.prototype.init( elem, options, prop, end, easing );
  13894. }
  13895. jQuery.Tween = Tween;
  13896. Tween.prototype = {
  13897. constructor: Tween,
  13898. init: function( elem, options, prop, end, easing, unit ) {
  13899. this.elem = elem;
  13900. this.prop = prop;
  13901. this.easing = easing || jQuery.easing._default;
  13902. this.options = options;
  13903. this.start = this.now = this.cur();
  13904. this.end = end;
  13905. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  13906. },
  13907. cur: function() {
  13908. var hooks = Tween.propHooks[ this.prop ];
  13909. return hooks && hooks.get ?
  13910. hooks.get( this ) :
  13911. Tween.propHooks._default.get( this );
  13912. },
  13913. run: function( percent ) {
  13914. var eased,
  13915. hooks = Tween.propHooks[ this.prop ];
  13916. if ( this.options.duration ) {
  13917. this.pos = eased = jQuery.easing[ this.easing ](
  13918. percent, this.options.duration * percent, 0, 1, this.options.duration
  13919. );
  13920. } else {
  13921. this.pos = eased = percent;
  13922. }
  13923. this.now = ( this.end - this.start ) * eased + this.start;
  13924. if ( this.options.step ) {
  13925. this.options.step.call( this.elem, this.now, this );
  13926. }
  13927. if ( hooks && hooks.set ) {
  13928. hooks.set( this );
  13929. } else {
  13930. Tween.propHooks._default.set( this );
  13931. }
  13932. return this;
  13933. }
  13934. };
  13935. Tween.prototype.init.prototype = Tween.prototype;
  13936. Tween.propHooks = {
  13937. _default: {
  13938. get: function( tween ) {
  13939. var result;
  13940. // Use a property on the element directly when it is not a DOM element,
  13941. // or when there is no matching style property that exists.
  13942. if ( tween.elem.nodeType !== 1 ||
  13943. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  13944. return tween.elem[ tween.prop ];
  13945. }
  13946. // Passing an empty string as a 3rd parameter to .css will automatically
  13947. // attempt a parseFloat and fallback to a string if the parse fails.
  13948. // Simple values such as "10px" are parsed to Float;
  13949. // complex values such as "rotate(1rad)" are returned as-is.
  13950. result = jQuery.css( tween.elem, tween.prop, "" );
  13951. // Empty strings, null, undefined and "auto" are converted to 0.
  13952. return !result || result === "auto" ? 0 : result;
  13953. },
  13954. set: function( tween ) {
  13955. // Use step hook for back compat.
  13956. // Use cssHook if its there.
  13957. // Use .style if available and use plain properties where available.
  13958. if ( jQuery.fx.step[ tween.prop ] ) {
  13959. jQuery.fx.step[ tween.prop ]( tween );
  13960. } else if ( tween.elem.nodeType === 1 && (
  13961. jQuery.cssHooks[ tween.prop ] ||
  13962. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  13963. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  13964. } else {
  13965. tween.elem[ tween.prop ] = tween.now;
  13966. }
  13967. }
  13968. }
  13969. };
  13970. // Support: IE <=9 only
  13971. // Panic based approach to setting things on disconnected nodes
  13972. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  13973. set: function( tween ) {
  13974. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  13975. tween.elem[ tween.prop ] = tween.now;
  13976. }
  13977. }
  13978. };
  13979. jQuery.easing = {
  13980. linear: function( p ) {
  13981. return p;
  13982. },
  13983. swing: function( p ) {
  13984. return 0.5 - Math.cos( p * Math.PI ) / 2;
  13985. },
  13986. _default: "swing"
  13987. };
  13988. jQuery.fx = Tween.prototype.init;
  13989. // Back compat <1.8 extension point
  13990. jQuery.fx.step = {};
  13991. var
  13992. fxNow, inProgress,
  13993. rfxtypes = /^(?:toggle|show|hide)$/,
  13994. rrun = /queueHooks$/;
  13995. function schedule() {
  13996. if ( inProgress ) {
  13997. if ( document.hidden === false && window.requestAnimationFrame ) {
  13998. window.requestAnimationFrame( schedule );
  13999. } else {
  14000. window.setTimeout( schedule, jQuery.fx.interval );
  14001. }
  14002. jQuery.fx.tick();
  14003. }
  14004. }
  14005. // Animations created synchronously will run synchronously
  14006. function createFxNow() {
  14007. window.setTimeout( function() {
  14008. fxNow = undefined;
  14009. } );
  14010. return ( fxNow = Date.now() );
  14011. }
  14012. // Generate parameters to create a standard animation
  14013. function genFx( type, includeWidth ) {
  14014. var which,
  14015. i = 0,
  14016. attrs = { height: type };
  14017. // If we include width, step value is 1 to do all cssExpand values,
  14018. // otherwise step value is 2 to skip over Left and Right
  14019. includeWidth = includeWidth ? 1 : 0;
  14020. for ( ; i < 4; i += 2 - includeWidth ) {
  14021. which = cssExpand[ i ];
  14022. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14023. }
  14024. if ( includeWidth ) {
  14025. attrs.opacity = attrs.width = type;
  14026. }
  14027. return attrs;
  14028. }
  14029. function createTween( value, prop, animation ) {
  14030. var tween,
  14031. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14032. index = 0,
  14033. length = collection.length;
  14034. for ( ; index < length; index++ ) {
  14035. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14036. // We're done with this property
  14037. return tween;
  14038. }
  14039. }
  14040. }
  14041. function defaultPrefilter( elem, props, opts ) {
  14042. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14043. isBox = "width" in props || "height" in props,
  14044. anim = this,
  14045. orig = {},
  14046. style = elem.style,
  14047. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14048. dataShow = dataPriv.get( elem, "fxshow" );
  14049. // Queue-skipping animations hijack the fx hooks
  14050. if ( !opts.queue ) {
  14051. hooks = jQuery._queueHooks( elem, "fx" );
  14052. if ( hooks.unqueued == null ) {
  14053. hooks.unqueued = 0;
  14054. oldfire = hooks.empty.fire;
  14055. hooks.empty.fire = function() {
  14056. if ( !hooks.unqueued ) {
  14057. oldfire();
  14058. }
  14059. };
  14060. }
  14061. hooks.unqueued++;
  14062. anim.always( function() {
  14063. // Ensure the complete handler is called before this completes
  14064. anim.always( function() {
  14065. hooks.unqueued--;
  14066. if ( !jQuery.queue( elem, "fx" ).length ) {
  14067. hooks.empty.fire();
  14068. }
  14069. } );
  14070. } );
  14071. }
  14072. // Detect show/hide animations
  14073. for ( prop in props ) {
  14074. value = props[ prop ];
  14075. if ( rfxtypes.test( value ) ) {
  14076. delete props[ prop ];
  14077. toggle = toggle || value === "toggle";
  14078. if ( value === ( hidden ? "hide" : "show" ) ) {
  14079. // Pretend to be hidden if this is a "show" and
  14080. // there is still data from a stopped show/hide
  14081. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14082. hidden = true;
  14083. // Ignore all other no-op show/hide data
  14084. } else {
  14085. continue;
  14086. }
  14087. }
  14088. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14089. }
  14090. }
  14091. // Bail out if this is a no-op like .hide().hide()
  14092. propTween = !jQuery.isEmptyObject( props );
  14093. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14094. return;
  14095. }
  14096. // Restrict "overflow" and "display" styles during box animations
  14097. if ( isBox && elem.nodeType === 1 ) {
  14098. // Support: IE <=9 - 11, Edge 12 - 15
  14099. // Record all 3 overflow attributes because IE does not infer the shorthand
  14100. // from identically-valued overflowX and overflowY and Edge just mirrors
  14101. // the overflowX value there.
  14102. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14103. // Identify a display type, preferring old show/hide data over the CSS cascade
  14104. restoreDisplay = dataShow && dataShow.display;
  14105. if ( restoreDisplay == null ) {
  14106. restoreDisplay = dataPriv.get( elem, "display" );
  14107. }
  14108. display = jQuery.css( elem, "display" );
  14109. if ( display === "none" ) {
  14110. if ( restoreDisplay ) {
  14111. display = restoreDisplay;
  14112. } else {
  14113. // Get nonempty value(s) by temporarily forcing visibility
  14114. showHide( [ elem ], true );
  14115. restoreDisplay = elem.style.display || restoreDisplay;
  14116. display = jQuery.css( elem, "display" );
  14117. showHide( [ elem ] );
  14118. }
  14119. }
  14120. // Animate inline elements as inline-block
  14121. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14122. if ( jQuery.css( elem, "float" ) === "none" ) {
  14123. // Restore the original display value at the end of pure show/hide animations
  14124. if ( !propTween ) {
  14125. anim.done( function() {
  14126. style.display = restoreDisplay;
  14127. } );
  14128. if ( restoreDisplay == null ) {
  14129. display = style.display;
  14130. restoreDisplay = display === "none" ? "" : display;
  14131. }
  14132. }
  14133. style.display = "inline-block";
  14134. }
  14135. }
  14136. }
  14137. if ( opts.overflow ) {
  14138. style.overflow = "hidden";
  14139. anim.always( function() {
  14140. style.overflow = opts.overflow[ 0 ];
  14141. style.overflowX = opts.overflow[ 1 ];
  14142. style.overflowY = opts.overflow[ 2 ];
  14143. } );
  14144. }
  14145. // Implement show/hide animations
  14146. propTween = false;
  14147. for ( prop in orig ) {
  14148. // General show/hide setup for this element animation
  14149. if ( !propTween ) {
  14150. if ( dataShow ) {
  14151. if ( "hidden" in dataShow ) {
  14152. hidden = dataShow.hidden;
  14153. }
  14154. } else {
  14155. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14156. }
  14157. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14158. if ( toggle ) {
  14159. dataShow.hidden = !hidden;
  14160. }
  14161. // Show elements before animating them
  14162. if ( hidden ) {
  14163. showHide( [ elem ], true );
  14164. }
  14165. /* eslint-disable no-loop-func */
  14166. anim.done( function() {
  14167. /* eslint-enable no-loop-func */
  14168. // The final step of a "hide" animation is actually hiding the element
  14169. if ( !hidden ) {
  14170. showHide( [ elem ] );
  14171. }
  14172. dataPriv.remove( elem, "fxshow" );
  14173. for ( prop in orig ) {
  14174. jQuery.style( elem, prop, orig[ prop ] );
  14175. }
  14176. } );
  14177. }
  14178. // Per-property setup
  14179. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14180. if ( !( prop in dataShow ) ) {
  14181. dataShow[ prop ] = propTween.start;
  14182. if ( hidden ) {
  14183. propTween.end = propTween.start;
  14184. propTween.start = 0;
  14185. }
  14186. }
  14187. }
  14188. }
  14189. function propFilter( props, specialEasing ) {
  14190. var index, name, easing, value, hooks;
  14191. // camelCase, specialEasing and expand cssHook pass
  14192. for ( index in props ) {
  14193. name = camelCase( index );
  14194. easing = specialEasing[ name ];
  14195. value = props[ index ];
  14196. if ( Array.isArray( value ) ) {
  14197. easing = value[ 1 ];
  14198. value = props[ index ] = value[ 0 ];
  14199. }
  14200. if ( index !== name ) {
  14201. props[ name ] = value;
  14202. delete props[ index ];
  14203. }
  14204. hooks = jQuery.cssHooks[ name ];
  14205. if ( hooks && "expand" in hooks ) {
  14206. value = hooks.expand( value );
  14207. delete props[ name ];
  14208. // Not quite $.extend, this won't overwrite existing keys.
  14209. // Reusing 'index' because we have the correct "name"
  14210. for ( index in value ) {
  14211. if ( !( index in props ) ) {
  14212. props[ index ] = value[ index ];
  14213. specialEasing[ index ] = easing;
  14214. }
  14215. }
  14216. } else {
  14217. specialEasing[ name ] = easing;
  14218. }
  14219. }
  14220. }
  14221. function Animation( elem, properties, options ) {
  14222. var result,
  14223. stopped,
  14224. index = 0,
  14225. length = Animation.prefilters.length,
  14226. deferred = jQuery.Deferred().always( function() {
  14227. // Don't match elem in the :animated selector
  14228. delete tick.elem;
  14229. } ),
  14230. tick = function() {
  14231. if ( stopped ) {
  14232. return false;
  14233. }
  14234. var currentTime = fxNow || createFxNow(),
  14235. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14236. // Support: Android 2.3 only
  14237. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14238. temp = remaining / animation.duration || 0,
  14239. percent = 1 - temp,
  14240. index = 0,
  14241. length = animation.tweens.length;
  14242. for ( ; index < length; index++ ) {
  14243. animation.tweens[ index ].run( percent );
  14244. }
  14245. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14246. // If there's more to do, yield
  14247. if ( percent < 1 && length ) {
  14248. return remaining;
  14249. }
  14250. // If this was an empty animation, synthesize a final progress notification
  14251. if ( !length ) {
  14252. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14253. }
  14254. // Resolve the animation and report its conclusion
  14255. deferred.resolveWith( elem, [ animation ] );
  14256. return false;
  14257. },
  14258. animation = deferred.promise( {
  14259. elem: elem,
  14260. props: jQuery.extend( {}, properties ),
  14261. opts: jQuery.extend( true, {
  14262. specialEasing: {},
  14263. easing: jQuery.easing._default
  14264. }, options ),
  14265. originalProperties: properties,
  14266. originalOptions: options,
  14267. startTime: fxNow || createFxNow(),
  14268. duration: options.duration,
  14269. tweens: [],
  14270. createTween: function( prop, end ) {
  14271. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14272. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14273. animation.tweens.push( tween );
  14274. return tween;
  14275. },
  14276. stop: function( gotoEnd ) {
  14277. var index = 0,
  14278. // If we are going to the end, we want to run all the tweens
  14279. // otherwise we skip this part
  14280. length = gotoEnd ? animation.tweens.length : 0;
  14281. if ( stopped ) {
  14282. return this;
  14283. }
  14284. stopped = true;
  14285. for ( ; index < length; index++ ) {
  14286. animation.tweens[ index ].run( 1 );
  14287. }
  14288. // Resolve when we played the last frame; otherwise, reject
  14289. if ( gotoEnd ) {
  14290. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14291. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14292. } else {
  14293. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14294. }
  14295. return this;
  14296. }
  14297. } ),
  14298. props = animation.props;
  14299. propFilter( props, animation.opts.specialEasing );
  14300. for ( ; index < length; index++ ) {
  14301. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14302. if ( result ) {
  14303. if ( isFunction( result.stop ) ) {
  14304. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14305. result.stop.bind( result );
  14306. }
  14307. return result;
  14308. }
  14309. }
  14310. jQuery.map( props, createTween, animation );
  14311. if ( isFunction( animation.opts.start ) ) {
  14312. animation.opts.start.call( elem, animation );
  14313. }
  14314. // Attach callbacks from options
  14315. animation
  14316. .progress( animation.opts.progress )
  14317. .done( animation.opts.done, animation.opts.complete )
  14318. .fail( animation.opts.fail )
  14319. .always( animation.opts.always );
  14320. jQuery.fx.timer(
  14321. jQuery.extend( tick, {
  14322. elem: elem,
  14323. anim: animation,
  14324. queue: animation.opts.queue
  14325. } )
  14326. );
  14327. return animation;
  14328. }
  14329. jQuery.Animation = jQuery.extend( Animation, {
  14330. tweeners: {
  14331. "*": [ function( prop, value ) {
  14332. var tween = this.createTween( prop, value );
  14333. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14334. return tween;
  14335. } ]
  14336. },
  14337. tweener: function( props, callback ) {
  14338. if ( isFunction( props ) ) {
  14339. callback = props;
  14340. props = [ "*" ];
  14341. } else {
  14342. props = props.match( rnothtmlwhite );
  14343. }
  14344. var prop,
  14345. index = 0,
  14346. length = props.length;
  14347. for ( ; index < length; index++ ) {
  14348. prop = props[ index ];
  14349. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14350. Animation.tweeners[ prop ].unshift( callback );
  14351. }
  14352. },
  14353. prefilters: [ defaultPrefilter ],
  14354. prefilter: function( callback, prepend ) {
  14355. if ( prepend ) {
  14356. Animation.prefilters.unshift( callback );
  14357. } else {
  14358. Animation.prefilters.push( callback );
  14359. }
  14360. }
  14361. } );
  14362. jQuery.speed = function( speed, easing, fn ) {
  14363. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14364. complete: fn || !fn && easing ||
  14365. isFunction( speed ) && speed,
  14366. duration: speed,
  14367. easing: fn && easing || easing && !isFunction( easing ) && easing
  14368. };
  14369. // Go to the end state if fx are off
  14370. if ( jQuery.fx.off ) {
  14371. opt.duration = 0;
  14372. } else {
  14373. if ( typeof opt.duration !== "number" ) {
  14374. if ( opt.duration in jQuery.fx.speeds ) {
  14375. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14376. } else {
  14377. opt.duration = jQuery.fx.speeds._default;
  14378. }
  14379. }
  14380. }
  14381. // Normalize opt.queue - true/undefined/null -> "fx"
  14382. if ( opt.queue == null || opt.queue === true ) {
  14383. opt.queue = "fx";
  14384. }
  14385. // Queueing
  14386. opt.old = opt.complete;
  14387. opt.complete = function() {
  14388. if ( isFunction( opt.old ) ) {
  14389. opt.old.call( this );
  14390. }
  14391. if ( opt.queue ) {
  14392. jQuery.dequeue( this, opt.queue );
  14393. }
  14394. };
  14395. return opt;
  14396. };
  14397. jQuery.fn.extend( {
  14398. fadeTo: function( speed, to, easing, callback ) {
  14399. // Show any hidden elements after setting opacity to 0
  14400. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14401. // Animate to the value specified
  14402. .end().animate( { opacity: to }, speed, easing, callback );
  14403. },
  14404. animate: function( prop, speed, easing, callback ) {
  14405. var empty = jQuery.isEmptyObject( prop ),
  14406. optall = jQuery.speed( speed, easing, callback ),
  14407. doAnimation = function() {
  14408. // Operate on a copy of prop so per-property easing won't be lost
  14409. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14410. // Empty animations, or finishing resolves immediately
  14411. if ( empty || dataPriv.get( this, "finish" ) ) {
  14412. anim.stop( true );
  14413. }
  14414. };
  14415. doAnimation.finish = doAnimation;
  14416. return empty || optall.queue === false ?
  14417. this.each( doAnimation ) :
  14418. this.queue( optall.queue, doAnimation );
  14419. },
  14420. stop: function( type, clearQueue, gotoEnd ) {
  14421. var stopQueue = function( hooks ) {
  14422. var stop = hooks.stop;
  14423. delete hooks.stop;
  14424. stop( gotoEnd );
  14425. };
  14426. if ( typeof type !== "string" ) {
  14427. gotoEnd = clearQueue;
  14428. clearQueue = type;
  14429. type = undefined;
  14430. }
  14431. if ( clearQueue && type !== false ) {
  14432. this.queue( type || "fx", [] );
  14433. }
  14434. return this.each( function() {
  14435. var dequeue = true,
  14436. index = type != null && type + "queueHooks",
  14437. timers = jQuery.timers,
  14438. data = dataPriv.get( this );
  14439. if ( index ) {
  14440. if ( data[ index ] && data[ index ].stop ) {
  14441. stopQueue( data[ index ] );
  14442. }
  14443. } else {
  14444. for ( index in data ) {
  14445. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14446. stopQueue( data[ index ] );
  14447. }
  14448. }
  14449. }
  14450. for ( index = timers.length; index--; ) {
  14451. if ( timers[ index ].elem === this &&
  14452. ( type == null || timers[ index ].queue === type ) ) {
  14453. timers[ index ].anim.stop( gotoEnd );
  14454. dequeue = false;
  14455. timers.splice( index, 1 );
  14456. }
  14457. }
  14458. // Start the next in the queue if the last step wasn't forced.
  14459. // Timers currently will call their complete callbacks, which
  14460. // will dequeue but only if they were gotoEnd.
  14461. if ( dequeue || !gotoEnd ) {
  14462. jQuery.dequeue( this, type );
  14463. }
  14464. } );
  14465. },
  14466. finish: function( type ) {
  14467. if ( type !== false ) {
  14468. type = type || "fx";
  14469. }
  14470. return this.each( function() {
  14471. var index,
  14472. data = dataPriv.get( this ),
  14473. queue = data[ type + "queue" ],
  14474. hooks = data[ type + "queueHooks" ],
  14475. timers = jQuery.timers,
  14476. length = queue ? queue.length : 0;
  14477. // Enable finishing flag on private data
  14478. data.finish = true;
  14479. // Empty the queue first
  14480. jQuery.queue( this, type, [] );
  14481. if ( hooks && hooks.stop ) {
  14482. hooks.stop.call( this, true );
  14483. }
  14484. // Look for any active animations, and finish them
  14485. for ( index = timers.length; index--; ) {
  14486. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14487. timers[ index ].anim.stop( true );
  14488. timers.splice( index, 1 );
  14489. }
  14490. }
  14491. // Look for any animations in the old queue and finish them
  14492. for ( index = 0; index < length; index++ ) {
  14493. if ( queue[ index ] && queue[ index ].finish ) {
  14494. queue[ index ].finish.call( this );
  14495. }
  14496. }
  14497. // Turn off finishing flag
  14498. delete data.finish;
  14499. } );
  14500. }
  14501. } );
  14502. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14503. var cssFn = jQuery.fn[ name ];
  14504. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14505. return speed == null || typeof speed === "boolean" ?
  14506. cssFn.apply( this, arguments ) :
  14507. this.animate( genFx( name, true ), speed, easing, callback );
  14508. };
  14509. } );
  14510. // Generate shortcuts for custom animations
  14511. jQuery.each( {
  14512. slideDown: genFx( "show" ),
  14513. slideUp: genFx( "hide" ),
  14514. slideToggle: genFx( "toggle" ),
  14515. fadeIn: { opacity: "show" },
  14516. fadeOut: { opacity: "hide" },
  14517. fadeToggle: { opacity: "toggle" }
  14518. }, function( name, props ) {
  14519. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14520. return this.animate( props, speed, easing, callback );
  14521. };
  14522. } );
  14523. jQuery.timers = [];
  14524. jQuery.fx.tick = function() {
  14525. var timer,
  14526. i = 0,
  14527. timers = jQuery.timers;
  14528. fxNow = Date.now();
  14529. for ( ; i < timers.length; i++ ) {
  14530. timer = timers[ i ];
  14531. // Run the timer and safely remove it when done (allowing for external removal)
  14532. if ( !timer() && timers[ i ] === timer ) {
  14533. timers.splice( i--, 1 );
  14534. }
  14535. }
  14536. if ( !timers.length ) {
  14537. jQuery.fx.stop();
  14538. }
  14539. fxNow = undefined;
  14540. };
  14541. jQuery.fx.timer = function( timer ) {
  14542. jQuery.timers.push( timer );
  14543. jQuery.fx.start();
  14544. };
  14545. jQuery.fx.interval = 13;
  14546. jQuery.fx.start = function() {
  14547. if ( inProgress ) {
  14548. return;
  14549. }
  14550. inProgress = true;
  14551. schedule();
  14552. };
  14553. jQuery.fx.stop = function() {
  14554. inProgress = null;
  14555. };
  14556. jQuery.fx.speeds = {
  14557. slow: 600,
  14558. fast: 200,
  14559. // Default speed
  14560. _default: 400
  14561. };
  14562. // Based off of the plugin by Clint Helfers, with permission.
  14563. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14564. jQuery.fn.delay = function( time, type ) {
  14565. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14566. type = type || "fx";
  14567. return this.queue( type, function( next, hooks ) {
  14568. var timeout = window.setTimeout( next, time );
  14569. hooks.stop = function() {
  14570. window.clearTimeout( timeout );
  14571. };
  14572. } );
  14573. };
  14574. ( function() {
  14575. var input = document.createElement( "input" ),
  14576. select = document.createElement( "select" ),
  14577. opt = select.appendChild( document.createElement( "option" ) );
  14578. input.type = "checkbox";
  14579. // Support: Android <=4.3 only
  14580. // Default value for a checkbox should be "on"
  14581. support.checkOn = input.value !== "";
  14582. // Support: IE <=11 only
  14583. // Must access selectedIndex to make default options select
  14584. support.optSelected = opt.selected;
  14585. // Support: IE <=11 only
  14586. // An input loses its value after becoming a radio
  14587. input = document.createElement( "input" );
  14588. input.value = "t";
  14589. input.type = "radio";
  14590. support.radioValue = input.value === "t";
  14591. } )();
  14592. var boolHook,
  14593. attrHandle = jQuery.expr.attrHandle;
  14594. jQuery.fn.extend( {
  14595. attr: function( name, value ) {
  14596. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14597. },
  14598. removeAttr: function( name ) {
  14599. return this.each( function() {
  14600. jQuery.removeAttr( this, name );
  14601. } );
  14602. }
  14603. } );
  14604. jQuery.extend( {
  14605. attr: function( elem, name, value ) {
  14606. var ret, hooks,
  14607. nType = elem.nodeType;
  14608. // Don't get/set attributes on text, comment and attribute nodes
  14609. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14610. return;
  14611. }
  14612. // Fallback to prop when attributes are not supported
  14613. if ( typeof elem.getAttribute === "undefined" ) {
  14614. return jQuery.prop( elem, name, value );
  14615. }
  14616. // Attribute hooks are determined by the lowercase version
  14617. // Grab necessary hook if one is defined
  14618. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14619. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14620. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14621. }
  14622. if ( value !== undefined ) {
  14623. if ( value === null ) {
  14624. jQuery.removeAttr( elem, name );
  14625. return;
  14626. }
  14627. if ( hooks && "set" in hooks &&
  14628. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14629. return ret;
  14630. }
  14631. elem.setAttribute( name, value + "" );
  14632. return value;
  14633. }
  14634. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14635. return ret;
  14636. }
  14637. ret = jQuery.find.attr( elem, name );
  14638. // Non-existent attributes return null, we normalize to undefined
  14639. return ret == null ? undefined : ret;
  14640. },
  14641. attrHooks: {
  14642. type: {
  14643. set: function( elem, value ) {
  14644. if ( !support.radioValue && value === "radio" &&
  14645. nodeName( elem, "input" ) ) {
  14646. var val = elem.value;
  14647. elem.setAttribute( "type", value );
  14648. if ( val ) {
  14649. elem.value = val;
  14650. }
  14651. return value;
  14652. }
  14653. }
  14654. }
  14655. },
  14656. removeAttr: function( elem, value ) {
  14657. var name,
  14658. i = 0,
  14659. // Attribute names can contain non-HTML whitespace characters
  14660. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14661. attrNames = value && value.match( rnothtmlwhite );
  14662. if ( attrNames && elem.nodeType === 1 ) {
  14663. while ( ( name = attrNames[ i++ ] ) ) {
  14664. elem.removeAttribute( name );
  14665. }
  14666. }
  14667. }
  14668. } );
  14669. // Hooks for boolean attributes
  14670. boolHook = {
  14671. set: function( elem, value, name ) {
  14672. if ( value === false ) {
  14673. // Remove boolean attributes when set to false
  14674. jQuery.removeAttr( elem, name );
  14675. } else {
  14676. elem.setAttribute( name, name );
  14677. }
  14678. return name;
  14679. }
  14680. };
  14681. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14682. var getter = attrHandle[ name ] || jQuery.find.attr;
  14683. attrHandle[ name ] = function( elem, name, isXML ) {
  14684. var ret, handle,
  14685. lowercaseName = name.toLowerCase();
  14686. if ( !isXML ) {
  14687. // Avoid an infinite loop by temporarily removing this function from the getter
  14688. handle = attrHandle[ lowercaseName ];
  14689. attrHandle[ lowercaseName ] = ret;
  14690. ret = getter( elem, name, isXML ) != null ?
  14691. lowercaseName :
  14692. null;
  14693. attrHandle[ lowercaseName ] = handle;
  14694. }
  14695. return ret;
  14696. };
  14697. } );
  14698. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14699. rclickable = /^(?:a|area)$/i;
  14700. jQuery.fn.extend( {
  14701. prop: function( name, value ) {
  14702. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14703. },
  14704. removeProp: function( name ) {
  14705. return this.each( function() {
  14706. delete this[ jQuery.propFix[ name ] || name ];
  14707. } );
  14708. }
  14709. } );
  14710. jQuery.extend( {
  14711. prop: function( elem, name, value ) {
  14712. var ret, hooks,
  14713. nType = elem.nodeType;
  14714. // Don't get/set properties on text, comment and attribute nodes
  14715. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14716. return;
  14717. }
  14718. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14719. // Fix name and attach hooks
  14720. name = jQuery.propFix[ name ] || name;
  14721. hooks = jQuery.propHooks[ name ];
  14722. }
  14723. if ( value !== undefined ) {
  14724. if ( hooks && "set" in hooks &&
  14725. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14726. return ret;
  14727. }
  14728. return ( elem[ name ] = value );
  14729. }
  14730. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14731. return ret;
  14732. }
  14733. return elem[ name ];
  14734. },
  14735. propHooks: {
  14736. tabIndex: {
  14737. get: function( elem ) {
  14738. // Support: IE <=9 - 11 only
  14739. // elem.tabIndex doesn't always return the
  14740. // correct value when it hasn't been explicitly set
  14741. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  14742. // Use proper attribute retrieval(#12072)
  14743. var tabindex = jQuery.find.attr( elem, "tabindex" );
  14744. if ( tabindex ) {
  14745. return parseInt( tabindex, 10 );
  14746. }
  14747. if (
  14748. rfocusable.test( elem.nodeName ) ||
  14749. rclickable.test( elem.nodeName ) &&
  14750. elem.href
  14751. ) {
  14752. return 0;
  14753. }
  14754. return -1;
  14755. }
  14756. }
  14757. },
  14758. propFix: {
  14759. "for": "htmlFor",
  14760. "class": "className"
  14761. }
  14762. } );
  14763. // Support: IE <=11 only
  14764. // Accessing the selectedIndex property
  14765. // forces the browser to respect setting selected
  14766. // on the option
  14767. // The getter ensures a default option is selected
  14768. // when in an optgroup
  14769. // eslint rule "no-unused-expressions" is disabled for this code
  14770. // since it considers such accessions noop
  14771. if ( !support.optSelected ) {
  14772. jQuery.propHooks.selected = {
  14773. get: function( elem ) {
  14774. /* eslint no-unused-expressions: "off" */
  14775. var parent = elem.parentNode;
  14776. if ( parent && parent.parentNode ) {
  14777. parent.parentNode.selectedIndex;
  14778. }
  14779. return null;
  14780. },
  14781. set: function( elem ) {
  14782. /* eslint no-unused-expressions: "off" */
  14783. var parent = elem.parentNode;
  14784. if ( parent ) {
  14785. parent.selectedIndex;
  14786. if ( parent.parentNode ) {
  14787. parent.parentNode.selectedIndex;
  14788. }
  14789. }
  14790. }
  14791. };
  14792. }
  14793. jQuery.each( [
  14794. "tabIndex",
  14795. "readOnly",
  14796. "maxLength",
  14797. "cellSpacing",
  14798. "cellPadding",
  14799. "rowSpan",
  14800. "colSpan",
  14801. "useMap",
  14802. "frameBorder",
  14803. "contentEditable"
  14804. ], function() {
  14805. jQuery.propFix[ this.toLowerCase() ] = this;
  14806. } );
  14807. // Strip and collapse whitespace according to HTML spec
  14808. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  14809. function stripAndCollapse( value ) {
  14810. var tokens = value.match( rnothtmlwhite ) || [];
  14811. return tokens.join( " " );
  14812. }
  14813. function getClass( elem ) {
  14814. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  14815. }
  14816. function classesToArray( value ) {
  14817. if ( Array.isArray( value ) ) {
  14818. return value;
  14819. }
  14820. if ( typeof value === "string" ) {
  14821. return value.match( rnothtmlwhite ) || [];
  14822. }
  14823. return [];
  14824. }
  14825. jQuery.fn.extend( {
  14826. addClass: function( value ) {
  14827. var classes, elem, cur, curValue, clazz, j, finalValue,
  14828. i = 0;
  14829. if ( isFunction( value ) ) {
  14830. return this.each( function( j ) {
  14831. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  14832. } );
  14833. }
  14834. classes = classesToArray( value );
  14835. if ( classes.length ) {
  14836. while ( ( elem = this[ i++ ] ) ) {
  14837. curValue = getClass( elem );
  14838. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14839. if ( cur ) {
  14840. j = 0;
  14841. while ( ( clazz = classes[ j++ ] ) ) {
  14842. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  14843. cur += clazz + " ";
  14844. }
  14845. }
  14846. // Only assign if different to avoid unneeded rendering.
  14847. finalValue = stripAndCollapse( cur );
  14848. if ( curValue !== finalValue ) {
  14849. elem.setAttribute( "class", finalValue );
  14850. }
  14851. }
  14852. }
  14853. }
  14854. return this;
  14855. },
  14856. removeClass: function( value ) {
  14857. var classes, elem, cur, curValue, clazz, j, finalValue,
  14858. i = 0;
  14859. if ( isFunction( value ) ) {
  14860. return this.each( function( j ) {
  14861. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  14862. } );
  14863. }
  14864. if ( !arguments.length ) {
  14865. return this.attr( "class", "" );
  14866. }
  14867. classes = classesToArray( value );
  14868. if ( classes.length ) {
  14869. while ( ( elem = this[ i++ ] ) ) {
  14870. curValue = getClass( elem );
  14871. // This expression is here for better compressibility (see addClass)
  14872. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14873. if ( cur ) {
  14874. j = 0;
  14875. while ( ( clazz = classes[ j++ ] ) ) {
  14876. // Remove *all* instances
  14877. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  14878. cur = cur.replace( " " + clazz + " ", " " );
  14879. }
  14880. }
  14881. // Only assign if different to avoid unneeded rendering.
  14882. finalValue = stripAndCollapse( cur );
  14883. if ( curValue !== finalValue ) {
  14884. elem.setAttribute( "class", finalValue );
  14885. }
  14886. }
  14887. }
  14888. }
  14889. return this;
  14890. },
  14891. toggleClass: function( value, stateVal ) {
  14892. var type = typeof value,
  14893. isValidValue = type === "string" || Array.isArray( value );
  14894. if ( typeof stateVal === "boolean" && isValidValue ) {
  14895. return stateVal ? this.addClass( value ) : this.removeClass( value );
  14896. }
  14897. if ( isFunction( value ) ) {
  14898. return this.each( function( i ) {
  14899. jQuery( this ).toggleClass(
  14900. value.call( this, i, getClass( this ), stateVal ),
  14901. stateVal
  14902. );
  14903. } );
  14904. }
  14905. return this.each( function() {
  14906. var className, i, self, classNames;
  14907. if ( isValidValue ) {
  14908. // Toggle individual class names
  14909. i = 0;
  14910. self = jQuery( this );
  14911. classNames = classesToArray( value );
  14912. while ( ( className = classNames[ i++ ] ) ) {
  14913. // Check each className given, space separated list
  14914. if ( self.hasClass( className ) ) {
  14915. self.removeClass( className );
  14916. } else {
  14917. self.addClass( className );
  14918. }
  14919. }
  14920. // Toggle whole class name
  14921. } else if ( value === undefined || type === "boolean" ) {
  14922. className = getClass( this );
  14923. if ( className ) {
  14924. // Store className if set
  14925. dataPriv.set( this, "__className__", className );
  14926. }
  14927. // If the element has a class name or if we're passed `false`,
  14928. // then remove the whole classname (if there was one, the above saved it).
  14929. // Otherwise bring back whatever was previously saved (if anything),
  14930. // falling back to the empty string if nothing was stored.
  14931. if ( this.setAttribute ) {
  14932. this.setAttribute( "class",
  14933. className || value === false ?
  14934. "" :
  14935. dataPriv.get( this, "__className__" ) || ""
  14936. );
  14937. }
  14938. }
  14939. } );
  14940. },
  14941. hasClass: function( selector ) {
  14942. var className, elem,
  14943. i = 0;
  14944. className = " " + selector + " ";
  14945. while ( ( elem = this[ i++ ] ) ) {
  14946. if ( elem.nodeType === 1 &&
  14947. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  14948. return true;
  14949. }
  14950. }
  14951. return false;
  14952. }
  14953. } );
  14954. var rreturn = /\r/g;
  14955. jQuery.fn.extend( {
  14956. val: function( value ) {
  14957. var hooks, ret, valueIsFunction,
  14958. elem = this[ 0 ];
  14959. if ( !arguments.length ) {
  14960. if ( elem ) {
  14961. hooks = jQuery.valHooks[ elem.type ] ||
  14962. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  14963. if ( hooks &&
  14964. "get" in hooks &&
  14965. ( ret = hooks.get( elem, "value" ) ) !== undefined
  14966. ) {
  14967. return ret;
  14968. }
  14969. ret = elem.value;
  14970. // Handle most common string cases
  14971. if ( typeof ret === "string" ) {
  14972. return ret.replace( rreturn, "" );
  14973. }
  14974. // Handle cases where value is null/undef or number
  14975. return ret == null ? "" : ret;
  14976. }
  14977. return;
  14978. }
  14979. valueIsFunction = isFunction( value );
  14980. return this.each( function( i ) {
  14981. var val;
  14982. if ( this.nodeType !== 1 ) {
  14983. return;
  14984. }
  14985. if ( valueIsFunction ) {
  14986. val = value.call( this, i, jQuery( this ).val() );
  14987. } else {
  14988. val = value;
  14989. }
  14990. // Treat null/undefined as ""; convert numbers to string
  14991. if ( val == null ) {
  14992. val = "";
  14993. } else if ( typeof val === "number" ) {
  14994. val += "";
  14995. } else if ( Array.isArray( val ) ) {
  14996. val = jQuery.map( val, function( value ) {
  14997. return value == null ? "" : value + "";
  14998. } );
  14999. }
  15000. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15001. // If set returns undefined, fall back to normal setting
  15002. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15003. this.value = val;
  15004. }
  15005. } );
  15006. }
  15007. } );
  15008. jQuery.extend( {
  15009. valHooks: {
  15010. option: {
  15011. get: function( elem ) {
  15012. var val = jQuery.find.attr( elem, "value" );
  15013. return val != null ?
  15014. val :
  15015. // Support: IE <=10 - 11 only
  15016. // option.text throws exceptions (#14686, #14858)
  15017. // Strip and collapse whitespace
  15018. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15019. stripAndCollapse( jQuery.text( elem ) );
  15020. }
  15021. },
  15022. select: {
  15023. get: function( elem ) {
  15024. var value, option, i,
  15025. options = elem.options,
  15026. index = elem.selectedIndex,
  15027. one = elem.type === "select-one",
  15028. values = one ? null : [],
  15029. max = one ? index + 1 : options.length;
  15030. if ( index < 0 ) {
  15031. i = max;
  15032. } else {
  15033. i = one ? index : 0;
  15034. }
  15035. // Loop through all the selected options
  15036. for ( ; i < max; i++ ) {
  15037. option = options[ i ];
  15038. // Support: IE <=9 only
  15039. // IE8-9 doesn't update selected after form reset (#2551)
  15040. if ( ( option.selected || i === index ) &&
  15041. // Don't return options that are disabled or in a disabled optgroup
  15042. !option.disabled &&
  15043. ( !option.parentNode.disabled ||
  15044. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15045. // Get the specific value for the option
  15046. value = jQuery( option ).val();
  15047. // We don't need an array for one selects
  15048. if ( one ) {
  15049. return value;
  15050. }
  15051. // Multi-Selects return an array
  15052. values.push( value );
  15053. }
  15054. }
  15055. return values;
  15056. },
  15057. set: function( elem, value ) {
  15058. var optionSet, option,
  15059. options = elem.options,
  15060. values = jQuery.makeArray( value ),
  15061. i = options.length;
  15062. while ( i-- ) {
  15063. option = options[ i ];
  15064. /* eslint-disable no-cond-assign */
  15065. if ( option.selected =
  15066. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15067. ) {
  15068. optionSet = true;
  15069. }
  15070. /* eslint-enable no-cond-assign */
  15071. }
  15072. // Force browsers to behave consistently when non-matching value is set
  15073. if ( !optionSet ) {
  15074. elem.selectedIndex = -1;
  15075. }
  15076. return values;
  15077. }
  15078. }
  15079. }
  15080. } );
  15081. // Radios and checkboxes getter/setter
  15082. jQuery.each( [ "radio", "checkbox" ], function() {
  15083. jQuery.valHooks[ this ] = {
  15084. set: function( elem, value ) {
  15085. if ( Array.isArray( value ) ) {
  15086. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15087. }
  15088. }
  15089. };
  15090. if ( !support.checkOn ) {
  15091. jQuery.valHooks[ this ].get = function( elem ) {
  15092. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15093. };
  15094. }
  15095. } );
  15096. // Return jQuery for attributes-only inclusion
  15097. support.focusin = "onfocusin" in window;
  15098. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15099. stopPropagationCallback = function( e ) {
  15100. e.stopPropagation();
  15101. };
  15102. jQuery.extend( jQuery.event, {
  15103. trigger: function( event, data, elem, onlyHandlers ) {
  15104. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15105. eventPath = [ elem || document ],
  15106. type = hasOwn.call( event, "type" ) ? event.type : event,
  15107. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15108. cur = lastElement = tmp = elem = elem || document;
  15109. // Don't do events on text and comment nodes
  15110. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15111. return;
  15112. }
  15113. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15114. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15115. return;
  15116. }
  15117. if ( type.indexOf( "." ) > -1 ) {
  15118. // Namespaced trigger; create a regexp to match event type in handle()
  15119. namespaces = type.split( "." );
  15120. type = namespaces.shift();
  15121. namespaces.sort();
  15122. }
  15123. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15124. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15125. event = event[ jQuery.expando ] ?
  15126. event :
  15127. new jQuery.Event( type, typeof event === "object" && event );
  15128. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15129. event.isTrigger = onlyHandlers ? 2 : 3;
  15130. event.namespace = namespaces.join( "." );
  15131. event.rnamespace = event.namespace ?
  15132. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15133. null;
  15134. // Clean up the event in case it is being reused
  15135. event.result = undefined;
  15136. if ( !event.target ) {
  15137. event.target = elem;
  15138. }
  15139. // Clone any incoming data and prepend the event, creating the handler arg list
  15140. data = data == null ?
  15141. [ event ] :
  15142. jQuery.makeArray( data, [ event ] );
  15143. // Allow special events to draw outside the lines
  15144. special = jQuery.event.special[ type ] || {};
  15145. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15146. return;
  15147. }
  15148. // Determine event propagation path in advance, per W3C events spec (#9951)
  15149. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15150. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15151. bubbleType = special.delegateType || type;
  15152. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15153. cur = cur.parentNode;
  15154. }
  15155. for ( ; cur; cur = cur.parentNode ) {
  15156. eventPath.push( cur );
  15157. tmp = cur;
  15158. }
  15159. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15160. if ( tmp === ( elem.ownerDocument || document ) ) {
  15161. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15162. }
  15163. }
  15164. // Fire handlers on the event path
  15165. i = 0;
  15166. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15167. lastElement = cur;
  15168. event.type = i > 1 ?
  15169. bubbleType :
  15170. special.bindType || type;
  15171. // jQuery handler
  15172. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15173. dataPriv.get( cur, "handle" );
  15174. if ( handle ) {
  15175. handle.apply( cur, data );
  15176. }
  15177. // Native handler
  15178. handle = ontype && cur[ ontype ];
  15179. if ( handle && handle.apply && acceptData( cur ) ) {
  15180. event.result = handle.apply( cur, data );
  15181. if ( event.result === false ) {
  15182. event.preventDefault();
  15183. }
  15184. }
  15185. }
  15186. event.type = type;
  15187. // If nobody prevented the default action, do it now
  15188. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15189. if ( ( !special._default ||
  15190. special._default.apply( eventPath.pop(), data ) === false ) &&
  15191. acceptData( elem ) ) {
  15192. // Call a native DOM method on the target with the same name as the event.
  15193. // Don't do default actions on window, that's where global variables be (#6170)
  15194. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15195. // Don't re-trigger an onFOO event when we call its FOO() method
  15196. tmp = elem[ ontype ];
  15197. if ( tmp ) {
  15198. elem[ ontype ] = null;
  15199. }
  15200. // Prevent re-triggering of the same event, since we already bubbled it above
  15201. jQuery.event.triggered = type;
  15202. if ( event.isPropagationStopped() ) {
  15203. lastElement.addEventListener( type, stopPropagationCallback );
  15204. }
  15205. elem[ type ]();
  15206. if ( event.isPropagationStopped() ) {
  15207. lastElement.removeEventListener( type, stopPropagationCallback );
  15208. }
  15209. jQuery.event.triggered = undefined;
  15210. if ( tmp ) {
  15211. elem[ ontype ] = tmp;
  15212. }
  15213. }
  15214. }
  15215. }
  15216. return event.result;
  15217. },
  15218. // Piggyback on a donor event to simulate a different one
  15219. // Used only for `focus(in | out)` events
  15220. simulate: function( type, elem, event ) {
  15221. var e = jQuery.extend(
  15222. new jQuery.Event(),
  15223. event,
  15224. {
  15225. type: type,
  15226. isSimulated: true
  15227. }
  15228. );
  15229. jQuery.event.trigger( e, null, elem );
  15230. }
  15231. } );
  15232. jQuery.fn.extend( {
  15233. trigger: function( type, data ) {
  15234. return this.each( function() {
  15235. jQuery.event.trigger( type, data, this );
  15236. } );
  15237. },
  15238. triggerHandler: function( type, data ) {
  15239. var elem = this[ 0 ];
  15240. if ( elem ) {
  15241. return jQuery.event.trigger( type, data, elem, true );
  15242. }
  15243. }
  15244. } );
  15245. // Support: Firefox <=44
  15246. // Firefox doesn't have focus(in | out) events
  15247. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15248. //
  15249. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15250. // focus(in | out) events fire after focus & blur events,
  15251. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15252. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15253. if ( !support.focusin ) {
  15254. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15255. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15256. var handler = function( event ) {
  15257. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15258. };
  15259. jQuery.event.special[ fix ] = {
  15260. setup: function() {
  15261. var doc = this.ownerDocument || this,
  15262. attaches = dataPriv.access( doc, fix );
  15263. if ( !attaches ) {
  15264. doc.addEventListener( orig, handler, true );
  15265. }
  15266. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15267. },
  15268. teardown: function() {
  15269. var doc = this.ownerDocument || this,
  15270. attaches = dataPriv.access( doc, fix ) - 1;
  15271. if ( !attaches ) {
  15272. doc.removeEventListener( orig, handler, true );
  15273. dataPriv.remove( doc, fix );
  15274. } else {
  15275. dataPriv.access( doc, fix, attaches );
  15276. }
  15277. }
  15278. };
  15279. } );
  15280. }
  15281. var location = window.location;
  15282. var nonce = Date.now();
  15283. var rquery = ( /\?/ );
  15284. // Cross-browser xml parsing
  15285. jQuery.parseXML = function( data ) {
  15286. var xml;
  15287. if ( !data || typeof data !== "string" ) {
  15288. return null;
  15289. }
  15290. // Support: IE 9 - 11 only
  15291. // IE throws on parseFromString with invalid input.
  15292. try {
  15293. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15294. } catch ( e ) {
  15295. xml = undefined;
  15296. }
  15297. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15298. jQuery.error( "Invalid XML: " + data );
  15299. }
  15300. return xml;
  15301. };
  15302. var
  15303. rbracket = /\[\]$/,
  15304. rCRLF = /\r?\n/g,
  15305. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15306. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15307. function buildParams( prefix, obj, traditional, add ) {
  15308. var name;
  15309. if ( Array.isArray( obj ) ) {
  15310. // Serialize array item.
  15311. jQuery.each( obj, function( i, v ) {
  15312. if ( traditional || rbracket.test( prefix ) ) {
  15313. // Treat each array item as a scalar.
  15314. add( prefix, v );
  15315. } else {
  15316. // Item is non-scalar (array or object), encode its numeric index.
  15317. buildParams(
  15318. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15319. v,
  15320. traditional,
  15321. add
  15322. );
  15323. }
  15324. } );
  15325. } else if ( !traditional && toType( obj ) === "object" ) {
  15326. // Serialize object item.
  15327. for ( name in obj ) {
  15328. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15329. }
  15330. } else {
  15331. // Serialize scalar item.
  15332. add( prefix, obj );
  15333. }
  15334. }
  15335. // Serialize an array of form elements or a set of
  15336. // key/values into a query string
  15337. jQuery.param = function( a, traditional ) {
  15338. var prefix,
  15339. s = [],
  15340. add = function( key, valueOrFunction ) {
  15341. // If value is a function, invoke it and use its return value
  15342. var value = isFunction( valueOrFunction ) ?
  15343. valueOrFunction() :
  15344. valueOrFunction;
  15345. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15346. encodeURIComponent( value == null ? "" : value );
  15347. };
  15348. if ( a == null ) {
  15349. return "";
  15350. }
  15351. // If an array was passed in, assume that it is an array of form elements.
  15352. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15353. // Serialize the form elements
  15354. jQuery.each( a, function() {
  15355. add( this.name, this.value );
  15356. } );
  15357. } else {
  15358. // If traditional, encode the "old" way (the way 1.3.2 or older
  15359. // did it), otherwise encode params recursively.
  15360. for ( prefix in a ) {
  15361. buildParams( prefix, a[ prefix ], traditional, add );
  15362. }
  15363. }
  15364. // Return the resulting serialization
  15365. return s.join( "&" );
  15366. };
  15367. jQuery.fn.extend( {
  15368. serialize: function() {
  15369. return jQuery.param( this.serializeArray() );
  15370. },
  15371. serializeArray: function() {
  15372. return this.map( function() {
  15373. // Can add propHook for "elements" to filter or add form elements
  15374. var elements = jQuery.prop( this, "elements" );
  15375. return elements ? jQuery.makeArray( elements ) : this;
  15376. } )
  15377. .filter( function() {
  15378. var type = this.type;
  15379. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15380. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15381. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15382. ( this.checked || !rcheckableType.test( type ) );
  15383. } )
  15384. .map( function( i, elem ) {
  15385. var val = jQuery( this ).val();
  15386. if ( val == null ) {
  15387. return null;
  15388. }
  15389. if ( Array.isArray( val ) ) {
  15390. return jQuery.map( val, function( val ) {
  15391. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15392. } );
  15393. }
  15394. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15395. } ).get();
  15396. }
  15397. } );
  15398. var
  15399. r20 = /%20/g,
  15400. rhash = /#.*$/,
  15401. rantiCache = /([?&])_=[^&]*/,
  15402. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15403. // #7653, #8125, #8152: local protocol detection
  15404. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15405. rnoContent = /^(?:GET|HEAD)$/,
  15406. rprotocol = /^\/\//,
  15407. /* Prefilters
  15408. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15409. * 2) These are called:
  15410. * - BEFORE asking for a transport
  15411. * - AFTER param serialization (s.data is a string if s.processData is true)
  15412. * 3) key is the dataType
  15413. * 4) the catchall symbol "*" can be used
  15414. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15415. */
  15416. prefilters = {},
  15417. /* Transports bindings
  15418. * 1) key is the dataType
  15419. * 2) the catchall symbol "*" can be used
  15420. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15421. */
  15422. transports = {},
  15423. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15424. allTypes = "*/".concat( "*" ),
  15425. // Anchor tag for parsing the document origin
  15426. originAnchor = document.createElement( "a" );
  15427. originAnchor.href = location.href;
  15428. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15429. function addToPrefiltersOrTransports( structure ) {
  15430. // dataTypeExpression is optional and defaults to "*"
  15431. return function( dataTypeExpression, func ) {
  15432. if ( typeof dataTypeExpression !== "string" ) {
  15433. func = dataTypeExpression;
  15434. dataTypeExpression = "*";
  15435. }
  15436. var dataType,
  15437. i = 0,
  15438. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15439. if ( isFunction( func ) ) {
  15440. // For each dataType in the dataTypeExpression
  15441. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15442. // Prepend if requested
  15443. if ( dataType[ 0 ] === "+" ) {
  15444. dataType = dataType.slice( 1 ) || "*";
  15445. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15446. // Otherwise append
  15447. } else {
  15448. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15449. }
  15450. }
  15451. }
  15452. };
  15453. }
  15454. // Base inspection function for prefilters and transports
  15455. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15456. var inspected = {},
  15457. seekingTransport = ( structure === transports );
  15458. function inspect( dataType ) {
  15459. var selected;
  15460. inspected[ dataType ] = true;
  15461. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15462. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15463. if ( typeof dataTypeOrTransport === "string" &&
  15464. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15465. options.dataTypes.unshift( dataTypeOrTransport );
  15466. inspect( dataTypeOrTransport );
  15467. return false;
  15468. } else if ( seekingTransport ) {
  15469. return !( selected = dataTypeOrTransport );
  15470. }
  15471. } );
  15472. return selected;
  15473. }
  15474. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15475. }
  15476. // A special extend for ajax options
  15477. // that takes "flat" options (not to be deep extended)
  15478. // Fixes #9887
  15479. function ajaxExtend( target, src ) {
  15480. var key, deep,
  15481. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15482. for ( key in src ) {
  15483. if ( src[ key ] !== undefined ) {
  15484. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15485. }
  15486. }
  15487. if ( deep ) {
  15488. jQuery.extend( true, target, deep );
  15489. }
  15490. return target;
  15491. }
  15492. /* Handles responses to an ajax request:
  15493. * - finds the right dataType (mediates between content-type and expected dataType)
  15494. * - returns the corresponding response
  15495. */
  15496. function ajaxHandleResponses( s, jqXHR, responses ) {
  15497. var ct, type, finalDataType, firstDataType,
  15498. contents = s.contents,
  15499. dataTypes = s.dataTypes;
  15500. // Remove auto dataType and get content-type in the process
  15501. while ( dataTypes[ 0 ] === "*" ) {
  15502. dataTypes.shift();
  15503. if ( ct === undefined ) {
  15504. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15505. }
  15506. }
  15507. // Check if we're dealing with a known content-type
  15508. if ( ct ) {
  15509. for ( type in contents ) {
  15510. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15511. dataTypes.unshift( type );
  15512. break;
  15513. }
  15514. }
  15515. }
  15516. // Check to see if we have a response for the expected dataType
  15517. if ( dataTypes[ 0 ] in responses ) {
  15518. finalDataType = dataTypes[ 0 ];
  15519. } else {
  15520. // Try convertible dataTypes
  15521. for ( type in responses ) {
  15522. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15523. finalDataType = type;
  15524. break;
  15525. }
  15526. if ( !firstDataType ) {
  15527. firstDataType = type;
  15528. }
  15529. }
  15530. // Or just use first one
  15531. finalDataType = finalDataType || firstDataType;
  15532. }
  15533. // If we found a dataType
  15534. // We add the dataType to the list if needed
  15535. // and return the corresponding response
  15536. if ( finalDataType ) {
  15537. if ( finalDataType !== dataTypes[ 0 ] ) {
  15538. dataTypes.unshift( finalDataType );
  15539. }
  15540. return responses[ finalDataType ];
  15541. }
  15542. }
  15543. /* Chain conversions given the request and the original response
  15544. * Also sets the responseXXX fields on the jqXHR instance
  15545. */
  15546. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15547. var conv2, current, conv, tmp, prev,
  15548. converters = {},
  15549. // Work with a copy of dataTypes in case we need to modify it for conversion
  15550. dataTypes = s.dataTypes.slice();
  15551. // Create converters map with lowercased keys
  15552. if ( dataTypes[ 1 ] ) {
  15553. for ( conv in s.converters ) {
  15554. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15555. }
  15556. }
  15557. current = dataTypes.shift();
  15558. // Convert to each sequential dataType
  15559. while ( current ) {
  15560. if ( s.responseFields[ current ] ) {
  15561. jqXHR[ s.responseFields[ current ] ] = response;
  15562. }
  15563. // Apply the dataFilter if provided
  15564. if ( !prev && isSuccess && s.dataFilter ) {
  15565. response = s.dataFilter( response, s.dataType );
  15566. }
  15567. prev = current;
  15568. current = dataTypes.shift();
  15569. if ( current ) {
  15570. // There's only work to do if current dataType is non-auto
  15571. if ( current === "*" ) {
  15572. current = prev;
  15573. // Convert response if prev dataType is non-auto and differs from current
  15574. } else if ( prev !== "*" && prev !== current ) {
  15575. // Seek a direct converter
  15576. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15577. // If none found, seek a pair
  15578. if ( !conv ) {
  15579. for ( conv2 in converters ) {
  15580. // If conv2 outputs current
  15581. tmp = conv2.split( " " );
  15582. if ( tmp[ 1 ] === current ) {
  15583. // If prev can be converted to accepted input
  15584. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15585. converters[ "* " + tmp[ 0 ] ];
  15586. if ( conv ) {
  15587. // Condense equivalence converters
  15588. if ( conv === true ) {
  15589. conv = converters[ conv2 ];
  15590. // Otherwise, insert the intermediate dataType
  15591. } else if ( converters[ conv2 ] !== true ) {
  15592. current = tmp[ 0 ];
  15593. dataTypes.unshift( tmp[ 1 ] );
  15594. }
  15595. break;
  15596. }
  15597. }
  15598. }
  15599. }
  15600. // Apply converter (if not an equivalence)
  15601. if ( conv !== true ) {
  15602. // Unless errors are allowed to bubble, catch and return them
  15603. if ( conv && s.throws ) {
  15604. response = conv( response );
  15605. } else {
  15606. try {
  15607. response = conv( response );
  15608. } catch ( e ) {
  15609. return {
  15610. state: "parsererror",
  15611. error: conv ? e : "No conversion from " + prev + " to " + current
  15612. };
  15613. }
  15614. }
  15615. }
  15616. }
  15617. }
  15618. }
  15619. return { state: "success", data: response };
  15620. }
  15621. jQuery.extend( {
  15622. // Counter for holding the number of active queries
  15623. active: 0,
  15624. // Last-Modified header cache for next request
  15625. lastModified: {},
  15626. etag: {},
  15627. ajaxSettings: {
  15628. url: location.href,
  15629. type: "GET",
  15630. isLocal: rlocalProtocol.test( location.protocol ),
  15631. global: true,
  15632. processData: true,
  15633. async: true,
  15634. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15635. /*
  15636. timeout: 0,
  15637. data: null,
  15638. dataType: null,
  15639. username: null,
  15640. password: null,
  15641. cache: null,
  15642. throws: false,
  15643. traditional: false,
  15644. headers: {},
  15645. */
  15646. accepts: {
  15647. "*": allTypes,
  15648. text: "text/plain",
  15649. html: "text/html",
  15650. xml: "application/xml, text/xml",
  15651. json: "application/json, text/javascript"
  15652. },
  15653. contents: {
  15654. xml: /\bxml\b/,
  15655. html: /\bhtml/,
  15656. json: /\bjson\b/
  15657. },
  15658. responseFields: {
  15659. xml: "responseXML",
  15660. text: "responseText",
  15661. json: "responseJSON"
  15662. },
  15663. // Data converters
  15664. // Keys separate source (or catchall "*") and destination types with a single space
  15665. converters: {
  15666. // Convert anything to text
  15667. "* text": String,
  15668. // Text to html (true = no transformation)
  15669. "text html": true,
  15670. // Evaluate text as a json expression
  15671. "text json": JSON.parse,
  15672. // Parse text as xml
  15673. "text xml": jQuery.parseXML
  15674. },
  15675. // For options that shouldn't be deep extended:
  15676. // you can add your own custom options here if
  15677. // and when you create one that shouldn't be
  15678. // deep extended (see ajaxExtend)
  15679. flatOptions: {
  15680. url: true,
  15681. context: true
  15682. }
  15683. },
  15684. // Creates a full fledged settings object into target
  15685. // with both ajaxSettings and settings fields.
  15686. // If target is omitted, writes into ajaxSettings.
  15687. ajaxSetup: function( target, settings ) {
  15688. return settings ?
  15689. // Building a settings object
  15690. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15691. // Extending ajaxSettings
  15692. ajaxExtend( jQuery.ajaxSettings, target );
  15693. },
  15694. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15695. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15696. // Main method
  15697. ajax: function( url, options ) {
  15698. // If url is an object, simulate pre-1.5 signature
  15699. if ( typeof url === "object" ) {
  15700. options = url;
  15701. url = undefined;
  15702. }
  15703. // Force options to be an object
  15704. options = options || {};
  15705. var transport,
  15706. // URL without anti-cache param
  15707. cacheURL,
  15708. // Response headers
  15709. responseHeadersString,
  15710. responseHeaders,
  15711. // timeout handle
  15712. timeoutTimer,
  15713. // Url cleanup var
  15714. urlAnchor,
  15715. // Request state (becomes false upon send and true upon completion)
  15716. completed,
  15717. // To know if global events are to be dispatched
  15718. fireGlobals,
  15719. // Loop variable
  15720. i,
  15721. // uncached part of the url
  15722. uncached,
  15723. // Create the final options object
  15724. s = jQuery.ajaxSetup( {}, options ),
  15725. // Callbacks context
  15726. callbackContext = s.context || s,
  15727. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  15728. globalEventContext = s.context &&
  15729. ( callbackContext.nodeType || callbackContext.jquery ) ?
  15730. jQuery( callbackContext ) :
  15731. jQuery.event,
  15732. // Deferreds
  15733. deferred = jQuery.Deferred(),
  15734. completeDeferred = jQuery.Callbacks( "once memory" ),
  15735. // Status-dependent callbacks
  15736. statusCode = s.statusCode || {},
  15737. // Headers (they are sent all at once)
  15738. requestHeaders = {},
  15739. requestHeadersNames = {},
  15740. // Default abort message
  15741. strAbort = "canceled",
  15742. // Fake xhr
  15743. jqXHR = {
  15744. readyState: 0,
  15745. // Builds headers hashtable if needed
  15746. getResponseHeader: function( key ) {
  15747. var match;
  15748. if ( completed ) {
  15749. if ( !responseHeaders ) {
  15750. responseHeaders = {};
  15751. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  15752. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  15753. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  15754. .concat( match[ 2 ] );
  15755. }
  15756. }
  15757. match = responseHeaders[ key.toLowerCase() + " " ];
  15758. }
  15759. return match == null ? null : match.join( ", " );
  15760. },
  15761. // Raw string
  15762. getAllResponseHeaders: function() {
  15763. return completed ? responseHeadersString : null;
  15764. },
  15765. // Caches the header
  15766. setRequestHeader: function( name, value ) {
  15767. if ( completed == null ) {
  15768. name = requestHeadersNames[ name.toLowerCase() ] =
  15769. requestHeadersNames[ name.toLowerCase() ] || name;
  15770. requestHeaders[ name ] = value;
  15771. }
  15772. return this;
  15773. },
  15774. // Overrides response content-type header
  15775. overrideMimeType: function( type ) {
  15776. if ( completed == null ) {
  15777. s.mimeType = type;
  15778. }
  15779. return this;
  15780. },
  15781. // Status-dependent callbacks
  15782. statusCode: function( map ) {
  15783. var code;
  15784. if ( map ) {
  15785. if ( completed ) {
  15786. // Execute the appropriate callbacks
  15787. jqXHR.always( map[ jqXHR.status ] );
  15788. } else {
  15789. // Lazy-add the new callbacks in a way that preserves old ones
  15790. for ( code in map ) {
  15791. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  15792. }
  15793. }
  15794. }
  15795. return this;
  15796. },
  15797. // Cancel the request
  15798. abort: function( statusText ) {
  15799. var finalText = statusText || strAbort;
  15800. if ( transport ) {
  15801. transport.abort( finalText );
  15802. }
  15803. done( 0, finalText );
  15804. return this;
  15805. }
  15806. };
  15807. // Attach deferreds
  15808. deferred.promise( jqXHR );
  15809. // Add protocol if not provided (prefilters might expect it)
  15810. // Handle falsy url in the settings object (#10093: consistency with old signature)
  15811. // We also use the url parameter if available
  15812. s.url = ( ( url || s.url || location.href ) + "" )
  15813. .replace( rprotocol, location.protocol + "//" );
  15814. // Alias method option to type as per ticket #12004
  15815. s.type = options.method || options.type || s.method || s.type;
  15816. // Extract dataTypes list
  15817. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  15818. // A cross-domain request is in order when the origin doesn't match the current origin.
  15819. if ( s.crossDomain == null ) {
  15820. urlAnchor = document.createElement( "a" );
  15821. // Support: IE <=8 - 11, Edge 12 - 15
  15822. // IE throws exception on accessing the href property if url is malformed,
  15823. // e.g. http://example.com:80x/
  15824. try {
  15825. urlAnchor.href = s.url;
  15826. // Support: IE <=8 - 11 only
  15827. // Anchor's host property isn't correctly set when s.url is relative
  15828. urlAnchor.href = urlAnchor.href;
  15829. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  15830. urlAnchor.protocol + "//" + urlAnchor.host;
  15831. } catch ( e ) {
  15832. // If there is an error parsing the URL, assume it is crossDomain,
  15833. // it can be rejected by the transport if it is invalid
  15834. s.crossDomain = true;
  15835. }
  15836. }
  15837. // Convert data if not already a string
  15838. if ( s.data && s.processData && typeof s.data !== "string" ) {
  15839. s.data = jQuery.param( s.data, s.traditional );
  15840. }
  15841. // Apply prefilters
  15842. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  15843. // If request was aborted inside a prefilter, stop there
  15844. if ( completed ) {
  15845. return jqXHR;
  15846. }
  15847. // We can fire global events as of now if asked to
  15848. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  15849. fireGlobals = jQuery.event && s.global;
  15850. // Watch for a new set of requests
  15851. if ( fireGlobals && jQuery.active++ === 0 ) {
  15852. jQuery.event.trigger( "ajaxStart" );
  15853. }
  15854. // Uppercase the type
  15855. s.type = s.type.toUpperCase();
  15856. // Determine if request has content
  15857. s.hasContent = !rnoContent.test( s.type );
  15858. // Save the URL in case we're toying with the If-Modified-Since
  15859. // and/or If-None-Match header later on
  15860. // Remove hash to simplify url manipulation
  15861. cacheURL = s.url.replace( rhash, "" );
  15862. // More options handling for requests with no content
  15863. if ( !s.hasContent ) {
  15864. // Remember the hash so we can put it back
  15865. uncached = s.url.slice( cacheURL.length );
  15866. // If data is available and should be processed, append data to url
  15867. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  15868. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  15869. // #9682: remove data so that it's not used in an eventual retry
  15870. delete s.data;
  15871. }
  15872. // Add or update anti-cache param if needed
  15873. if ( s.cache === false ) {
  15874. cacheURL = cacheURL.replace( rantiCache, "$1" );
  15875. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  15876. }
  15877. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  15878. s.url = cacheURL + uncached;
  15879. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  15880. } else if ( s.data && s.processData &&
  15881. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  15882. s.data = s.data.replace( r20, "+" );
  15883. }
  15884. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15885. if ( s.ifModified ) {
  15886. if ( jQuery.lastModified[ cacheURL ] ) {
  15887. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  15888. }
  15889. if ( jQuery.etag[ cacheURL ] ) {
  15890. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  15891. }
  15892. }
  15893. // Set the correct header, if data is being sent
  15894. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  15895. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  15896. }
  15897. // Set the Accepts header for the server, depending on the dataType
  15898. jqXHR.setRequestHeader(
  15899. "Accept",
  15900. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  15901. s.accepts[ s.dataTypes[ 0 ] ] +
  15902. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  15903. s.accepts[ "*" ]
  15904. );
  15905. // Check for headers option
  15906. for ( i in s.headers ) {
  15907. jqXHR.setRequestHeader( i, s.headers[ i ] );
  15908. }
  15909. // Allow custom headers/mimetypes and early abort
  15910. if ( s.beforeSend &&
  15911. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  15912. // Abort if not done already and return
  15913. return jqXHR.abort();
  15914. }
  15915. // Aborting is no longer a cancellation
  15916. strAbort = "abort";
  15917. // Install callbacks on deferreds
  15918. completeDeferred.add( s.complete );
  15919. jqXHR.done( s.success );
  15920. jqXHR.fail( s.error );
  15921. // Get transport
  15922. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  15923. // If no transport, we auto-abort
  15924. if ( !transport ) {
  15925. done( -1, "No Transport" );
  15926. } else {
  15927. jqXHR.readyState = 1;
  15928. // Send global event
  15929. if ( fireGlobals ) {
  15930. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  15931. }
  15932. // If request was aborted inside ajaxSend, stop there
  15933. if ( completed ) {
  15934. return jqXHR;
  15935. }
  15936. // Timeout
  15937. if ( s.async && s.timeout > 0 ) {
  15938. timeoutTimer = window.setTimeout( function() {
  15939. jqXHR.abort( "timeout" );
  15940. }, s.timeout );
  15941. }
  15942. try {
  15943. completed = false;
  15944. transport.send( requestHeaders, done );
  15945. } catch ( e ) {
  15946. // Rethrow post-completion exceptions
  15947. if ( completed ) {
  15948. throw e;
  15949. }
  15950. // Propagate others as results
  15951. done( -1, e );
  15952. }
  15953. }
  15954. // Callback for when everything is done
  15955. function done( status, nativeStatusText, responses, headers ) {
  15956. var isSuccess, success, error, response, modified,
  15957. statusText = nativeStatusText;
  15958. // Ignore repeat invocations
  15959. if ( completed ) {
  15960. return;
  15961. }
  15962. completed = true;
  15963. // Clear timeout if it exists
  15964. if ( timeoutTimer ) {
  15965. window.clearTimeout( timeoutTimer );
  15966. }
  15967. // Dereference transport for early garbage collection
  15968. // (no matter how long the jqXHR object will be used)
  15969. transport = undefined;
  15970. // Cache response headers
  15971. responseHeadersString = headers || "";
  15972. // Set readyState
  15973. jqXHR.readyState = status > 0 ? 4 : 0;
  15974. // Determine if successful
  15975. isSuccess = status >= 200 && status < 300 || status === 304;
  15976. // Get response data
  15977. if ( responses ) {
  15978. response = ajaxHandleResponses( s, jqXHR, responses );
  15979. }
  15980. // Convert no matter what (that way responseXXX fields are always set)
  15981. response = ajaxConvert( s, response, jqXHR, isSuccess );
  15982. // If successful, handle type chaining
  15983. if ( isSuccess ) {
  15984. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15985. if ( s.ifModified ) {
  15986. modified = jqXHR.getResponseHeader( "Last-Modified" );
  15987. if ( modified ) {
  15988. jQuery.lastModified[ cacheURL ] = modified;
  15989. }
  15990. modified = jqXHR.getResponseHeader( "etag" );
  15991. if ( modified ) {
  15992. jQuery.etag[ cacheURL ] = modified;
  15993. }
  15994. }
  15995. // if no content
  15996. if ( status === 204 || s.type === "HEAD" ) {
  15997. statusText = "nocontent";
  15998. // if not modified
  15999. } else if ( status === 304 ) {
  16000. statusText = "notmodified";
  16001. // If we have data, let's convert it
  16002. } else {
  16003. statusText = response.state;
  16004. success = response.data;
  16005. error = response.error;
  16006. isSuccess = !error;
  16007. }
  16008. } else {
  16009. // Extract error from statusText and normalize for non-aborts
  16010. error = statusText;
  16011. if ( status || !statusText ) {
  16012. statusText = "error";
  16013. if ( status < 0 ) {
  16014. status = 0;
  16015. }
  16016. }
  16017. }
  16018. // Set data for the fake xhr object
  16019. jqXHR.status = status;
  16020. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16021. // Success/Error
  16022. if ( isSuccess ) {
  16023. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16024. } else {
  16025. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16026. }
  16027. // Status-dependent callbacks
  16028. jqXHR.statusCode( statusCode );
  16029. statusCode = undefined;
  16030. if ( fireGlobals ) {
  16031. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16032. [ jqXHR, s, isSuccess ? success : error ] );
  16033. }
  16034. // Complete
  16035. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16036. if ( fireGlobals ) {
  16037. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16038. // Handle the global AJAX counter
  16039. if ( !( --jQuery.active ) ) {
  16040. jQuery.event.trigger( "ajaxStop" );
  16041. }
  16042. }
  16043. }
  16044. return jqXHR;
  16045. },
  16046. getJSON: function( url, data, callback ) {
  16047. return jQuery.get( url, data, callback, "json" );
  16048. },
  16049. getScript: function( url, callback ) {
  16050. return jQuery.get( url, undefined, callback, "script" );
  16051. }
  16052. } );
  16053. jQuery.each( [ "get", "post" ], function( i, method ) {
  16054. jQuery[ method ] = function( url, data, callback, type ) {
  16055. // Shift arguments if data argument was omitted
  16056. if ( isFunction( data ) ) {
  16057. type = type || callback;
  16058. callback = data;
  16059. data = undefined;
  16060. }
  16061. // The url can be an options object (which then must have .url)
  16062. return jQuery.ajax( jQuery.extend( {
  16063. url: url,
  16064. type: method,
  16065. dataType: type,
  16066. data: data,
  16067. success: callback
  16068. }, jQuery.isPlainObject( url ) && url ) );
  16069. };
  16070. } );
  16071. jQuery._evalUrl = function( url, options ) {
  16072. return jQuery.ajax( {
  16073. url: url,
  16074. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16075. type: "GET",
  16076. dataType: "script",
  16077. cache: true,
  16078. async: false,
  16079. global: false,
  16080. // Only evaluate the response if it is successful (gh-4126)
  16081. // dataFilter is not invoked for failure responses, so using it instead
  16082. // of the default converter is kludgy but it works.
  16083. converters: {
  16084. "text script": function() {}
  16085. },
  16086. dataFilter: function( response ) {
  16087. jQuery.globalEval( response, options );
  16088. }
  16089. } );
  16090. };
  16091. jQuery.fn.extend( {
  16092. wrapAll: function( html ) {
  16093. var wrap;
  16094. if ( this[ 0 ] ) {
  16095. if ( isFunction( html ) ) {
  16096. html = html.call( this[ 0 ] );
  16097. }
  16098. // The elements to wrap the target around
  16099. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16100. if ( this[ 0 ].parentNode ) {
  16101. wrap.insertBefore( this[ 0 ] );
  16102. }
  16103. wrap.map( function() {
  16104. var elem = this;
  16105. while ( elem.firstElementChild ) {
  16106. elem = elem.firstElementChild;
  16107. }
  16108. return elem;
  16109. } ).append( this );
  16110. }
  16111. return this;
  16112. },
  16113. wrapInner: function( html ) {
  16114. if ( isFunction( html ) ) {
  16115. return this.each( function( i ) {
  16116. jQuery( this ).wrapInner( html.call( this, i ) );
  16117. } );
  16118. }
  16119. return this.each( function() {
  16120. var self = jQuery( this ),
  16121. contents = self.contents();
  16122. if ( contents.length ) {
  16123. contents.wrapAll( html );
  16124. } else {
  16125. self.append( html );
  16126. }
  16127. } );
  16128. },
  16129. wrap: function( html ) {
  16130. var htmlIsFunction = isFunction( html );
  16131. return this.each( function( i ) {
  16132. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16133. } );
  16134. },
  16135. unwrap: function( selector ) {
  16136. this.parent( selector ).not( "body" ).each( function() {
  16137. jQuery( this ).replaceWith( this.childNodes );
  16138. } );
  16139. return this;
  16140. }
  16141. } );
  16142. jQuery.expr.pseudos.hidden = function( elem ) {
  16143. return !jQuery.expr.pseudos.visible( elem );
  16144. };
  16145. jQuery.expr.pseudos.visible = function( elem ) {
  16146. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16147. };
  16148. jQuery.ajaxSettings.xhr = function() {
  16149. try {
  16150. return new window.XMLHttpRequest();
  16151. } catch ( e ) {}
  16152. };
  16153. var xhrSuccessStatus = {
  16154. // File protocol always yields status code 0, assume 200
  16155. 0: 200,
  16156. // Support: IE <=9 only
  16157. // #1450: sometimes IE returns 1223 when it should be 204
  16158. 1223: 204
  16159. },
  16160. xhrSupported = jQuery.ajaxSettings.xhr();
  16161. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16162. support.ajax = xhrSupported = !!xhrSupported;
  16163. jQuery.ajaxTransport( function( options ) {
  16164. var callback, errorCallback;
  16165. // Cross domain only allowed if supported through XMLHttpRequest
  16166. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16167. return {
  16168. send: function( headers, complete ) {
  16169. var i,
  16170. xhr = options.xhr();
  16171. xhr.open(
  16172. options.type,
  16173. options.url,
  16174. options.async,
  16175. options.username,
  16176. options.password
  16177. );
  16178. // Apply custom fields if provided
  16179. if ( options.xhrFields ) {
  16180. for ( i in options.xhrFields ) {
  16181. xhr[ i ] = options.xhrFields[ i ];
  16182. }
  16183. }
  16184. // Override mime type if needed
  16185. if ( options.mimeType && xhr.overrideMimeType ) {
  16186. xhr.overrideMimeType( options.mimeType );
  16187. }
  16188. // X-Requested-With header
  16189. // For cross-domain requests, seeing as conditions for a preflight are
  16190. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16191. // (it can always be set on a per-request basis or even using ajaxSetup)
  16192. // For same-domain requests, won't change header if already provided.
  16193. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16194. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16195. }
  16196. // Set headers
  16197. for ( i in headers ) {
  16198. xhr.setRequestHeader( i, headers[ i ] );
  16199. }
  16200. // Callback
  16201. callback = function( type ) {
  16202. return function() {
  16203. if ( callback ) {
  16204. callback = errorCallback = xhr.onload =
  16205. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16206. xhr.onreadystatechange = null;
  16207. if ( type === "abort" ) {
  16208. xhr.abort();
  16209. } else if ( type === "error" ) {
  16210. // Support: IE <=9 only
  16211. // On a manual native abort, IE9 throws
  16212. // errors on any property access that is not readyState
  16213. if ( typeof xhr.status !== "number" ) {
  16214. complete( 0, "error" );
  16215. } else {
  16216. complete(
  16217. // File: protocol always yields status 0; see #8605, #14207
  16218. xhr.status,
  16219. xhr.statusText
  16220. );
  16221. }
  16222. } else {
  16223. complete(
  16224. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16225. xhr.statusText,
  16226. // Support: IE <=9 only
  16227. // IE9 has no XHR2 but throws on binary (trac-11426)
  16228. // For XHR2 non-text, let the caller handle it (gh-2498)
  16229. ( xhr.responseType || "text" ) !== "text" ||
  16230. typeof xhr.responseText !== "string" ?
  16231. { binary: xhr.response } :
  16232. { text: xhr.responseText },
  16233. xhr.getAllResponseHeaders()
  16234. );
  16235. }
  16236. }
  16237. };
  16238. };
  16239. // Listen to events
  16240. xhr.onload = callback();
  16241. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16242. // Support: IE 9 only
  16243. // Use onreadystatechange to replace onabort
  16244. // to handle uncaught aborts
  16245. if ( xhr.onabort !== undefined ) {
  16246. xhr.onabort = errorCallback;
  16247. } else {
  16248. xhr.onreadystatechange = function() {
  16249. // Check readyState before timeout as it changes
  16250. if ( xhr.readyState === 4 ) {
  16251. // Allow onerror to be called first,
  16252. // but that will not handle a native abort
  16253. // Also, save errorCallback to a variable
  16254. // as xhr.onerror cannot be accessed
  16255. window.setTimeout( function() {
  16256. if ( callback ) {
  16257. errorCallback();
  16258. }
  16259. } );
  16260. }
  16261. };
  16262. }
  16263. // Create the abort callback
  16264. callback = callback( "abort" );
  16265. try {
  16266. // Do send the request (this may raise an exception)
  16267. xhr.send( options.hasContent && options.data || null );
  16268. } catch ( e ) {
  16269. // #14683: Only rethrow if this hasn't been notified as an error yet
  16270. if ( callback ) {
  16271. throw e;
  16272. }
  16273. }
  16274. },
  16275. abort: function() {
  16276. if ( callback ) {
  16277. callback();
  16278. }
  16279. }
  16280. };
  16281. }
  16282. } );
  16283. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16284. jQuery.ajaxPrefilter( function( s ) {
  16285. if ( s.crossDomain ) {
  16286. s.contents.script = false;
  16287. }
  16288. } );
  16289. // Install script dataType
  16290. jQuery.ajaxSetup( {
  16291. accepts: {
  16292. script: "text/javascript, application/javascript, " +
  16293. "application/ecmascript, application/x-ecmascript"
  16294. },
  16295. contents: {
  16296. script: /\b(?:java|ecma)script\b/
  16297. },
  16298. converters: {
  16299. "text script": function( text ) {
  16300. jQuery.globalEval( text );
  16301. return text;
  16302. }
  16303. }
  16304. } );
  16305. // Handle cache's special case and crossDomain
  16306. jQuery.ajaxPrefilter( "script", function( s ) {
  16307. if ( s.cache === undefined ) {
  16308. s.cache = false;
  16309. }
  16310. if ( s.crossDomain ) {
  16311. s.type = "GET";
  16312. }
  16313. } );
  16314. // Bind script tag hack transport
  16315. jQuery.ajaxTransport( "script", function( s ) {
  16316. // This transport only deals with cross domain or forced-by-attrs requests
  16317. if ( s.crossDomain || s.scriptAttrs ) {
  16318. var script, callback;
  16319. return {
  16320. send: function( _, complete ) {
  16321. script = jQuery( "<script>" )
  16322. .attr( s.scriptAttrs || {} )
  16323. .prop( { charset: s.scriptCharset, src: s.url } )
  16324. .on( "load error", callback = function( evt ) {
  16325. script.remove();
  16326. callback = null;
  16327. if ( evt ) {
  16328. complete( evt.type === "error" ? 404 : 200, evt.type );
  16329. }
  16330. } );
  16331. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16332. document.head.appendChild( script[ 0 ] );
  16333. },
  16334. abort: function() {
  16335. if ( callback ) {
  16336. callback();
  16337. }
  16338. }
  16339. };
  16340. }
  16341. } );
  16342. var oldCallbacks = [],
  16343. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16344. // Default jsonp settings
  16345. jQuery.ajaxSetup( {
  16346. jsonp: "callback",
  16347. jsonpCallback: function() {
  16348. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16349. this[ callback ] = true;
  16350. return callback;
  16351. }
  16352. } );
  16353. // Detect, normalize options and install callbacks for jsonp requests
  16354. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16355. var callbackName, overwritten, responseContainer,
  16356. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16357. "url" :
  16358. typeof s.data === "string" &&
  16359. ( s.contentType || "" )
  16360. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16361. rjsonp.test( s.data ) && "data"
  16362. );
  16363. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16364. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16365. // Get callback name, remembering preexisting value associated with it
  16366. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16367. s.jsonpCallback() :
  16368. s.jsonpCallback;
  16369. // Insert callback into url or form data
  16370. if ( jsonProp ) {
  16371. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16372. } else if ( s.jsonp !== false ) {
  16373. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16374. }
  16375. // Use data converter to retrieve json after script execution
  16376. s.converters[ "script json" ] = function() {
  16377. if ( !responseContainer ) {
  16378. jQuery.error( callbackName + " was not called" );
  16379. }
  16380. return responseContainer[ 0 ];
  16381. };
  16382. // Force json dataType
  16383. s.dataTypes[ 0 ] = "json";
  16384. // Install callback
  16385. overwritten = window[ callbackName ];
  16386. window[ callbackName ] = function() {
  16387. responseContainer = arguments;
  16388. };
  16389. // Clean-up function (fires after converters)
  16390. jqXHR.always( function() {
  16391. // If previous value didn't exist - remove it
  16392. if ( overwritten === undefined ) {
  16393. jQuery( window ).removeProp( callbackName );
  16394. // Otherwise restore preexisting value
  16395. } else {
  16396. window[ callbackName ] = overwritten;
  16397. }
  16398. // Save back as free
  16399. if ( s[ callbackName ] ) {
  16400. // Make sure that re-using the options doesn't screw things around
  16401. s.jsonpCallback = originalSettings.jsonpCallback;
  16402. // Save the callback name for future use
  16403. oldCallbacks.push( callbackName );
  16404. }
  16405. // Call if it was a function and we have a response
  16406. if ( responseContainer && isFunction( overwritten ) ) {
  16407. overwritten( responseContainer[ 0 ] );
  16408. }
  16409. responseContainer = overwritten = undefined;
  16410. } );
  16411. // Delegate to script
  16412. return "script";
  16413. }
  16414. } );
  16415. // Support: Safari 8 only
  16416. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16417. // collapse sibling forms: the second one becomes a child of the first one.
  16418. // Because of that, this security measure has to be disabled in Safari 8.
  16419. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16420. support.createHTMLDocument = ( function() {
  16421. var body = document.implementation.createHTMLDocument( "" ).body;
  16422. body.innerHTML = "<form></form><form></form>";
  16423. return body.childNodes.length === 2;
  16424. } )();
  16425. // Argument "data" should be string of html
  16426. // context (optional): If specified, the fragment will be created in this context,
  16427. // defaults to document
  16428. // keepScripts (optional): If true, will include scripts passed in the html string
  16429. jQuery.parseHTML = function( data, context, keepScripts ) {
  16430. if ( typeof data !== "string" ) {
  16431. return [];
  16432. }
  16433. if ( typeof context === "boolean" ) {
  16434. keepScripts = context;
  16435. context = false;
  16436. }
  16437. var base, parsed, scripts;
  16438. if ( !context ) {
  16439. // Stop scripts or inline event handlers from being executed immediately
  16440. // by using document.implementation
  16441. if ( support.createHTMLDocument ) {
  16442. context = document.implementation.createHTMLDocument( "" );
  16443. // Set the base href for the created document
  16444. // so any parsed elements with URLs
  16445. // are based on the document's URL (gh-2965)
  16446. base = context.createElement( "base" );
  16447. base.href = document.location.href;
  16448. context.head.appendChild( base );
  16449. } else {
  16450. context = document;
  16451. }
  16452. }
  16453. parsed = rsingleTag.exec( data );
  16454. scripts = !keepScripts && [];
  16455. // Single tag
  16456. if ( parsed ) {
  16457. return [ context.createElement( parsed[ 1 ] ) ];
  16458. }
  16459. parsed = buildFragment( [ data ], context, scripts );
  16460. if ( scripts && scripts.length ) {
  16461. jQuery( scripts ).remove();
  16462. }
  16463. return jQuery.merge( [], parsed.childNodes );
  16464. };
  16465. /**
  16466. * Load a url into a page
  16467. */
  16468. jQuery.fn.load = function( url, params, callback ) {
  16469. var selector, type, response,
  16470. self = this,
  16471. off = url.indexOf( " " );
  16472. if ( off > -1 ) {
  16473. selector = stripAndCollapse( url.slice( off ) );
  16474. url = url.slice( 0, off );
  16475. }
  16476. // If it's a function
  16477. if ( isFunction( params ) ) {
  16478. // We assume that it's the callback
  16479. callback = params;
  16480. params = undefined;
  16481. // Otherwise, build a param string
  16482. } else if ( params && typeof params === "object" ) {
  16483. type = "POST";
  16484. }
  16485. // If we have elements to modify, make the request
  16486. if ( self.length > 0 ) {
  16487. jQuery.ajax( {
  16488. url: url,
  16489. // If "type" variable is undefined, then "GET" method will be used.
  16490. // Make value of this field explicit since
  16491. // user can override it through ajaxSetup method
  16492. type: type || "GET",
  16493. dataType: "html",
  16494. data: params
  16495. } ).done( function( responseText ) {
  16496. // Save response for use in complete callback
  16497. response = arguments;
  16498. self.html( selector ?
  16499. // If a selector was specified, locate the right elements in a dummy div
  16500. // Exclude scripts to avoid IE 'Permission Denied' errors
  16501. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16502. // Otherwise use the full result
  16503. responseText );
  16504. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16505. // but they are ignored because response was set above.
  16506. // If it fails, this function gets "jqXHR", "status", "error"
  16507. } ).always( callback && function( jqXHR, status ) {
  16508. self.each( function() {
  16509. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16510. } );
  16511. } );
  16512. }
  16513. return this;
  16514. };
  16515. // Attach a bunch of functions for handling common AJAX events
  16516. jQuery.each( [
  16517. "ajaxStart",
  16518. "ajaxStop",
  16519. "ajaxComplete",
  16520. "ajaxError",
  16521. "ajaxSuccess",
  16522. "ajaxSend"
  16523. ], function( i, type ) {
  16524. jQuery.fn[ type ] = function( fn ) {
  16525. return this.on( type, fn );
  16526. };
  16527. } );
  16528. jQuery.expr.pseudos.animated = function( elem ) {
  16529. return jQuery.grep( jQuery.timers, function( fn ) {
  16530. return elem === fn.elem;
  16531. } ).length;
  16532. };
  16533. jQuery.offset = {
  16534. setOffset: function( elem, options, i ) {
  16535. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16536. position = jQuery.css( elem, "position" ),
  16537. curElem = jQuery( elem ),
  16538. props = {};
  16539. // Set position first, in-case top/left are set even on static elem
  16540. if ( position === "static" ) {
  16541. elem.style.position = "relative";
  16542. }
  16543. curOffset = curElem.offset();
  16544. curCSSTop = jQuery.css( elem, "top" );
  16545. curCSSLeft = jQuery.css( elem, "left" );
  16546. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16547. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16548. // Need to be able to calculate position if either
  16549. // top or left is auto and position is either absolute or fixed
  16550. if ( calculatePosition ) {
  16551. curPosition = curElem.position();
  16552. curTop = curPosition.top;
  16553. curLeft = curPosition.left;
  16554. } else {
  16555. curTop = parseFloat( curCSSTop ) || 0;
  16556. curLeft = parseFloat( curCSSLeft ) || 0;
  16557. }
  16558. if ( isFunction( options ) ) {
  16559. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16560. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16561. }
  16562. if ( options.top != null ) {
  16563. props.top = ( options.top - curOffset.top ) + curTop;
  16564. }
  16565. if ( options.left != null ) {
  16566. props.left = ( options.left - curOffset.left ) + curLeft;
  16567. }
  16568. if ( "using" in options ) {
  16569. options.using.call( elem, props );
  16570. } else {
  16571. curElem.css( props );
  16572. }
  16573. }
  16574. };
  16575. jQuery.fn.extend( {
  16576. // offset() relates an element's border box to the document origin
  16577. offset: function( options ) {
  16578. // Preserve chaining for setter
  16579. if ( arguments.length ) {
  16580. return options === undefined ?
  16581. this :
  16582. this.each( function( i ) {
  16583. jQuery.offset.setOffset( this, options, i );
  16584. } );
  16585. }
  16586. var rect, win,
  16587. elem = this[ 0 ];
  16588. if ( !elem ) {
  16589. return;
  16590. }
  16591. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16592. // Support: IE <=11 only
  16593. // Running getBoundingClientRect on a
  16594. // disconnected node in IE throws an error
  16595. if ( !elem.getClientRects().length ) {
  16596. return { top: 0, left: 0 };
  16597. }
  16598. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16599. rect = elem.getBoundingClientRect();
  16600. win = elem.ownerDocument.defaultView;
  16601. return {
  16602. top: rect.top + win.pageYOffset,
  16603. left: rect.left + win.pageXOffset
  16604. };
  16605. },
  16606. // position() relates an element's margin box to its offset parent's padding box
  16607. // This corresponds to the behavior of CSS absolute positioning
  16608. position: function() {
  16609. if ( !this[ 0 ] ) {
  16610. return;
  16611. }
  16612. var offsetParent, offset, doc,
  16613. elem = this[ 0 ],
  16614. parentOffset = { top: 0, left: 0 };
  16615. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16616. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16617. // Assume position:fixed implies availability of getBoundingClientRect
  16618. offset = elem.getBoundingClientRect();
  16619. } else {
  16620. offset = this.offset();
  16621. // Account for the *real* offset parent, which can be the document or its root element
  16622. // when a statically positioned element is identified
  16623. doc = elem.ownerDocument;
  16624. offsetParent = elem.offsetParent || doc.documentElement;
  16625. while ( offsetParent &&
  16626. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16627. jQuery.css( offsetParent, "position" ) === "static" ) {
  16628. offsetParent = offsetParent.parentNode;
  16629. }
  16630. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16631. // Incorporate borders into its offset, since they are outside its content origin
  16632. parentOffset = jQuery( offsetParent ).offset();
  16633. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16634. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16635. }
  16636. }
  16637. // Subtract parent offsets and element margins
  16638. return {
  16639. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16640. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16641. };
  16642. },
  16643. // This method will return documentElement in the following cases:
  16644. // 1) For the element inside the iframe without offsetParent, this method will return
  16645. // documentElement of the parent window
  16646. // 2) For the hidden or detached element
  16647. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16648. //
  16649. // but those exceptions were never presented as a real life use-cases
  16650. // and might be considered as more preferable results.
  16651. //
  16652. // This logic, however, is not guaranteed and can change at any point in the future
  16653. offsetParent: function() {
  16654. return this.map( function() {
  16655. var offsetParent = this.offsetParent;
  16656. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16657. offsetParent = offsetParent.offsetParent;
  16658. }
  16659. return offsetParent || documentElement;
  16660. } );
  16661. }
  16662. } );
  16663. // Create scrollLeft and scrollTop methods
  16664. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16665. var top = "pageYOffset" === prop;
  16666. jQuery.fn[ method ] = function( val ) {
  16667. return access( this, function( elem, method, val ) {
  16668. // Coalesce documents and windows
  16669. var win;
  16670. if ( isWindow( elem ) ) {
  16671. win = elem;
  16672. } else if ( elem.nodeType === 9 ) {
  16673. win = elem.defaultView;
  16674. }
  16675. if ( val === undefined ) {
  16676. return win ? win[ prop ] : elem[ method ];
  16677. }
  16678. if ( win ) {
  16679. win.scrollTo(
  16680. !top ? val : win.pageXOffset,
  16681. top ? val : win.pageYOffset
  16682. );
  16683. } else {
  16684. elem[ method ] = val;
  16685. }
  16686. }, method, val, arguments.length );
  16687. };
  16688. } );
  16689. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16690. // Add the top/left cssHooks using jQuery.fn.position
  16691. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16692. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16693. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16694. // rather than make the css module depend on the offset module, just check for it here
  16695. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16696. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16697. function( elem, computed ) {
  16698. if ( computed ) {
  16699. computed = curCSS( elem, prop );
  16700. // If curCSS returns percentage, fallback to offset
  16701. return rnumnonpx.test( computed ) ?
  16702. jQuery( elem ).position()[ prop ] + "px" :
  16703. computed;
  16704. }
  16705. }
  16706. );
  16707. } );
  16708. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16709. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16710. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16711. function( defaultExtra, funcName ) {
  16712. // Margin is only for outerHeight, outerWidth
  16713. jQuery.fn[ funcName ] = function( margin, value ) {
  16714. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  16715. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  16716. return access( this, function( elem, type, value ) {
  16717. var doc;
  16718. if ( isWindow( elem ) ) {
  16719. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  16720. return funcName.indexOf( "outer" ) === 0 ?
  16721. elem[ "inner" + name ] :
  16722. elem.document.documentElement[ "client" + name ];
  16723. }
  16724. // Get document width or height
  16725. if ( elem.nodeType === 9 ) {
  16726. doc = elem.documentElement;
  16727. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  16728. // whichever is greatest
  16729. return Math.max(
  16730. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  16731. elem.body[ "offset" + name ], doc[ "offset" + name ],
  16732. doc[ "client" + name ]
  16733. );
  16734. }
  16735. return value === undefined ?
  16736. // Get width or height on the element, requesting but not forcing parseFloat
  16737. jQuery.css( elem, type, extra ) :
  16738. // Set width or height on the element
  16739. jQuery.style( elem, type, value, extra );
  16740. }, type, chainable ? margin : undefined, chainable );
  16741. };
  16742. } );
  16743. } );
  16744. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  16745. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  16746. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  16747. function( i, name ) {
  16748. // Handle event binding
  16749. jQuery.fn[ name ] = function( data, fn ) {
  16750. return arguments.length > 0 ?
  16751. this.on( name, null, data, fn ) :
  16752. this.trigger( name );
  16753. };
  16754. } );
  16755. jQuery.fn.extend( {
  16756. hover: function( fnOver, fnOut ) {
  16757. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  16758. }
  16759. } );
  16760. jQuery.fn.extend( {
  16761. bind: function( types, data, fn ) {
  16762. return this.on( types, null, data, fn );
  16763. },
  16764. unbind: function( types, fn ) {
  16765. return this.off( types, null, fn );
  16766. },
  16767. delegate: function( selector, types, data, fn ) {
  16768. return this.on( types, selector, data, fn );
  16769. },
  16770. undelegate: function( selector, types, fn ) {
  16771. // ( namespace ) or ( selector, types [, fn] )
  16772. return arguments.length === 1 ?
  16773. this.off( selector, "**" ) :
  16774. this.off( types, selector || "**", fn );
  16775. }
  16776. } );
  16777. // Bind a function to a context, optionally partially applying any
  16778. // arguments.
  16779. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  16780. // However, it is not slated for removal any time soon
  16781. jQuery.proxy = function( fn, context ) {
  16782. var tmp, args, proxy;
  16783. if ( typeof context === "string" ) {
  16784. tmp = fn[ context ];
  16785. context = fn;
  16786. fn = tmp;
  16787. }
  16788. // Quick check to determine if target is callable, in the spec
  16789. // this throws a TypeError, but we will just return undefined.
  16790. if ( !isFunction( fn ) ) {
  16791. return undefined;
  16792. }
  16793. // Simulated bind
  16794. args = slice.call( arguments, 2 );
  16795. proxy = function() {
  16796. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  16797. };
  16798. // Set the guid of unique handler to the same of original handler, so it can be removed
  16799. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  16800. return proxy;
  16801. };
  16802. jQuery.holdReady = function( hold ) {
  16803. if ( hold ) {
  16804. jQuery.readyWait++;
  16805. } else {
  16806. jQuery.ready( true );
  16807. }
  16808. };
  16809. jQuery.isArray = Array.isArray;
  16810. jQuery.parseJSON = JSON.parse;
  16811. jQuery.nodeName = nodeName;
  16812. jQuery.isFunction = isFunction;
  16813. jQuery.isWindow = isWindow;
  16814. jQuery.camelCase = camelCase;
  16815. jQuery.type = toType;
  16816. jQuery.now = Date.now;
  16817. jQuery.isNumeric = function( obj ) {
  16818. // As of jQuery 3.0, isNumeric is limited to
  16819. // strings and numbers (primitives or objects)
  16820. // that can be coerced to finite numbers (gh-2662)
  16821. var type = jQuery.type( obj );
  16822. return ( type === "number" || type === "string" ) &&
  16823. // parseFloat NaNs numeric-cast false positives ("")
  16824. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  16825. // subtraction forces infinities to NaN
  16826. !isNaN( obj - parseFloat( obj ) );
  16827. };
  16828. // Register as a named AMD module, since jQuery can be concatenated with other
  16829. // files that may use define, but not via a proper concatenation script that
  16830. // understands anonymous AMD modules. A named AMD is safest and most robust
  16831. // way to register. Lowercase jquery is used because AMD module names are
  16832. // derived from file names, and jQuery is normally delivered in a lowercase
  16833. // file name. Do this after creating the global so that if an AMD module wants
  16834. // to call noConflict to hide this version of jQuery, it will work.
  16835. // Note that for maximum portability, libraries that are not jQuery should
  16836. // declare themselves as anonymous modules, and avoid setting a global if an
  16837. // AMD loader is present. jQuery is a special case. For more information, see
  16838. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  16839. if ( true ) {
  16840. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  16841. return jQuery;
  16842. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  16843. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16844. }
  16845. var
  16846. // Map over jQuery in case of overwrite
  16847. _jQuery = window.jQuery,
  16848. // Map over the $ in case of overwrite
  16849. _$ = window.$;
  16850. jQuery.noConflict = function( deep ) {
  16851. if ( window.$ === jQuery ) {
  16852. window.$ = _$;
  16853. }
  16854. if ( deep && window.jQuery === jQuery ) {
  16855. window.jQuery = _jQuery;
  16856. }
  16857. return jQuery;
  16858. };
  16859. // Expose jQuery and $ identifiers, even in AMD
  16860. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  16861. // and CommonJS for browser emulators (#13566)
  16862. if ( !noGlobal ) {
  16863. window.jQuery = window.$ = jQuery;
  16864. }
  16865. return jQuery;
  16866. } );
  16867. /***/ }),
  16868. /***/ "./node_modules/laravel-echo/dist/echo.js":
  16869. /*!************************************************!*\
  16870. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  16871. \************************************************/
  16872. /*! exports provided: default */
  16873. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  16874. "use strict";
  16875. __webpack_require__.r(__webpack_exports__);
  16876. var classCallCheck = function (instance, Constructor) {
  16877. if (!(instance instanceof Constructor)) {
  16878. throw new TypeError("Cannot call a class as a function");
  16879. }
  16880. };
  16881. var createClass = function () {
  16882. function defineProperties(target, props) {
  16883. for (var i = 0; i < props.length; i++) {
  16884. var descriptor = props[i];
  16885. descriptor.enumerable = descriptor.enumerable || false;
  16886. descriptor.configurable = true;
  16887. if ("value" in descriptor) descriptor.writable = true;
  16888. Object.defineProperty(target, descriptor.key, descriptor);
  16889. }
  16890. }
  16891. return function (Constructor, protoProps, staticProps) {
  16892. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  16893. if (staticProps) defineProperties(Constructor, staticProps);
  16894. return Constructor;
  16895. };
  16896. }();
  16897. var _extends = Object.assign || function (target) {
  16898. for (var i = 1; i < arguments.length; i++) {
  16899. var source = arguments[i];
  16900. for (var key in source) {
  16901. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16902. target[key] = source[key];
  16903. }
  16904. }
  16905. }
  16906. return target;
  16907. };
  16908. var inherits = function (subClass, superClass) {
  16909. if (typeof superClass !== "function" && superClass !== null) {
  16910. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  16911. }
  16912. subClass.prototype = Object.create(superClass && superClass.prototype, {
  16913. constructor: {
  16914. value: subClass,
  16915. enumerable: false,
  16916. writable: true,
  16917. configurable: true
  16918. }
  16919. });
  16920. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  16921. };
  16922. var possibleConstructorReturn = function (self, call) {
  16923. if (!self) {
  16924. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  16925. }
  16926. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  16927. };
  16928. var Connector = function () {
  16929. /**
  16930. * Create a new class instance.
  16931. */
  16932. function Connector(options) {
  16933. classCallCheck(this, Connector);
  16934. /**
  16935. * Default connector options.
  16936. */
  16937. this._defaultOptions = {
  16938. auth: {
  16939. headers: {}
  16940. },
  16941. authEndpoint: '/broadcasting/auth',
  16942. broadcaster: 'pusher',
  16943. csrfToken: null,
  16944. host: null,
  16945. key: null,
  16946. namespace: 'App.Events'
  16947. };
  16948. this.setOptions(options);
  16949. this.connect();
  16950. }
  16951. /**
  16952. * Merge the custom options with the defaults.
  16953. */
  16954. createClass(Connector, [{
  16955. key: 'setOptions',
  16956. value: function setOptions(options) {
  16957. this.options = _extends(this._defaultOptions, options);
  16958. if (this.csrfToken()) {
  16959. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  16960. }
  16961. return options;
  16962. }
  16963. /**
  16964. * Extract the CSRF token from the page.
  16965. */
  16966. }, {
  16967. key: 'csrfToken',
  16968. value: function csrfToken() {
  16969. var selector = void 0;
  16970. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  16971. return window['Laravel'].csrfToken;
  16972. } else if (this.options.csrfToken) {
  16973. return this.options.csrfToken;
  16974. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  16975. return selector.getAttribute('content');
  16976. }
  16977. return null;
  16978. }
  16979. }]);
  16980. return Connector;
  16981. }();
  16982. /**
  16983. * This class represents a basic channel.
  16984. */
  16985. var Channel = function () {
  16986. function Channel() {
  16987. classCallCheck(this, Channel);
  16988. }
  16989. createClass(Channel, [{
  16990. key: 'listenForWhisper',
  16991. /**
  16992. * Listen for a whisper event on the channel instance.
  16993. */
  16994. value: function listenForWhisper(event, callback) {
  16995. return this.listen('.client-' + event, callback);
  16996. }
  16997. /**
  16998. * Listen for an event on the channel instance.
  16999. */
  17000. }, {
  17001. key: 'notification',
  17002. value: function notification(callback) {
  17003. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17004. }
  17005. /**
  17006. * Stop listening for a whispser event on the channel instance.
  17007. */
  17008. }, {
  17009. key: 'stopListeningForWhisper',
  17010. value: function stopListeningForWhisper(event) {
  17011. return this.stopListening('.client-' + event);
  17012. }
  17013. }]);
  17014. return Channel;
  17015. }();
  17016. /**
  17017. * Event name formatter
  17018. */
  17019. var EventFormatter = function () {
  17020. /**
  17021. * Create a new class instance.
  17022. */
  17023. function EventFormatter(namespace) {
  17024. classCallCheck(this, EventFormatter);
  17025. this.setNamespace(namespace);
  17026. }
  17027. /**
  17028. * Format the given event name.
  17029. */
  17030. createClass(EventFormatter, [{
  17031. key: 'format',
  17032. value: function format(event) {
  17033. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17034. return event.substr(1);
  17035. } else if (this.namespace) {
  17036. event = this.namespace + '.' + event;
  17037. }
  17038. return event.replace(/\./g, '\\');
  17039. }
  17040. /**
  17041. * Set the event namespace.
  17042. */
  17043. }, {
  17044. key: 'setNamespace',
  17045. value: function setNamespace(value) {
  17046. this.namespace = value;
  17047. }
  17048. }]);
  17049. return EventFormatter;
  17050. }();
  17051. /**
  17052. * This class represents a Pusher channel.
  17053. */
  17054. var PusherChannel = function (_Channel) {
  17055. inherits(PusherChannel, _Channel);
  17056. /**
  17057. * Create a new class instance.
  17058. */
  17059. function PusherChannel(pusher, name, options) {
  17060. classCallCheck(this, PusherChannel);
  17061. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17062. _this.name = name;
  17063. _this.pusher = pusher;
  17064. _this.options = options;
  17065. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17066. _this.subscribe();
  17067. return _this;
  17068. }
  17069. /**
  17070. * Subscribe to a Pusher channel.
  17071. */
  17072. createClass(PusherChannel, [{
  17073. key: 'subscribe',
  17074. value: function subscribe() {
  17075. this.subscription = this.pusher.subscribe(this.name);
  17076. }
  17077. /**
  17078. * Unsubscribe from a Pusher channel.
  17079. */
  17080. }, {
  17081. key: 'unsubscribe',
  17082. value: function unsubscribe() {
  17083. this.pusher.unsubscribe(this.name);
  17084. }
  17085. /**
  17086. * Listen for an event on the channel instance.
  17087. */
  17088. }, {
  17089. key: 'listen',
  17090. value: function listen(event, callback) {
  17091. this.on(this.eventFormatter.format(event), callback);
  17092. return this;
  17093. }
  17094. /**
  17095. * Stop listening for an event on the channel instance.
  17096. */
  17097. }, {
  17098. key: 'stopListening',
  17099. value: function stopListening(event) {
  17100. this.subscription.unbind(this.eventFormatter.format(event));
  17101. return this;
  17102. }
  17103. /**
  17104. * Bind a channel to an event.
  17105. */
  17106. }, {
  17107. key: 'on',
  17108. value: function on(event, callback) {
  17109. this.subscription.bind(event, callback);
  17110. return this;
  17111. }
  17112. }]);
  17113. return PusherChannel;
  17114. }(Channel);
  17115. /**
  17116. * This class represents a Pusher private channel.
  17117. */
  17118. var PusherPrivateChannel = function (_PusherChannel) {
  17119. inherits(PusherPrivateChannel, _PusherChannel);
  17120. function PusherPrivateChannel() {
  17121. classCallCheck(this, PusherPrivateChannel);
  17122. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17123. }
  17124. createClass(PusherPrivateChannel, [{
  17125. key: 'whisper',
  17126. /**
  17127. * Trigger client event on the channel.
  17128. */
  17129. value: function whisper(eventName, data) {
  17130. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17131. return this;
  17132. }
  17133. }]);
  17134. return PusherPrivateChannel;
  17135. }(PusherChannel);
  17136. /**
  17137. * This class represents a Pusher presence channel.
  17138. */
  17139. var PusherPresenceChannel = function (_PusherChannel) {
  17140. inherits(PusherPresenceChannel, _PusherChannel);
  17141. function PusherPresenceChannel() {
  17142. classCallCheck(this, PusherPresenceChannel);
  17143. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17144. }
  17145. createClass(PusherPresenceChannel, [{
  17146. key: 'here',
  17147. /**
  17148. * Register a callback to be called anytime the member list changes.
  17149. */
  17150. value: function here(callback) {
  17151. this.on('pusher:subscription_succeeded', function (data) {
  17152. callback(Object.keys(data.members).map(function (k) {
  17153. return data.members[k];
  17154. }));
  17155. });
  17156. return this;
  17157. }
  17158. /**
  17159. * Listen for someone joining the channel.
  17160. */
  17161. }, {
  17162. key: 'joining',
  17163. value: function joining(callback) {
  17164. this.on('pusher:member_added', function (member) {
  17165. callback(member.info);
  17166. });
  17167. return this;
  17168. }
  17169. /**
  17170. * Listen for someone leaving the channel.
  17171. */
  17172. }, {
  17173. key: 'leaving',
  17174. value: function leaving(callback) {
  17175. this.on('pusher:member_removed', function (member) {
  17176. callback(member.info);
  17177. });
  17178. return this;
  17179. }
  17180. /**
  17181. * Trigger client event on the channel.
  17182. */
  17183. }, {
  17184. key: 'whisper',
  17185. value: function whisper(eventName, data) {
  17186. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17187. return this;
  17188. }
  17189. }]);
  17190. return PusherPresenceChannel;
  17191. }(PusherChannel);
  17192. /**
  17193. * This class represents a Socket.io channel.
  17194. */
  17195. var SocketIoChannel = function (_Channel) {
  17196. inherits(SocketIoChannel, _Channel);
  17197. /**
  17198. * Create a new class instance.
  17199. */
  17200. function SocketIoChannel(socket, name, options) {
  17201. classCallCheck(this, SocketIoChannel);
  17202. /**
  17203. * The event callbacks applied to the channel.
  17204. */
  17205. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17206. _this.events = {};
  17207. _this.name = name;
  17208. _this.socket = socket;
  17209. _this.options = options;
  17210. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17211. _this.subscribe();
  17212. _this.configureReconnector();
  17213. return _this;
  17214. }
  17215. /**
  17216. * Subscribe to a Socket.io channel.
  17217. */
  17218. createClass(SocketIoChannel, [{
  17219. key: 'subscribe',
  17220. value: function subscribe() {
  17221. this.socket.emit('subscribe', {
  17222. channel: this.name,
  17223. auth: this.options.auth || {}
  17224. });
  17225. }
  17226. /**
  17227. * Unsubscribe from channel and ubind event callbacks.
  17228. */
  17229. }, {
  17230. key: 'unsubscribe',
  17231. value: function unsubscribe() {
  17232. this.unbind();
  17233. this.socket.emit('unsubscribe', {
  17234. channel: this.name,
  17235. auth: this.options.auth || {}
  17236. });
  17237. }
  17238. /**
  17239. * Listen for an event on the channel instance.
  17240. */
  17241. }, {
  17242. key: 'listen',
  17243. value: function listen(event, callback) {
  17244. this.on(this.eventFormatter.format(event), callback);
  17245. return this;
  17246. }
  17247. /**
  17248. * Stop listening for an event on the channel instance.
  17249. */
  17250. }, {
  17251. key: 'stopListening',
  17252. value: function stopListening(event) {
  17253. var name = this.eventFormatter.format(event);
  17254. this.socket.removeListener(name);
  17255. delete this.events[name];
  17256. return this;
  17257. }
  17258. /**
  17259. * Bind the channel's socket to an event and store the callback.
  17260. */
  17261. }, {
  17262. key: 'on',
  17263. value: function on(event, callback) {
  17264. var _this2 = this;
  17265. var listener = function listener(channel, data) {
  17266. if (_this2.name == channel) {
  17267. callback(data);
  17268. }
  17269. };
  17270. this.socket.on(event, listener);
  17271. this.bind(event, listener);
  17272. }
  17273. /**
  17274. * Attach a 'reconnect' listener and bind the event.
  17275. */
  17276. }, {
  17277. key: 'configureReconnector',
  17278. value: function configureReconnector() {
  17279. var _this3 = this;
  17280. var listener = function listener() {
  17281. _this3.subscribe();
  17282. };
  17283. this.socket.on('reconnect', listener);
  17284. this.bind('reconnect', listener);
  17285. }
  17286. /**
  17287. * Bind the channel's socket to an event and store the callback.
  17288. */
  17289. }, {
  17290. key: 'bind',
  17291. value: function bind(event, callback) {
  17292. this.events[event] = this.events[event] || [];
  17293. this.events[event].push(callback);
  17294. }
  17295. /**
  17296. * Unbind the channel's socket from all stored event callbacks.
  17297. */
  17298. }, {
  17299. key: 'unbind',
  17300. value: function unbind() {
  17301. var _this4 = this;
  17302. Object.keys(this.events).forEach(function (event) {
  17303. _this4.events[event].forEach(function (callback) {
  17304. _this4.socket.removeListener(event, callback);
  17305. });
  17306. delete _this4.events[event];
  17307. });
  17308. }
  17309. }]);
  17310. return SocketIoChannel;
  17311. }(Channel);
  17312. /**
  17313. * This class represents a Socket.io presence channel.
  17314. */
  17315. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17316. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17317. function SocketIoPrivateChannel() {
  17318. classCallCheck(this, SocketIoPrivateChannel);
  17319. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17320. }
  17321. createClass(SocketIoPrivateChannel, [{
  17322. key: 'whisper',
  17323. /**
  17324. * Trigger client event on the channel.
  17325. */
  17326. value: function whisper(eventName, data) {
  17327. this.socket.emit('client event', {
  17328. channel: this.name,
  17329. event: 'client-' + eventName,
  17330. data: data
  17331. });
  17332. return this;
  17333. }
  17334. }]);
  17335. return SocketIoPrivateChannel;
  17336. }(SocketIoChannel);
  17337. /**
  17338. * This class represents a Socket.io presence channel.
  17339. */
  17340. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17341. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17342. function SocketIoPresenceChannel() {
  17343. classCallCheck(this, SocketIoPresenceChannel);
  17344. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17345. }
  17346. createClass(SocketIoPresenceChannel, [{
  17347. key: 'here',
  17348. /**
  17349. * Register a callback to be called anytime the member list changes.
  17350. */
  17351. value: function here(callback) {
  17352. this.on('presence:subscribed', function (members) {
  17353. callback(members.map(function (m) {
  17354. return m.user_info;
  17355. }));
  17356. });
  17357. return this;
  17358. }
  17359. /**
  17360. * Listen for someone joining the channel.
  17361. */
  17362. }, {
  17363. key: 'joining',
  17364. value: function joining(callback) {
  17365. this.on('presence:joining', function (member) {
  17366. return callback(member.user_info);
  17367. });
  17368. return this;
  17369. }
  17370. /**
  17371. * Listen for someone leaving the channel.
  17372. */
  17373. }, {
  17374. key: 'leaving',
  17375. value: function leaving(callback) {
  17376. this.on('presence:leaving', function (member) {
  17377. return callback(member.user_info);
  17378. });
  17379. return this;
  17380. }
  17381. }]);
  17382. return SocketIoPresenceChannel;
  17383. }(SocketIoPrivateChannel);
  17384. /**
  17385. * This class represents a null channel.
  17386. */
  17387. var NullChannel = function (_Channel) {
  17388. inherits(NullChannel, _Channel);
  17389. function NullChannel() {
  17390. classCallCheck(this, NullChannel);
  17391. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17392. }
  17393. createClass(NullChannel, [{
  17394. key: 'subscribe',
  17395. /**
  17396. * Subscribe to a channel.
  17397. */
  17398. value: function subscribe() {}
  17399. //
  17400. /**
  17401. * Unsubscribe from a channel.
  17402. */
  17403. }, {
  17404. key: 'unsubscribe',
  17405. value: function unsubscribe() {}
  17406. //
  17407. /**
  17408. * Listen for an event on the channel instance.
  17409. */
  17410. }, {
  17411. key: 'listen',
  17412. value: function listen(event, callback) {
  17413. return this;
  17414. }
  17415. /**
  17416. * Stop listening for an event on the channel instance.
  17417. */
  17418. }, {
  17419. key: 'stopListening',
  17420. value: function stopListening(event) {
  17421. return this;
  17422. }
  17423. /**
  17424. * Bind a channel to an event.
  17425. */
  17426. }, {
  17427. key: 'on',
  17428. value: function on(event, callback) {
  17429. return this;
  17430. }
  17431. }]);
  17432. return NullChannel;
  17433. }(Channel);
  17434. /**
  17435. * This class represents a null private channel.
  17436. */
  17437. var NullPrivateChannel = function (_NullChannel) {
  17438. inherits(NullPrivateChannel, _NullChannel);
  17439. function NullPrivateChannel() {
  17440. classCallCheck(this, NullPrivateChannel);
  17441. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17442. }
  17443. createClass(NullPrivateChannel, [{
  17444. key: 'whisper',
  17445. /**
  17446. * Trigger client event on the channel.
  17447. */
  17448. value: function whisper(eventName, data) {
  17449. return this;
  17450. }
  17451. }]);
  17452. return NullPrivateChannel;
  17453. }(NullChannel);
  17454. /**
  17455. * This class represents a null presence channel.
  17456. */
  17457. var NullPresenceChannel = function (_NullChannel) {
  17458. inherits(NullPresenceChannel, _NullChannel);
  17459. function NullPresenceChannel() {
  17460. classCallCheck(this, NullPresenceChannel);
  17461. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17462. }
  17463. createClass(NullPresenceChannel, [{
  17464. key: 'here',
  17465. /**
  17466. * Register a callback to be called anytime the member list changes.
  17467. */
  17468. value: function here(callback) {
  17469. return this;
  17470. }
  17471. /**
  17472. * Listen for someone joining the channel.
  17473. */
  17474. }, {
  17475. key: 'joining',
  17476. value: function joining(callback) {
  17477. return this;
  17478. }
  17479. /**
  17480. * Listen for someone leaving the channel.
  17481. */
  17482. }, {
  17483. key: 'leaving',
  17484. value: function leaving(callback) {
  17485. return this;
  17486. }
  17487. /**
  17488. * Trigger client event on the channel.
  17489. */
  17490. }, {
  17491. key: 'whisper',
  17492. value: function whisper(eventName, data) {
  17493. return this;
  17494. }
  17495. }]);
  17496. return NullPresenceChannel;
  17497. }(NullChannel);
  17498. /**
  17499. * This class creates a connector to Pusher.
  17500. */
  17501. var PusherConnector = function (_Connector) {
  17502. inherits(PusherConnector, _Connector);
  17503. function PusherConnector() {
  17504. classCallCheck(this, PusherConnector);
  17505. /**
  17506. * All of the subscribed channel names.
  17507. */
  17508. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17509. _this.channels = {};
  17510. return _this;
  17511. }
  17512. /**
  17513. * Create a fresh Pusher connection.
  17514. */
  17515. createClass(PusherConnector, [{
  17516. key: 'connect',
  17517. value: function connect() {
  17518. if (typeof this.options.client !== 'undefined') {
  17519. this.pusher = this.options.client;
  17520. } else {
  17521. this.pusher = new Pusher(this.options.key, this.options);
  17522. }
  17523. }
  17524. /**
  17525. * Listen for an event on a channel instance.
  17526. */
  17527. }, {
  17528. key: 'listen',
  17529. value: function listen(name, event, callback) {
  17530. return this.channel(name).listen(event, callback);
  17531. }
  17532. /**
  17533. * Get a channel instance by name.
  17534. */
  17535. }, {
  17536. key: 'channel',
  17537. value: function channel(name) {
  17538. if (!this.channels[name]) {
  17539. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17540. }
  17541. return this.channels[name];
  17542. }
  17543. /**
  17544. * Get a private channel instance by name.
  17545. */
  17546. }, {
  17547. key: 'privateChannel',
  17548. value: function privateChannel(name) {
  17549. if (!this.channels['private-' + name]) {
  17550. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17551. }
  17552. return this.channels['private-' + name];
  17553. }
  17554. /**
  17555. * Get a presence channel instance by name.
  17556. */
  17557. }, {
  17558. key: 'presenceChannel',
  17559. value: function presenceChannel(name) {
  17560. if (!this.channels['presence-' + name]) {
  17561. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17562. }
  17563. return this.channels['presence-' + name];
  17564. }
  17565. /**
  17566. * Leave the given channel, as well as its private and presence variants.
  17567. */
  17568. }, {
  17569. key: 'leave',
  17570. value: function leave(name) {
  17571. var _this2 = this;
  17572. var channels = [name, 'private-' + name, 'presence-' + name];
  17573. channels.forEach(function (name, index) {
  17574. _this2.leaveChannel(name);
  17575. });
  17576. }
  17577. /**
  17578. * Leave the given channel.
  17579. */
  17580. }, {
  17581. key: 'leaveChannel',
  17582. value: function leaveChannel(name) {
  17583. if (this.channels[name]) {
  17584. this.channels[name].unsubscribe();
  17585. delete this.channels[name];
  17586. }
  17587. }
  17588. /**
  17589. * Get the socket ID for the connection.
  17590. */
  17591. }, {
  17592. key: 'socketId',
  17593. value: function socketId() {
  17594. return this.pusher.connection.socket_id;
  17595. }
  17596. /**
  17597. * Disconnect Pusher connection.
  17598. */
  17599. }, {
  17600. key: 'disconnect',
  17601. value: function disconnect() {
  17602. this.pusher.disconnect();
  17603. }
  17604. }]);
  17605. return PusherConnector;
  17606. }(Connector);
  17607. /**
  17608. * This class creates a connnector to a Socket.io server.
  17609. */
  17610. var SocketIoConnector = function (_Connector) {
  17611. inherits(SocketIoConnector, _Connector);
  17612. function SocketIoConnector() {
  17613. classCallCheck(this, SocketIoConnector);
  17614. /**
  17615. * All of the subscribed channel names.
  17616. */
  17617. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17618. _this.channels = {};
  17619. return _this;
  17620. }
  17621. /**
  17622. * Create a fresh Socket.io connection.
  17623. */
  17624. createClass(SocketIoConnector, [{
  17625. key: 'connect',
  17626. value: function connect() {
  17627. var io = this.getSocketIO();
  17628. this.socket = io(this.options.host, this.options);
  17629. return this.socket;
  17630. }
  17631. /**
  17632. * Get socket.io module from global scope or options.
  17633. */
  17634. }, {
  17635. key: 'getSocketIO',
  17636. value: function getSocketIO() {
  17637. if (typeof this.options.client !== 'undefined') {
  17638. return this.options.client;
  17639. }
  17640. if (typeof io !== 'undefined') {
  17641. return io;
  17642. }
  17643. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17644. }
  17645. /**
  17646. * Listen for an event on a channel instance.
  17647. */
  17648. }, {
  17649. key: 'listen',
  17650. value: function listen(name, event, callback) {
  17651. return this.channel(name).listen(event, callback);
  17652. }
  17653. /**
  17654. * Get a channel instance by name.
  17655. */
  17656. }, {
  17657. key: 'channel',
  17658. value: function channel(name) {
  17659. if (!this.channels[name]) {
  17660. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17661. }
  17662. return this.channels[name];
  17663. }
  17664. /**
  17665. * Get a private channel instance by name.
  17666. */
  17667. }, {
  17668. key: 'privateChannel',
  17669. value: function privateChannel(name) {
  17670. if (!this.channels['private-' + name]) {
  17671. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17672. }
  17673. return this.channels['private-' + name];
  17674. }
  17675. /**
  17676. * Get a presence channel instance by name.
  17677. */
  17678. }, {
  17679. key: 'presenceChannel',
  17680. value: function presenceChannel(name) {
  17681. if (!this.channels['presence-' + name]) {
  17682. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17683. }
  17684. return this.channels['presence-' + name];
  17685. }
  17686. /**
  17687. * Leave the given channel, as well as its private and presence variants.
  17688. */
  17689. }, {
  17690. key: 'leave',
  17691. value: function leave(name) {
  17692. var _this2 = this;
  17693. var channels = [name, 'private-' + name, 'presence-' + name];
  17694. channels.forEach(function (name) {
  17695. _this2.leaveChannel(name);
  17696. });
  17697. }
  17698. /**
  17699. * Leave the given channel.
  17700. */
  17701. }, {
  17702. key: 'leaveChannel',
  17703. value: function leaveChannel(name) {
  17704. if (this.channels[name]) {
  17705. this.channels[name].unsubscribe();
  17706. delete this.channels[name];
  17707. }
  17708. }
  17709. /**
  17710. * Get the socket ID for the connection.
  17711. */
  17712. }, {
  17713. key: 'socketId',
  17714. value: function socketId() {
  17715. return this.socket.id;
  17716. }
  17717. /**
  17718. * Disconnect Socketio connection.
  17719. */
  17720. }, {
  17721. key: 'disconnect',
  17722. value: function disconnect() {
  17723. this.socket.disconnect();
  17724. }
  17725. }]);
  17726. return SocketIoConnector;
  17727. }(Connector);
  17728. /**
  17729. * This class creates a null connector.
  17730. */
  17731. var NullConnector = function (_Connector) {
  17732. inherits(NullConnector, _Connector);
  17733. function NullConnector() {
  17734. classCallCheck(this, NullConnector);
  17735. /**
  17736. * All of the subscribed channel names.
  17737. */
  17738. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  17739. _this.channels = {};
  17740. return _this;
  17741. }
  17742. /**
  17743. * Create a fresh connection.
  17744. */
  17745. createClass(NullConnector, [{
  17746. key: 'connect',
  17747. value: function connect() {}
  17748. //
  17749. /**
  17750. * Listen for an event on a channel instance.
  17751. */
  17752. }, {
  17753. key: 'listen',
  17754. value: function listen(name, event, callback) {
  17755. return new NullChannel();
  17756. }
  17757. /**
  17758. * Get a channel instance by name.
  17759. */
  17760. }, {
  17761. key: 'channel',
  17762. value: function channel(name) {
  17763. return new NullChannel();
  17764. }
  17765. /**
  17766. * Get a private channel instance by name.
  17767. */
  17768. }, {
  17769. key: 'privateChannel',
  17770. value: function privateChannel(name) {
  17771. return new NullPrivateChannel();
  17772. }
  17773. /**
  17774. * Get a presence channel instance by name.
  17775. */
  17776. }, {
  17777. key: 'presenceChannel',
  17778. value: function presenceChannel(name) {
  17779. return new NullPresenceChannel();
  17780. }
  17781. /**
  17782. * Leave the given channel, as well as its private and presence variants.
  17783. */
  17784. }, {
  17785. key: 'leave',
  17786. value: function leave(name) {}
  17787. //
  17788. /**
  17789. * Leave the given channel.
  17790. */
  17791. }, {
  17792. key: 'leaveChannel',
  17793. value: function leaveChannel(name) {}
  17794. //
  17795. /**
  17796. * Get the socket ID for the connection.
  17797. */
  17798. }, {
  17799. key: 'socketId',
  17800. value: function socketId() {
  17801. return 'fake-socket-id';
  17802. }
  17803. /**
  17804. * Disconnect the connection.
  17805. */
  17806. }, {
  17807. key: 'disconnect',
  17808. value: function disconnect() {
  17809. //
  17810. }
  17811. }]);
  17812. return NullConnector;
  17813. }(Connector);
  17814. /**
  17815. * This class is the primary API for interacting with broadcasting.
  17816. */
  17817. var Echo = function () {
  17818. /**
  17819. * Create a new class instance.
  17820. */
  17821. function Echo(options) {
  17822. classCallCheck(this, Echo);
  17823. this.options = options;
  17824. this.connect();
  17825. if (!this.options.withoutInterceptors) {
  17826. this.registerInterceptors();
  17827. }
  17828. }
  17829. /**
  17830. * Get a channel instance by name.
  17831. */
  17832. createClass(Echo, [{
  17833. key: 'channel',
  17834. value: function channel(_channel) {
  17835. return this.connector.channel(_channel);
  17836. }
  17837. /**
  17838. * Create a new connection.
  17839. */
  17840. }, {
  17841. key: 'connect',
  17842. value: function connect() {
  17843. if (this.options.broadcaster == 'pusher') {
  17844. this.connector = new PusherConnector(this.options);
  17845. } else if (this.options.broadcaster == 'socket.io') {
  17846. this.connector = new SocketIoConnector(this.options);
  17847. } else if (this.options.broadcaster == 'null') {
  17848. this.connector = new NullConnector(this.options);
  17849. } else if (typeof this.options.broadcaster == 'function') {
  17850. this.connector = new this.options.broadcaster(this.options);
  17851. }
  17852. }
  17853. /**
  17854. * Disconnect from the Echo server.
  17855. */
  17856. }, {
  17857. key: 'disconnect',
  17858. value: function disconnect() {
  17859. this.connector.disconnect();
  17860. }
  17861. /**
  17862. * Get a presence channel instance by name.
  17863. */
  17864. }, {
  17865. key: 'join',
  17866. value: function join(channel) {
  17867. return this.connector.presenceChannel(channel);
  17868. }
  17869. /**
  17870. * Leave the given channel, as well as its private and presence variants.
  17871. */
  17872. }, {
  17873. key: 'leave',
  17874. value: function leave(channel) {
  17875. this.connector.leave(channel);
  17876. }
  17877. /**
  17878. * Leave the given channel.
  17879. */
  17880. }, {
  17881. key: 'leaveChannel',
  17882. value: function leaveChannel(channel) {
  17883. this.connector.leaveChannel(channel);
  17884. }
  17885. /**
  17886. * Listen for an event on a channel instance.
  17887. */
  17888. }, {
  17889. key: 'listen',
  17890. value: function listen(channel, event, callback) {
  17891. return this.connector.listen(channel, event, callback);
  17892. }
  17893. /**
  17894. * Get a private channel instance by name.
  17895. */
  17896. }, {
  17897. key: 'private',
  17898. value: function _private(channel) {
  17899. return this.connector.privateChannel(channel);
  17900. }
  17901. /**
  17902. * Get the Socket ID for the connection.
  17903. */
  17904. }, {
  17905. key: 'socketId',
  17906. value: function socketId() {
  17907. return this.connector.socketId();
  17908. }
  17909. /**
  17910. * Register 3rd party request interceptiors. These are used to automatically
  17911. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  17912. */
  17913. }, {
  17914. key: 'registerInterceptors',
  17915. value: function registerInterceptors() {
  17916. if (typeof Vue === 'function' && Vue.http) {
  17917. this.registerVueRequestInterceptor();
  17918. }
  17919. if (typeof axios === 'function') {
  17920. this.registerAxiosRequestInterceptor();
  17921. }
  17922. if (typeof jQuery === 'function') {
  17923. this.registerjQueryAjaxSetup();
  17924. }
  17925. }
  17926. /**
  17927. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  17928. */
  17929. }, {
  17930. key: 'registerVueRequestInterceptor',
  17931. value: function registerVueRequestInterceptor() {
  17932. var _this = this;
  17933. Vue.http.interceptors.push(function (request, next) {
  17934. if (_this.socketId()) {
  17935. request.headers.set('X-Socket-ID', _this.socketId());
  17936. }
  17937. next();
  17938. });
  17939. }
  17940. /**
  17941. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  17942. */
  17943. }, {
  17944. key: 'registerAxiosRequestInterceptor',
  17945. value: function registerAxiosRequestInterceptor() {
  17946. var _this2 = this;
  17947. axios.interceptors.request.use(function (config) {
  17948. if (_this2.socketId()) {
  17949. config.headers['X-Socket-Id'] = _this2.socketId();
  17950. }
  17951. return config;
  17952. });
  17953. }
  17954. /**
  17955. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  17956. */
  17957. }, {
  17958. key: 'registerjQueryAjaxSetup',
  17959. value: function registerjQueryAjaxSetup() {
  17960. var _this3 = this;
  17961. if (typeof jQuery.ajax != 'undefined') {
  17962. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  17963. if (_this3.socketId()) {
  17964. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  17965. }
  17966. });
  17967. }
  17968. }
  17969. }]);
  17970. return Echo;
  17971. }();
  17972. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  17973. /***/ }),
  17974. /***/ "./node_modules/lodash/lodash.js":
  17975. /*!***************************************!*\
  17976. !*** ./node_modules/lodash/lodash.js ***!
  17977. \***************************************/
  17978. /*! no static exports found */
  17979. /***/ (function(module, exports, __webpack_require__) {
  17980. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  17981. * @license
  17982. * Lodash <https://lodash.com/>
  17983. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  17984. * Released under MIT license <https://lodash.com/license>
  17985. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  17986. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  17987. */
  17988. ;(function() {
  17989. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  17990. var undefined;
  17991. /** Used as the semantic version number. */
  17992. var VERSION = '4.17.15';
  17993. /** Used as the size to enable large array optimizations. */
  17994. var LARGE_ARRAY_SIZE = 200;
  17995. /** Error message constants. */
  17996. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  17997. FUNC_ERROR_TEXT = 'Expected a function';
  17998. /** Used to stand-in for `undefined` hash values. */
  17999. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18000. /** Used as the maximum memoize cache size. */
  18001. var MAX_MEMOIZE_SIZE = 500;
  18002. /** Used as the internal argument placeholder. */
  18003. var PLACEHOLDER = '__lodash_placeholder__';
  18004. /** Used to compose bitmasks for cloning. */
  18005. var CLONE_DEEP_FLAG = 1,
  18006. CLONE_FLAT_FLAG = 2,
  18007. CLONE_SYMBOLS_FLAG = 4;
  18008. /** Used to compose bitmasks for value comparisons. */
  18009. var COMPARE_PARTIAL_FLAG = 1,
  18010. COMPARE_UNORDERED_FLAG = 2;
  18011. /** Used to compose bitmasks for function metadata. */
  18012. var WRAP_BIND_FLAG = 1,
  18013. WRAP_BIND_KEY_FLAG = 2,
  18014. WRAP_CURRY_BOUND_FLAG = 4,
  18015. WRAP_CURRY_FLAG = 8,
  18016. WRAP_CURRY_RIGHT_FLAG = 16,
  18017. WRAP_PARTIAL_FLAG = 32,
  18018. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18019. WRAP_ARY_FLAG = 128,
  18020. WRAP_REARG_FLAG = 256,
  18021. WRAP_FLIP_FLAG = 512;
  18022. /** Used as default options for `_.truncate`. */
  18023. var DEFAULT_TRUNC_LENGTH = 30,
  18024. DEFAULT_TRUNC_OMISSION = '...';
  18025. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18026. var HOT_COUNT = 800,
  18027. HOT_SPAN = 16;
  18028. /** Used to indicate the type of lazy iteratees. */
  18029. var LAZY_FILTER_FLAG = 1,
  18030. LAZY_MAP_FLAG = 2,
  18031. LAZY_WHILE_FLAG = 3;
  18032. /** Used as references for various `Number` constants. */
  18033. var INFINITY = 1 / 0,
  18034. MAX_SAFE_INTEGER = 9007199254740991,
  18035. MAX_INTEGER = 1.7976931348623157e+308,
  18036. NAN = 0 / 0;
  18037. /** Used as references for the maximum length and index of an array. */
  18038. var MAX_ARRAY_LENGTH = 4294967295,
  18039. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18040. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18041. /** Used to associate wrap methods with their bit flags. */
  18042. var wrapFlags = [
  18043. ['ary', WRAP_ARY_FLAG],
  18044. ['bind', WRAP_BIND_FLAG],
  18045. ['bindKey', WRAP_BIND_KEY_FLAG],
  18046. ['curry', WRAP_CURRY_FLAG],
  18047. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18048. ['flip', WRAP_FLIP_FLAG],
  18049. ['partial', WRAP_PARTIAL_FLAG],
  18050. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18051. ['rearg', WRAP_REARG_FLAG]
  18052. ];
  18053. /** `Object#toString` result references. */
  18054. var argsTag = '[object Arguments]',
  18055. arrayTag = '[object Array]',
  18056. asyncTag = '[object AsyncFunction]',
  18057. boolTag = '[object Boolean]',
  18058. dateTag = '[object Date]',
  18059. domExcTag = '[object DOMException]',
  18060. errorTag = '[object Error]',
  18061. funcTag = '[object Function]',
  18062. genTag = '[object GeneratorFunction]',
  18063. mapTag = '[object Map]',
  18064. numberTag = '[object Number]',
  18065. nullTag = '[object Null]',
  18066. objectTag = '[object Object]',
  18067. promiseTag = '[object Promise]',
  18068. proxyTag = '[object Proxy]',
  18069. regexpTag = '[object RegExp]',
  18070. setTag = '[object Set]',
  18071. stringTag = '[object String]',
  18072. symbolTag = '[object Symbol]',
  18073. undefinedTag = '[object Undefined]',
  18074. weakMapTag = '[object WeakMap]',
  18075. weakSetTag = '[object WeakSet]';
  18076. var arrayBufferTag = '[object ArrayBuffer]',
  18077. dataViewTag = '[object DataView]',
  18078. float32Tag = '[object Float32Array]',
  18079. float64Tag = '[object Float64Array]',
  18080. int8Tag = '[object Int8Array]',
  18081. int16Tag = '[object Int16Array]',
  18082. int32Tag = '[object Int32Array]',
  18083. uint8Tag = '[object Uint8Array]',
  18084. uint8ClampedTag = '[object Uint8ClampedArray]',
  18085. uint16Tag = '[object Uint16Array]',
  18086. uint32Tag = '[object Uint32Array]';
  18087. /** Used to match empty string literals in compiled template source. */
  18088. var reEmptyStringLeading = /\b__p \+= '';/g,
  18089. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18090. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18091. /** Used to match HTML entities and HTML characters. */
  18092. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18093. reUnescapedHtml = /[&<>"']/g,
  18094. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18095. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18096. /** Used to match template delimiters. */
  18097. var reEscape = /<%-([\s\S]+?)%>/g,
  18098. reEvaluate = /<%([\s\S]+?)%>/g,
  18099. reInterpolate = /<%=([\s\S]+?)%>/g;
  18100. /** Used to match property names within property paths. */
  18101. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18102. reIsPlainProp = /^\w*$/,
  18103. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18104. /**
  18105. * Used to match `RegExp`
  18106. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18107. */
  18108. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18109. reHasRegExpChar = RegExp(reRegExpChar.source);
  18110. /** Used to match leading and trailing whitespace. */
  18111. var reTrim = /^\s+|\s+$/g,
  18112. reTrimStart = /^\s+/,
  18113. reTrimEnd = /\s+$/;
  18114. /** Used to match wrap detail comments. */
  18115. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18116. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18117. reSplitDetails = /,? & /;
  18118. /** Used to match words composed of alphanumeric characters. */
  18119. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18120. /** Used to match backslashes in property paths. */
  18121. var reEscapeChar = /\\(\\)?/g;
  18122. /**
  18123. * Used to match
  18124. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18125. */
  18126. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18127. /** Used to match `RegExp` flags from their coerced string values. */
  18128. var reFlags = /\w*$/;
  18129. /** Used to detect bad signed hexadecimal string values. */
  18130. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18131. /** Used to detect binary string values. */
  18132. var reIsBinary = /^0b[01]+$/i;
  18133. /** Used to detect host constructors (Safari). */
  18134. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18135. /** Used to detect octal string values. */
  18136. var reIsOctal = /^0o[0-7]+$/i;
  18137. /** Used to detect unsigned integer values. */
  18138. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18139. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18140. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18141. /** Used to ensure capturing order of template delimiters. */
  18142. var reNoMatch = /($^)/;
  18143. /** Used to match unescaped characters in compiled string literals. */
  18144. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18145. /** Used to compose unicode character classes. */
  18146. var rsAstralRange = '\\ud800-\\udfff',
  18147. rsComboMarksRange = '\\u0300-\\u036f',
  18148. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18149. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18150. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18151. rsDingbatRange = '\\u2700-\\u27bf',
  18152. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18153. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18154. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18155. rsPunctuationRange = '\\u2000-\\u206f',
  18156. 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',
  18157. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18158. rsVarRange = '\\ufe0e\\ufe0f',
  18159. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18160. /** Used to compose unicode capture groups. */
  18161. var rsApos = "['\u2019]",
  18162. rsAstral = '[' + rsAstralRange + ']',
  18163. rsBreak = '[' + rsBreakRange + ']',
  18164. rsCombo = '[' + rsComboRange + ']',
  18165. rsDigits = '\\d+',
  18166. rsDingbat = '[' + rsDingbatRange + ']',
  18167. rsLower = '[' + rsLowerRange + ']',
  18168. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18169. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18170. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18171. rsNonAstral = '[^' + rsAstralRange + ']',
  18172. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18173. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18174. rsUpper = '[' + rsUpperRange + ']',
  18175. rsZWJ = '\\u200d';
  18176. /** Used to compose unicode regexes. */
  18177. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18178. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18179. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18180. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18181. reOptMod = rsModifier + '?',
  18182. rsOptVar = '[' + rsVarRange + ']?',
  18183. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18184. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18185. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18186. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18187. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18188. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18189. /** Used to match apostrophes. */
  18190. var reApos = RegExp(rsApos, 'g');
  18191. /**
  18192. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18193. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18194. */
  18195. var reComboMark = RegExp(rsCombo, 'g');
  18196. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18197. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18198. /** Used to match complex or compound words. */
  18199. var reUnicodeWord = RegExp([
  18200. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18201. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18202. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18203. rsUpper + '+' + rsOptContrUpper,
  18204. rsOrdUpper,
  18205. rsOrdLower,
  18206. rsDigits,
  18207. rsEmoji
  18208. ].join('|'), 'g');
  18209. /** 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/). */
  18210. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18211. /** Used to detect strings that need a more robust regexp to match words. */
  18212. 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 ]/;
  18213. /** Used to assign default `context` object properties. */
  18214. var contextProps = [
  18215. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18216. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18217. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18218. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18219. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18220. ];
  18221. /** Used to make template sourceURLs easier to identify. */
  18222. var templateCounter = -1;
  18223. /** Used to identify `toStringTag` values of typed arrays. */
  18224. var typedArrayTags = {};
  18225. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18226. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18227. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18228. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18229. typedArrayTags[uint32Tag] = true;
  18230. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18231. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18232. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18233. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18234. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18235. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18236. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18237. typedArrayTags[weakMapTag] = false;
  18238. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18239. var cloneableTags = {};
  18240. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18241. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18242. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18243. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18244. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18245. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18246. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18247. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18248. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18249. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18250. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18251. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18252. cloneableTags[weakMapTag] = false;
  18253. /** Used to map Latin Unicode letters to basic Latin letters. */
  18254. var deburredLetters = {
  18255. // Latin-1 Supplement block.
  18256. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18257. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18258. '\xc7': 'C', '\xe7': 'c',
  18259. '\xd0': 'D', '\xf0': 'd',
  18260. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18261. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18262. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18263. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18264. '\xd1': 'N', '\xf1': 'n',
  18265. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18266. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18267. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18268. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18269. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18270. '\xc6': 'Ae', '\xe6': 'ae',
  18271. '\xde': 'Th', '\xfe': 'th',
  18272. '\xdf': 'ss',
  18273. // Latin Extended-A block.
  18274. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18275. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18276. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18277. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18278. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18279. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18280. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18281. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18282. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18283. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18284. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18285. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18286. '\u0134': 'J', '\u0135': 'j',
  18287. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18288. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18289. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18290. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18291. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18292. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18293. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18294. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18295. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18296. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18297. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18298. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18299. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18300. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18301. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18302. '\u0174': 'W', '\u0175': 'w',
  18303. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18304. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18305. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18306. '\u0132': 'IJ', '\u0133': 'ij',
  18307. '\u0152': 'Oe', '\u0153': 'oe',
  18308. '\u0149': "'n", '\u017f': 's'
  18309. };
  18310. /** Used to map characters to HTML entities. */
  18311. var htmlEscapes = {
  18312. '&': '&amp;',
  18313. '<': '&lt;',
  18314. '>': '&gt;',
  18315. '"': '&quot;',
  18316. "'": '&#39;'
  18317. };
  18318. /** Used to map HTML entities to characters. */
  18319. var htmlUnescapes = {
  18320. '&amp;': '&',
  18321. '&lt;': '<',
  18322. '&gt;': '>',
  18323. '&quot;': '"',
  18324. '&#39;': "'"
  18325. };
  18326. /** Used to escape characters for inclusion in compiled string literals. */
  18327. var stringEscapes = {
  18328. '\\': '\\',
  18329. "'": "'",
  18330. '\n': 'n',
  18331. '\r': 'r',
  18332. '\u2028': 'u2028',
  18333. '\u2029': 'u2029'
  18334. };
  18335. /** Built-in method references without a dependency on `root`. */
  18336. var freeParseFloat = parseFloat,
  18337. freeParseInt = parseInt;
  18338. /** Detect free variable `global` from Node.js. */
  18339. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18340. /** Detect free variable `self`. */
  18341. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18342. /** Used as a reference to the global object. */
  18343. var root = freeGlobal || freeSelf || Function('return this')();
  18344. /** Detect free variable `exports`. */
  18345. var freeExports = true && exports && !exports.nodeType && exports;
  18346. /** Detect free variable `module`. */
  18347. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18348. /** Detect the popular CommonJS extension `module.exports`. */
  18349. var moduleExports = freeModule && freeModule.exports === freeExports;
  18350. /** Detect free variable `process` from Node.js. */
  18351. var freeProcess = moduleExports && freeGlobal.process;
  18352. /** Used to access faster Node.js helpers. */
  18353. var nodeUtil = (function() {
  18354. try {
  18355. // Use `util.types` for Node.js 10+.
  18356. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18357. if (types) {
  18358. return types;
  18359. }
  18360. // Legacy `process.binding('util')` for Node.js < 10.
  18361. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18362. } catch (e) {}
  18363. }());
  18364. /* Node.js helper references. */
  18365. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18366. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18367. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18368. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18369. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18370. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18371. /*--------------------------------------------------------------------------*/
  18372. /**
  18373. * A faster alternative to `Function#apply`, this function invokes `func`
  18374. * with the `this` binding of `thisArg` and the arguments of `args`.
  18375. *
  18376. * @private
  18377. * @param {Function} func The function to invoke.
  18378. * @param {*} thisArg The `this` binding of `func`.
  18379. * @param {Array} args The arguments to invoke `func` with.
  18380. * @returns {*} Returns the result of `func`.
  18381. */
  18382. function apply(func, thisArg, args) {
  18383. switch (args.length) {
  18384. case 0: return func.call(thisArg);
  18385. case 1: return func.call(thisArg, args[0]);
  18386. case 2: return func.call(thisArg, args[0], args[1]);
  18387. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18388. }
  18389. return func.apply(thisArg, args);
  18390. }
  18391. /**
  18392. * A specialized version of `baseAggregator` for arrays.
  18393. *
  18394. * @private
  18395. * @param {Array} [array] The array to iterate over.
  18396. * @param {Function} setter The function to set `accumulator` values.
  18397. * @param {Function} iteratee The iteratee to transform keys.
  18398. * @param {Object} accumulator The initial aggregated object.
  18399. * @returns {Function} Returns `accumulator`.
  18400. */
  18401. function arrayAggregator(array, setter, iteratee, accumulator) {
  18402. var index = -1,
  18403. length = array == null ? 0 : array.length;
  18404. while (++index < length) {
  18405. var value = array[index];
  18406. setter(accumulator, value, iteratee(value), array);
  18407. }
  18408. return accumulator;
  18409. }
  18410. /**
  18411. * A specialized version of `_.forEach` for arrays without support for
  18412. * iteratee shorthands.
  18413. *
  18414. * @private
  18415. * @param {Array} [array] The array to iterate over.
  18416. * @param {Function} iteratee The function invoked per iteration.
  18417. * @returns {Array} Returns `array`.
  18418. */
  18419. function arrayEach(array, iteratee) {
  18420. var index = -1,
  18421. length = array == null ? 0 : array.length;
  18422. while (++index < length) {
  18423. if (iteratee(array[index], index, array) === false) {
  18424. break;
  18425. }
  18426. }
  18427. return array;
  18428. }
  18429. /**
  18430. * A specialized version of `_.forEachRight` for arrays without support for
  18431. * iteratee shorthands.
  18432. *
  18433. * @private
  18434. * @param {Array} [array] The array to iterate over.
  18435. * @param {Function} iteratee The function invoked per iteration.
  18436. * @returns {Array} Returns `array`.
  18437. */
  18438. function arrayEachRight(array, iteratee) {
  18439. var length = array == null ? 0 : array.length;
  18440. while (length--) {
  18441. if (iteratee(array[length], length, array) === false) {
  18442. break;
  18443. }
  18444. }
  18445. return array;
  18446. }
  18447. /**
  18448. * A specialized version of `_.every` for arrays without support for
  18449. * iteratee shorthands.
  18450. *
  18451. * @private
  18452. * @param {Array} [array] The array to iterate over.
  18453. * @param {Function} predicate The function invoked per iteration.
  18454. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18455. * else `false`.
  18456. */
  18457. function arrayEvery(array, predicate) {
  18458. var index = -1,
  18459. length = array == null ? 0 : array.length;
  18460. while (++index < length) {
  18461. if (!predicate(array[index], index, array)) {
  18462. return false;
  18463. }
  18464. }
  18465. return true;
  18466. }
  18467. /**
  18468. * A specialized version of `_.filter` 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 {Array} Returns the new filtered array.
  18475. */
  18476. function arrayFilter(array, predicate) {
  18477. var index = -1,
  18478. length = array == null ? 0 : array.length,
  18479. resIndex = 0,
  18480. result = [];
  18481. while (++index < length) {
  18482. var value = array[index];
  18483. if (predicate(value, index, array)) {
  18484. result[resIndex++] = value;
  18485. }
  18486. }
  18487. return result;
  18488. }
  18489. /**
  18490. * A specialized version of `_.includes` for arrays without support for
  18491. * specifying an index to search from.
  18492. *
  18493. * @private
  18494. * @param {Array} [array] The array to inspect.
  18495. * @param {*} target The value to search for.
  18496. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18497. */
  18498. function arrayIncludes(array, value) {
  18499. var length = array == null ? 0 : array.length;
  18500. return !!length && baseIndexOf(array, value, 0) > -1;
  18501. }
  18502. /**
  18503. * This function is like `arrayIncludes` except that it accepts a comparator.
  18504. *
  18505. * @private
  18506. * @param {Array} [array] The array to inspect.
  18507. * @param {*} target The value to search for.
  18508. * @param {Function} comparator The comparator invoked per element.
  18509. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18510. */
  18511. function arrayIncludesWith(array, value, comparator) {
  18512. var index = -1,
  18513. length = array == null ? 0 : array.length;
  18514. while (++index < length) {
  18515. if (comparator(value, array[index])) {
  18516. return true;
  18517. }
  18518. }
  18519. return false;
  18520. }
  18521. /**
  18522. * A specialized version of `_.map` for arrays without support for iteratee
  18523. * shorthands.
  18524. *
  18525. * @private
  18526. * @param {Array} [array] The array to iterate over.
  18527. * @param {Function} iteratee The function invoked per iteration.
  18528. * @returns {Array} Returns the new mapped array.
  18529. */
  18530. function arrayMap(array, iteratee) {
  18531. var index = -1,
  18532. length = array == null ? 0 : array.length,
  18533. result = Array(length);
  18534. while (++index < length) {
  18535. result[index] = iteratee(array[index], index, array);
  18536. }
  18537. return result;
  18538. }
  18539. /**
  18540. * Appends the elements of `values` to `array`.
  18541. *
  18542. * @private
  18543. * @param {Array} array The array to modify.
  18544. * @param {Array} values The values to append.
  18545. * @returns {Array} Returns `array`.
  18546. */
  18547. function arrayPush(array, values) {
  18548. var index = -1,
  18549. length = values.length,
  18550. offset = array.length;
  18551. while (++index < length) {
  18552. array[offset + index] = values[index];
  18553. }
  18554. return array;
  18555. }
  18556. /**
  18557. * A specialized version of `_.reduce` for arrays without support for
  18558. * iteratee shorthands.
  18559. *
  18560. * @private
  18561. * @param {Array} [array] The array to iterate over.
  18562. * @param {Function} iteratee The function invoked per iteration.
  18563. * @param {*} [accumulator] The initial value.
  18564. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18565. * the initial value.
  18566. * @returns {*} Returns the accumulated value.
  18567. */
  18568. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18569. var index = -1,
  18570. length = array == null ? 0 : array.length;
  18571. if (initAccum && length) {
  18572. accumulator = array[++index];
  18573. }
  18574. while (++index < length) {
  18575. accumulator = iteratee(accumulator, array[index], index, array);
  18576. }
  18577. return accumulator;
  18578. }
  18579. /**
  18580. * A specialized version of `_.reduceRight` for arrays without support for
  18581. * iteratee shorthands.
  18582. *
  18583. * @private
  18584. * @param {Array} [array] The array to iterate over.
  18585. * @param {Function} iteratee The function invoked per iteration.
  18586. * @param {*} [accumulator] The initial value.
  18587. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18588. * the initial value.
  18589. * @returns {*} Returns the accumulated value.
  18590. */
  18591. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18592. var length = array == null ? 0 : array.length;
  18593. if (initAccum && length) {
  18594. accumulator = array[--length];
  18595. }
  18596. while (length--) {
  18597. accumulator = iteratee(accumulator, array[length], length, array);
  18598. }
  18599. return accumulator;
  18600. }
  18601. /**
  18602. * A specialized version of `_.some` for arrays without support for iteratee
  18603. * shorthands.
  18604. *
  18605. * @private
  18606. * @param {Array} [array] The array to iterate over.
  18607. * @param {Function} predicate The function invoked per iteration.
  18608. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18609. * else `false`.
  18610. */
  18611. function arraySome(array, predicate) {
  18612. var index = -1,
  18613. length = array == null ? 0 : array.length;
  18614. while (++index < length) {
  18615. if (predicate(array[index], index, array)) {
  18616. return true;
  18617. }
  18618. }
  18619. return false;
  18620. }
  18621. /**
  18622. * Gets the size of an ASCII `string`.
  18623. *
  18624. * @private
  18625. * @param {string} string The string inspect.
  18626. * @returns {number} Returns the string size.
  18627. */
  18628. var asciiSize = baseProperty('length');
  18629. /**
  18630. * Converts an ASCII `string` to an array.
  18631. *
  18632. * @private
  18633. * @param {string} string The string to convert.
  18634. * @returns {Array} Returns the converted array.
  18635. */
  18636. function asciiToArray(string) {
  18637. return string.split('');
  18638. }
  18639. /**
  18640. * Splits an ASCII `string` into an array of its words.
  18641. *
  18642. * @private
  18643. * @param {string} The string to inspect.
  18644. * @returns {Array} Returns the words of `string`.
  18645. */
  18646. function asciiWords(string) {
  18647. return string.match(reAsciiWord) || [];
  18648. }
  18649. /**
  18650. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18651. * without support for iteratee shorthands, which iterates over `collection`
  18652. * using `eachFunc`.
  18653. *
  18654. * @private
  18655. * @param {Array|Object} collection The collection to inspect.
  18656. * @param {Function} predicate The function invoked per iteration.
  18657. * @param {Function} eachFunc The function to iterate over `collection`.
  18658. * @returns {*} Returns the found element or its key, else `undefined`.
  18659. */
  18660. function baseFindKey(collection, predicate, eachFunc) {
  18661. var result;
  18662. eachFunc(collection, function(value, key, collection) {
  18663. if (predicate(value, key, collection)) {
  18664. result = key;
  18665. return false;
  18666. }
  18667. });
  18668. return result;
  18669. }
  18670. /**
  18671. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18672. * support for iteratee shorthands.
  18673. *
  18674. * @private
  18675. * @param {Array} array The array to inspect.
  18676. * @param {Function} predicate The function invoked per iteration.
  18677. * @param {number} fromIndex The index to search from.
  18678. * @param {boolean} [fromRight] Specify iterating from right to left.
  18679. * @returns {number} Returns the index of the matched value, else `-1`.
  18680. */
  18681. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18682. var length = array.length,
  18683. index = fromIndex + (fromRight ? 1 : -1);
  18684. while ((fromRight ? index-- : ++index < length)) {
  18685. if (predicate(array[index], index, array)) {
  18686. return index;
  18687. }
  18688. }
  18689. return -1;
  18690. }
  18691. /**
  18692. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18693. *
  18694. * @private
  18695. * @param {Array} array The array to inspect.
  18696. * @param {*} value The value to search for.
  18697. * @param {number} fromIndex The index to search from.
  18698. * @returns {number} Returns the index of the matched value, else `-1`.
  18699. */
  18700. function baseIndexOf(array, value, fromIndex) {
  18701. return value === value
  18702. ? strictIndexOf(array, value, fromIndex)
  18703. : baseFindIndex(array, baseIsNaN, fromIndex);
  18704. }
  18705. /**
  18706. * This function is like `baseIndexOf` except that it accepts a comparator.
  18707. *
  18708. * @private
  18709. * @param {Array} array The array to inspect.
  18710. * @param {*} value The value to search for.
  18711. * @param {number} fromIndex The index to search from.
  18712. * @param {Function} comparator The comparator invoked per element.
  18713. * @returns {number} Returns the index of the matched value, else `-1`.
  18714. */
  18715. function baseIndexOfWith(array, value, fromIndex, comparator) {
  18716. var index = fromIndex - 1,
  18717. length = array.length;
  18718. while (++index < length) {
  18719. if (comparator(array[index], value)) {
  18720. return index;
  18721. }
  18722. }
  18723. return -1;
  18724. }
  18725. /**
  18726. * The base implementation of `_.isNaN` without support for number objects.
  18727. *
  18728. * @private
  18729. * @param {*} value The value to check.
  18730. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  18731. */
  18732. function baseIsNaN(value) {
  18733. return value !== value;
  18734. }
  18735. /**
  18736. * The base implementation of `_.mean` and `_.meanBy` without support for
  18737. * iteratee shorthands.
  18738. *
  18739. * @private
  18740. * @param {Array} array The array to iterate over.
  18741. * @param {Function} iteratee The function invoked per iteration.
  18742. * @returns {number} Returns the mean.
  18743. */
  18744. function baseMean(array, iteratee) {
  18745. var length = array == null ? 0 : array.length;
  18746. return length ? (baseSum(array, iteratee) / length) : NAN;
  18747. }
  18748. /**
  18749. * The base implementation of `_.property` without support for deep paths.
  18750. *
  18751. * @private
  18752. * @param {string} key The key of the property to get.
  18753. * @returns {Function} Returns the new accessor function.
  18754. */
  18755. function baseProperty(key) {
  18756. return function(object) {
  18757. return object == null ? undefined : object[key];
  18758. };
  18759. }
  18760. /**
  18761. * The base implementation of `_.propertyOf` without support for deep paths.
  18762. *
  18763. * @private
  18764. * @param {Object} object The object to query.
  18765. * @returns {Function} Returns the new accessor function.
  18766. */
  18767. function basePropertyOf(object) {
  18768. return function(key) {
  18769. return object == null ? undefined : object[key];
  18770. };
  18771. }
  18772. /**
  18773. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  18774. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  18775. *
  18776. * @private
  18777. * @param {Array|Object} collection The collection to iterate over.
  18778. * @param {Function} iteratee The function invoked per iteration.
  18779. * @param {*} accumulator The initial value.
  18780. * @param {boolean} initAccum Specify using the first or last element of
  18781. * `collection` as the initial value.
  18782. * @param {Function} eachFunc The function to iterate over `collection`.
  18783. * @returns {*} Returns the accumulated value.
  18784. */
  18785. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  18786. eachFunc(collection, function(value, index, collection) {
  18787. accumulator = initAccum
  18788. ? (initAccum = false, value)
  18789. : iteratee(accumulator, value, index, collection);
  18790. });
  18791. return accumulator;
  18792. }
  18793. /**
  18794. * The base implementation of `_.sortBy` which uses `comparer` to define the
  18795. * sort order of `array` and replaces criteria objects with their corresponding
  18796. * values.
  18797. *
  18798. * @private
  18799. * @param {Array} array The array to sort.
  18800. * @param {Function} comparer The function to define sort order.
  18801. * @returns {Array} Returns `array`.
  18802. */
  18803. function baseSortBy(array, comparer) {
  18804. var length = array.length;
  18805. array.sort(comparer);
  18806. while (length--) {
  18807. array[length] = array[length].value;
  18808. }
  18809. return array;
  18810. }
  18811. /**
  18812. * The base implementation of `_.sum` and `_.sumBy` without support for
  18813. * iteratee shorthands.
  18814. *
  18815. * @private
  18816. * @param {Array} array The array to iterate over.
  18817. * @param {Function} iteratee The function invoked per iteration.
  18818. * @returns {number} Returns the sum.
  18819. */
  18820. function baseSum(array, iteratee) {
  18821. var result,
  18822. index = -1,
  18823. length = array.length;
  18824. while (++index < length) {
  18825. var current = iteratee(array[index]);
  18826. if (current !== undefined) {
  18827. result = result === undefined ? current : (result + current);
  18828. }
  18829. }
  18830. return result;
  18831. }
  18832. /**
  18833. * The base implementation of `_.times` without support for iteratee shorthands
  18834. * or max array length checks.
  18835. *
  18836. * @private
  18837. * @param {number} n The number of times to invoke `iteratee`.
  18838. * @param {Function} iteratee The function invoked per iteration.
  18839. * @returns {Array} Returns the array of results.
  18840. */
  18841. function baseTimes(n, iteratee) {
  18842. var index = -1,
  18843. result = Array(n);
  18844. while (++index < n) {
  18845. result[index] = iteratee(index);
  18846. }
  18847. return result;
  18848. }
  18849. /**
  18850. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  18851. * of key-value pairs for `object` corresponding to the property names of `props`.
  18852. *
  18853. * @private
  18854. * @param {Object} object The object to query.
  18855. * @param {Array} props The property names to get values for.
  18856. * @returns {Object} Returns the key-value pairs.
  18857. */
  18858. function baseToPairs(object, props) {
  18859. return arrayMap(props, function(key) {
  18860. return [key, object[key]];
  18861. });
  18862. }
  18863. /**
  18864. * The base implementation of `_.unary` without support for storing metadata.
  18865. *
  18866. * @private
  18867. * @param {Function} func The function to cap arguments for.
  18868. * @returns {Function} Returns the new capped function.
  18869. */
  18870. function baseUnary(func) {
  18871. return function(value) {
  18872. return func(value);
  18873. };
  18874. }
  18875. /**
  18876. * The base implementation of `_.values` and `_.valuesIn` which creates an
  18877. * array of `object` property values corresponding to the property names
  18878. * of `props`.
  18879. *
  18880. * @private
  18881. * @param {Object} object The object to query.
  18882. * @param {Array} props The property names to get values for.
  18883. * @returns {Object} Returns the array of property values.
  18884. */
  18885. function baseValues(object, props) {
  18886. return arrayMap(props, function(key) {
  18887. return object[key];
  18888. });
  18889. }
  18890. /**
  18891. * Checks if a `cache` value for `key` exists.
  18892. *
  18893. * @private
  18894. * @param {Object} cache The cache to query.
  18895. * @param {string} key The key of the entry to check.
  18896. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  18897. */
  18898. function cacheHas(cache, key) {
  18899. return cache.has(key);
  18900. }
  18901. /**
  18902. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  18903. * that is not found in the character symbols.
  18904. *
  18905. * @private
  18906. * @param {Array} strSymbols The string symbols to inspect.
  18907. * @param {Array} chrSymbols The character symbols to find.
  18908. * @returns {number} Returns the index of the first unmatched string symbol.
  18909. */
  18910. function charsStartIndex(strSymbols, chrSymbols) {
  18911. var index = -1,
  18912. length = strSymbols.length;
  18913. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18914. return index;
  18915. }
  18916. /**
  18917. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  18918. * that is not found in the character symbols.
  18919. *
  18920. * @private
  18921. * @param {Array} strSymbols The string symbols to inspect.
  18922. * @param {Array} chrSymbols The character symbols to find.
  18923. * @returns {number} Returns the index of the last unmatched string symbol.
  18924. */
  18925. function charsEndIndex(strSymbols, chrSymbols) {
  18926. var index = strSymbols.length;
  18927. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18928. return index;
  18929. }
  18930. /**
  18931. * Gets the number of `placeholder` occurrences in `array`.
  18932. *
  18933. * @private
  18934. * @param {Array} array The array to inspect.
  18935. * @param {*} placeholder The placeholder to search for.
  18936. * @returns {number} Returns the placeholder count.
  18937. */
  18938. function countHolders(array, placeholder) {
  18939. var length = array.length,
  18940. result = 0;
  18941. while (length--) {
  18942. if (array[length] === placeholder) {
  18943. ++result;
  18944. }
  18945. }
  18946. return result;
  18947. }
  18948. /**
  18949. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  18950. * letters to basic Latin letters.
  18951. *
  18952. * @private
  18953. * @param {string} letter The matched letter to deburr.
  18954. * @returns {string} Returns the deburred letter.
  18955. */
  18956. var deburrLetter = basePropertyOf(deburredLetters);
  18957. /**
  18958. * Used by `_.escape` to convert characters to HTML entities.
  18959. *
  18960. * @private
  18961. * @param {string} chr The matched character to escape.
  18962. * @returns {string} Returns the escaped character.
  18963. */
  18964. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  18965. /**
  18966. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  18967. *
  18968. * @private
  18969. * @param {string} chr The matched character to escape.
  18970. * @returns {string} Returns the escaped character.
  18971. */
  18972. function escapeStringChar(chr) {
  18973. return '\\' + stringEscapes[chr];
  18974. }
  18975. /**
  18976. * Gets the value at `key` of `object`.
  18977. *
  18978. * @private
  18979. * @param {Object} [object] The object to query.
  18980. * @param {string} key The key of the property to get.
  18981. * @returns {*} Returns the property value.
  18982. */
  18983. function getValue(object, key) {
  18984. return object == null ? undefined : object[key];
  18985. }
  18986. /**
  18987. * Checks if `string` contains Unicode symbols.
  18988. *
  18989. * @private
  18990. * @param {string} string The string to inspect.
  18991. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  18992. */
  18993. function hasUnicode(string) {
  18994. return reHasUnicode.test(string);
  18995. }
  18996. /**
  18997. * Checks if `string` contains a word composed of Unicode symbols.
  18998. *
  18999. * @private
  19000. * @param {string} string The string to inspect.
  19001. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19002. */
  19003. function hasUnicodeWord(string) {
  19004. return reHasUnicodeWord.test(string);
  19005. }
  19006. /**
  19007. * Converts `iterator` to an array.
  19008. *
  19009. * @private
  19010. * @param {Object} iterator The iterator to convert.
  19011. * @returns {Array} Returns the converted array.
  19012. */
  19013. function iteratorToArray(iterator) {
  19014. var data,
  19015. result = [];
  19016. while (!(data = iterator.next()).done) {
  19017. result.push(data.value);
  19018. }
  19019. return result;
  19020. }
  19021. /**
  19022. * Converts `map` to its key-value pairs.
  19023. *
  19024. * @private
  19025. * @param {Object} map The map to convert.
  19026. * @returns {Array} Returns the key-value pairs.
  19027. */
  19028. function mapToArray(map) {
  19029. var index = -1,
  19030. result = Array(map.size);
  19031. map.forEach(function(value, key) {
  19032. result[++index] = [key, value];
  19033. });
  19034. return result;
  19035. }
  19036. /**
  19037. * Creates a unary function that invokes `func` with its argument transformed.
  19038. *
  19039. * @private
  19040. * @param {Function} func The function to wrap.
  19041. * @param {Function} transform The argument transform.
  19042. * @returns {Function} Returns the new function.
  19043. */
  19044. function overArg(func, transform) {
  19045. return function(arg) {
  19046. return func(transform(arg));
  19047. };
  19048. }
  19049. /**
  19050. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19051. * and returns an array of their indexes.
  19052. *
  19053. * @private
  19054. * @param {Array} array The array to modify.
  19055. * @param {*} placeholder The placeholder to replace.
  19056. * @returns {Array} Returns the new array of placeholder indexes.
  19057. */
  19058. function replaceHolders(array, placeholder) {
  19059. var index = -1,
  19060. length = array.length,
  19061. resIndex = 0,
  19062. result = [];
  19063. while (++index < length) {
  19064. var value = array[index];
  19065. if (value === placeholder || value === PLACEHOLDER) {
  19066. array[index] = PLACEHOLDER;
  19067. result[resIndex++] = index;
  19068. }
  19069. }
  19070. return result;
  19071. }
  19072. /**
  19073. * Converts `set` to an array of its values.
  19074. *
  19075. * @private
  19076. * @param {Object} set The set to convert.
  19077. * @returns {Array} Returns the values.
  19078. */
  19079. function setToArray(set) {
  19080. var index = -1,
  19081. result = Array(set.size);
  19082. set.forEach(function(value) {
  19083. result[++index] = value;
  19084. });
  19085. return result;
  19086. }
  19087. /**
  19088. * Converts `set` to its value-value pairs.
  19089. *
  19090. * @private
  19091. * @param {Object} set The set to convert.
  19092. * @returns {Array} Returns the value-value pairs.
  19093. */
  19094. function setToPairs(set) {
  19095. var index = -1,
  19096. result = Array(set.size);
  19097. set.forEach(function(value) {
  19098. result[++index] = [value, value];
  19099. });
  19100. return result;
  19101. }
  19102. /**
  19103. * A specialized version of `_.indexOf` which performs strict equality
  19104. * comparisons of values, i.e. `===`.
  19105. *
  19106. * @private
  19107. * @param {Array} array The array to inspect.
  19108. * @param {*} value The value to search for.
  19109. * @param {number} fromIndex The index to search from.
  19110. * @returns {number} Returns the index of the matched value, else `-1`.
  19111. */
  19112. function strictIndexOf(array, value, fromIndex) {
  19113. var index = fromIndex - 1,
  19114. length = array.length;
  19115. while (++index < length) {
  19116. if (array[index] === value) {
  19117. return index;
  19118. }
  19119. }
  19120. return -1;
  19121. }
  19122. /**
  19123. * A specialized version of `_.lastIndexOf` 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 strictLastIndexOf(array, value, fromIndex) {
  19133. var index = fromIndex + 1;
  19134. while (index--) {
  19135. if (array[index] === value) {
  19136. return index;
  19137. }
  19138. }
  19139. return index;
  19140. }
  19141. /**
  19142. * Gets the number of symbols in `string`.
  19143. *
  19144. * @private
  19145. * @param {string} string The string to inspect.
  19146. * @returns {number} Returns the string size.
  19147. */
  19148. function stringSize(string) {
  19149. return hasUnicode(string)
  19150. ? unicodeSize(string)
  19151. : asciiSize(string);
  19152. }
  19153. /**
  19154. * Converts `string` to an array.
  19155. *
  19156. * @private
  19157. * @param {string} string The string to convert.
  19158. * @returns {Array} Returns the converted array.
  19159. */
  19160. function stringToArray(string) {
  19161. return hasUnicode(string)
  19162. ? unicodeToArray(string)
  19163. : asciiToArray(string);
  19164. }
  19165. /**
  19166. * Used by `_.unescape` to convert HTML entities to characters.
  19167. *
  19168. * @private
  19169. * @param {string} chr The matched character to unescape.
  19170. * @returns {string} Returns the unescaped character.
  19171. */
  19172. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19173. /**
  19174. * Gets the size of a Unicode `string`.
  19175. *
  19176. * @private
  19177. * @param {string} string The string inspect.
  19178. * @returns {number} Returns the string size.
  19179. */
  19180. function unicodeSize(string) {
  19181. var result = reUnicode.lastIndex = 0;
  19182. while (reUnicode.test(string)) {
  19183. ++result;
  19184. }
  19185. return result;
  19186. }
  19187. /**
  19188. * Converts a Unicode `string` to an array.
  19189. *
  19190. * @private
  19191. * @param {string} string The string to convert.
  19192. * @returns {Array} Returns the converted array.
  19193. */
  19194. function unicodeToArray(string) {
  19195. return string.match(reUnicode) || [];
  19196. }
  19197. /**
  19198. * Splits a Unicode `string` into an array of its words.
  19199. *
  19200. * @private
  19201. * @param {string} The string to inspect.
  19202. * @returns {Array} Returns the words of `string`.
  19203. */
  19204. function unicodeWords(string) {
  19205. return string.match(reUnicodeWord) || [];
  19206. }
  19207. /*--------------------------------------------------------------------------*/
  19208. /**
  19209. * Create a new pristine `lodash` function using the `context` object.
  19210. *
  19211. * @static
  19212. * @memberOf _
  19213. * @since 1.1.0
  19214. * @category Util
  19215. * @param {Object} [context=root] The context object.
  19216. * @returns {Function} Returns a new `lodash` function.
  19217. * @example
  19218. *
  19219. * _.mixin({ 'foo': _.constant('foo') });
  19220. *
  19221. * var lodash = _.runInContext();
  19222. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19223. *
  19224. * _.isFunction(_.foo);
  19225. * // => true
  19226. * _.isFunction(_.bar);
  19227. * // => false
  19228. *
  19229. * lodash.isFunction(lodash.foo);
  19230. * // => false
  19231. * lodash.isFunction(lodash.bar);
  19232. * // => true
  19233. *
  19234. * // Create a suped-up `defer` in Node.js.
  19235. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19236. */
  19237. var runInContext = (function runInContext(context) {
  19238. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19239. /** Built-in constructor references. */
  19240. var Array = context.Array,
  19241. Date = context.Date,
  19242. Error = context.Error,
  19243. Function = context.Function,
  19244. Math = context.Math,
  19245. Object = context.Object,
  19246. RegExp = context.RegExp,
  19247. String = context.String,
  19248. TypeError = context.TypeError;
  19249. /** Used for built-in method references. */
  19250. var arrayProto = Array.prototype,
  19251. funcProto = Function.prototype,
  19252. objectProto = Object.prototype;
  19253. /** Used to detect overreaching core-js shims. */
  19254. var coreJsData = context['__core-js_shared__'];
  19255. /** Used to resolve the decompiled source of functions. */
  19256. var funcToString = funcProto.toString;
  19257. /** Used to check objects for own properties. */
  19258. var hasOwnProperty = objectProto.hasOwnProperty;
  19259. /** Used to generate unique IDs. */
  19260. var idCounter = 0;
  19261. /** Used to detect methods masquerading as native. */
  19262. var maskSrcKey = (function() {
  19263. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19264. return uid ? ('Symbol(src)_1.' + uid) : '';
  19265. }());
  19266. /**
  19267. * Used to resolve the
  19268. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19269. * of values.
  19270. */
  19271. var nativeObjectToString = objectProto.toString;
  19272. /** Used to infer the `Object` constructor. */
  19273. var objectCtorString = funcToString.call(Object);
  19274. /** Used to restore the original `_` reference in `_.noConflict`. */
  19275. var oldDash = root._;
  19276. /** Used to detect if a method is native. */
  19277. var reIsNative = RegExp('^' +
  19278. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19279. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19280. );
  19281. /** Built-in value references. */
  19282. var Buffer = moduleExports ? context.Buffer : undefined,
  19283. Symbol = context.Symbol,
  19284. Uint8Array = context.Uint8Array,
  19285. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19286. getPrototype = overArg(Object.getPrototypeOf, Object),
  19287. objectCreate = Object.create,
  19288. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19289. splice = arrayProto.splice,
  19290. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19291. symIterator = Symbol ? Symbol.iterator : undefined,
  19292. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19293. var defineProperty = (function() {
  19294. try {
  19295. var func = getNative(Object, 'defineProperty');
  19296. func({}, '', {});
  19297. return func;
  19298. } catch (e) {}
  19299. }());
  19300. /** Mocked built-ins. */
  19301. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19302. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19303. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19304. /* Built-in method references for those with the same name as other `lodash` methods. */
  19305. var nativeCeil = Math.ceil,
  19306. nativeFloor = Math.floor,
  19307. nativeGetSymbols = Object.getOwnPropertySymbols,
  19308. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19309. nativeIsFinite = context.isFinite,
  19310. nativeJoin = arrayProto.join,
  19311. nativeKeys = overArg(Object.keys, Object),
  19312. nativeMax = Math.max,
  19313. nativeMin = Math.min,
  19314. nativeNow = Date.now,
  19315. nativeParseInt = context.parseInt,
  19316. nativeRandom = Math.random,
  19317. nativeReverse = arrayProto.reverse;
  19318. /* Built-in method references that are verified to be native. */
  19319. var DataView = getNative(context, 'DataView'),
  19320. Map = getNative(context, 'Map'),
  19321. Promise = getNative(context, 'Promise'),
  19322. Set = getNative(context, 'Set'),
  19323. WeakMap = getNative(context, 'WeakMap'),
  19324. nativeCreate = getNative(Object, 'create');
  19325. /** Used to store function metadata. */
  19326. var metaMap = WeakMap && new WeakMap;
  19327. /** Used to lookup unminified function names. */
  19328. var realNames = {};
  19329. /** Used to detect maps, sets, and weakmaps. */
  19330. var dataViewCtorString = toSource(DataView),
  19331. mapCtorString = toSource(Map),
  19332. promiseCtorString = toSource(Promise),
  19333. setCtorString = toSource(Set),
  19334. weakMapCtorString = toSource(WeakMap);
  19335. /** Used to convert symbols to primitives and strings. */
  19336. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19337. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19338. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19339. /*------------------------------------------------------------------------*/
  19340. /**
  19341. * Creates a `lodash` object which wraps `value` to enable implicit method
  19342. * chain sequences. Methods that operate on and return arrays, collections,
  19343. * and functions can be chained together. Methods that retrieve a single value
  19344. * or may return a primitive value will automatically end the chain sequence
  19345. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19346. * with `_#value`.
  19347. *
  19348. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19349. * enabled using `_.chain`.
  19350. *
  19351. * The execution of chained methods is lazy, that is, it's deferred until
  19352. * `_#value` is implicitly or explicitly called.
  19353. *
  19354. * Lazy evaluation allows several methods to support shortcut fusion.
  19355. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19356. * the creation of intermediate arrays and can greatly reduce the number of
  19357. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19358. * fusion if the section is applied to an array and iteratees accept only
  19359. * one argument. The heuristic for whether a section qualifies for shortcut
  19360. * fusion is subject to change.
  19361. *
  19362. * Chaining is supported in custom builds as long as the `_#value` method is
  19363. * directly or indirectly included in the build.
  19364. *
  19365. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19366. *
  19367. * The wrapper `Array` methods are:
  19368. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19369. *
  19370. * The wrapper `String` methods are:
  19371. * `replace` and `split`
  19372. *
  19373. * The wrapper methods that support shortcut fusion are:
  19374. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19375. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19376. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19377. *
  19378. * The chainable wrapper methods are:
  19379. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19380. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19381. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19382. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19383. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19384. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19385. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19386. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19387. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19388. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19389. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19390. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19391. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19392. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19393. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19394. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19395. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19396. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19397. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19398. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19399. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19400. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19401. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19402. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19403. *
  19404. * The wrapper methods that are **not** chainable by default are:
  19405. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19406. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19407. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19408. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19409. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19410. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19411. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19412. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19413. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19414. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19415. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19416. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19417. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19418. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19419. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19420. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19421. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19422. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19423. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19424. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19425. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19426. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19427. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19428. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19429. * `upperFirst`, `value`, and `words`
  19430. *
  19431. * @name _
  19432. * @constructor
  19433. * @category Seq
  19434. * @param {*} value The value to wrap in a `lodash` instance.
  19435. * @returns {Object} Returns the new `lodash` wrapper instance.
  19436. * @example
  19437. *
  19438. * function square(n) {
  19439. * return n * n;
  19440. * }
  19441. *
  19442. * var wrapped = _([1, 2, 3]);
  19443. *
  19444. * // Returns an unwrapped value.
  19445. * wrapped.reduce(_.add);
  19446. * // => 6
  19447. *
  19448. * // Returns a wrapped value.
  19449. * var squares = wrapped.map(square);
  19450. *
  19451. * _.isArray(squares);
  19452. * // => false
  19453. *
  19454. * _.isArray(squares.value());
  19455. * // => true
  19456. */
  19457. function lodash(value) {
  19458. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19459. if (value instanceof LodashWrapper) {
  19460. return value;
  19461. }
  19462. if (hasOwnProperty.call(value, '__wrapped__')) {
  19463. return wrapperClone(value);
  19464. }
  19465. }
  19466. return new LodashWrapper(value);
  19467. }
  19468. /**
  19469. * The base implementation of `_.create` without support for assigning
  19470. * properties to the created object.
  19471. *
  19472. * @private
  19473. * @param {Object} proto The object to inherit from.
  19474. * @returns {Object} Returns the new object.
  19475. */
  19476. var baseCreate = (function() {
  19477. function object() {}
  19478. return function(proto) {
  19479. if (!isObject(proto)) {
  19480. return {};
  19481. }
  19482. if (objectCreate) {
  19483. return objectCreate(proto);
  19484. }
  19485. object.prototype = proto;
  19486. var result = new object;
  19487. object.prototype = undefined;
  19488. return result;
  19489. };
  19490. }());
  19491. /**
  19492. * The function whose prototype chain sequence wrappers inherit from.
  19493. *
  19494. * @private
  19495. */
  19496. function baseLodash() {
  19497. // No operation performed.
  19498. }
  19499. /**
  19500. * The base constructor for creating `lodash` wrapper objects.
  19501. *
  19502. * @private
  19503. * @param {*} value The value to wrap.
  19504. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19505. */
  19506. function LodashWrapper(value, chainAll) {
  19507. this.__wrapped__ = value;
  19508. this.__actions__ = [];
  19509. this.__chain__ = !!chainAll;
  19510. this.__index__ = 0;
  19511. this.__values__ = undefined;
  19512. }
  19513. /**
  19514. * By default, the template delimiters used by lodash are like those in
  19515. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19516. * following template settings to use alternative delimiters.
  19517. *
  19518. * @static
  19519. * @memberOf _
  19520. * @type {Object}
  19521. */
  19522. lodash.templateSettings = {
  19523. /**
  19524. * Used to detect `data` property values to be HTML-escaped.
  19525. *
  19526. * @memberOf _.templateSettings
  19527. * @type {RegExp}
  19528. */
  19529. 'escape': reEscape,
  19530. /**
  19531. * Used to detect code to be evaluated.
  19532. *
  19533. * @memberOf _.templateSettings
  19534. * @type {RegExp}
  19535. */
  19536. 'evaluate': reEvaluate,
  19537. /**
  19538. * Used to detect `data` property values to inject.
  19539. *
  19540. * @memberOf _.templateSettings
  19541. * @type {RegExp}
  19542. */
  19543. 'interpolate': reInterpolate,
  19544. /**
  19545. * Used to reference the data object in the template text.
  19546. *
  19547. * @memberOf _.templateSettings
  19548. * @type {string}
  19549. */
  19550. 'variable': '',
  19551. /**
  19552. * Used to import variables into the compiled template.
  19553. *
  19554. * @memberOf _.templateSettings
  19555. * @type {Object}
  19556. */
  19557. 'imports': {
  19558. /**
  19559. * A reference to the `lodash` function.
  19560. *
  19561. * @memberOf _.templateSettings.imports
  19562. * @type {Function}
  19563. */
  19564. '_': lodash
  19565. }
  19566. };
  19567. // Ensure wrappers are instances of `baseLodash`.
  19568. lodash.prototype = baseLodash.prototype;
  19569. lodash.prototype.constructor = lodash;
  19570. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19571. LodashWrapper.prototype.constructor = LodashWrapper;
  19572. /*------------------------------------------------------------------------*/
  19573. /**
  19574. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19575. *
  19576. * @private
  19577. * @constructor
  19578. * @param {*} value The value to wrap.
  19579. */
  19580. function LazyWrapper(value) {
  19581. this.__wrapped__ = value;
  19582. this.__actions__ = [];
  19583. this.__dir__ = 1;
  19584. this.__filtered__ = false;
  19585. this.__iteratees__ = [];
  19586. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19587. this.__views__ = [];
  19588. }
  19589. /**
  19590. * Creates a clone of the lazy wrapper object.
  19591. *
  19592. * @private
  19593. * @name clone
  19594. * @memberOf LazyWrapper
  19595. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19596. */
  19597. function lazyClone() {
  19598. var result = new LazyWrapper(this.__wrapped__);
  19599. result.__actions__ = copyArray(this.__actions__);
  19600. result.__dir__ = this.__dir__;
  19601. result.__filtered__ = this.__filtered__;
  19602. result.__iteratees__ = copyArray(this.__iteratees__);
  19603. result.__takeCount__ = this.__takeCount__;
  19604. result.__views__ = copyArray(this.__views__);
  19605. return result;
  19606. }
  19607. /**
  19608. * Reverses the direction of lazy iteration.
  19609. *
  19610. * @private
  19611. * @name reverse
  19612. * @memberOf LazyWrapper
  19613. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19614. */
  19615. function lazyReverse() {
  19616. if (this.__filtered__) {
  19617. var result = new LazyWrapper(this);
  19618. result.__dir__ = -1;
  19619. result.__filtered__ = true;
  19620. } else {
  19621. result = this.clone();
  19622. result.__dir__ *= -1;
  19623. }
  19624. return result;
  19625. }
  19626. /**
  19627. * Extracts the unwrapped value from its lazy wrapper.
  19628. *
  19629. * @private
  19630. * @name value
  19631. * @memberOf LazyWrapper
  19632. * @returns {*} Returns the unwrapped value.
  19633. */
  19634. function lazyValue() {
  19635. var array = this.__wrapped__.value(),
  19636. dir = this.__dir__,
  19637. isArr = isArray(array),
  19638. isRight = dir < 0,
  19639. arrLength = isArr ? array.length : 0,
  19640. view = getView(0, arrLength, this.__views__),
  19641. start = view.start,
  19642. end = view.end,
  19643. length = end - start,
  19644. index = isRight ? end : (start - 1),
  19645. iteratees = this.__iteratees__,
  19646. iterLength = iteratees.length,
  19647. resIndex = 0,
  19648. takeCount = nativeMin(length, this.__takeCount__);
  19649. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19650. return baseWrapperValue(array, this.__actions__);
  19651. }
  19652. var result = [];
  19653. outer:
  19654. while (length-- && resIndex < takeCount) {
  19655. index += dir;
  19656. var iterIndex = -1,
  19657. value = array[index];
  19658. while (++iterIndex < iterLength) {
  19659. var data = iteratees[iterIndex],
  19660. iteratee = data.iteratee,
  19661. type = data.type,
  19662. computed = iteratee(value);
  19663. if (type == LAZY_MAP_FLAG) {
  19664. value = computed;
  19665. } else if (!computed) {
  19666. if (type == LAZY_FILTER_FLAG) {
  19667. continue outer;
  19668. } else {
  19669. break outer;
  19670. }
  19671. }
  19672. }
  19673. result[resIndex++] = value;
  19674. }
  19675. return result;
  19676. }
  19677. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19678. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19679. LazyWrapper.prototype.constructor = LazyWrapper;
  19680. /*------------------------------------------------------------------------*/
  19681. /**
  19682. * Creates a hash object.
  19683. *
  19684. * @private
  19685. * @constructor
  19686. * @param {Array} [entries] The key-value pairs to cache.
  19687. */
  19688. function Hash(entries) {
  19689. var index = -1,
  19690. length = entries == null ? 0 : entries.length;
  19691. this.clear();
  19692. while (++index < length) {
  19693. var entry = entries[index];
  19694. this.set(entry[0], entry[1]);
  19695. }
  19696. }
  19697. /**
  19698. * Removes all key-value entries from the hash.
  19699. *
  19700. * @private
  19701. * @name clear
  19702. * @memberOf Hash
  19703. */
  19704. function hashClear() {
  19705. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19706. this.size = 0;
  19707. }
  19708. /**
  19709. * Removes `key` and its value from the hash.
  19710. *
  19711. * @private
  19712. * @name delete
  19713. * @memberOf Hash
  19714. * @param {Object} hash The hash to modify.
  19715. * @param {string} key The key of the value to remove.
  19716. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19717. */
  19718. function hashDelete(key) {
  19719. var result = this.has(key) && delete this.__data__[key];
  19720. this.size -= result ? 1 : 0;
  19721. return result;
  19722. }
  19723. /**
  19724. * Gets the hash value for `key`.
  19725. *
  19726. * @private
  19727. * @name get
  19728. * @memberOf Hash
  19729. * @param {string} key The key of the value to get.
  19730. * @returns {*} Returns the entry value.
  19731. */
  19732. function hashGet(key) {
  19733. var data = this.__data__;
  19734. if (nativeCreate) {
  19735. var result = data[key];
  19736. return result === HASH_UNDEFINED ? undefined : result;
  19737. }
  19738. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  19739. }
  19740. /**
  19741. * Checks if a hash value for `key` exists.
  19742. *
  19743. * @private
  19744. * @name has
  19745. * @memberOf Hash
  19746. * @param {string} key The key of the entry to check.
  19747. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19748. */
  19749. function hashHas(key) {
  19750. var data = this.__data__;
  19751. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  19752. }
  19753. /**
  19754. * Sets the hash `key` to `value`.
  19755. *
  19756. * @private
  19757. * @name set
  19758. * @memberOf Hash
  19759. * @param {string} key The key of the value to set.
  19760. * @param {*} value The value to set.
  19761. * @returns {Object} Returns the hash instance.
  19762. */
  19763. function hashSet(key, value) {
  19764. var data = this.__data__;
  19765. this.size += this.has(key) ? 0 : 1;
  19766. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  19767. return this;
  19768. }
  19769. // Add methods to `Hash`.
  19770. Hash.prototype.clear = hashClear;
  19771. Hash.prototype['delete'] = hashDelete;
  19772. Hash.prototype.get = hashGet;
  19773. Hash.prototype.has = hashHas;
  19774. Hash.prototype.set = hashSet;
  19775. /*------------------------------------------------------------------------*/
  19776. /**
  19777. * Creates an list cache object.
  19778. *
  19779. * @private
  19780. * @constructor
  19781. * @param {Array} [entries] The key-value pairs to cache.
  19782. */
  19783. function ListCache(entries) {
  19784. var index = -1,
  19785. length = entries == null ? 0 : entries.length;
  19786. this.clear();
  19787. while (++index < length) {
  19788. var entry = entries[index];
  19789. this.set(entry[0], entry[1]);
  19790. }
  19791. }
  19792. /**
  19793. * Removes all key-value entries from the list cache.
  19794. *
  19795. * @private
  19796. * @name clear
  19797. * @memberOf ListCache
  19798. */
  19799. function listCacheClear() {
  19800. this.__data__ = [];
  19801. this.size = 0;
  19802. }
  19803. /**
  19804. * Removes `key` and its value from the list cache.
  19805. *
  19806. * @private
  19807. * @name delete
  19808. * @memberOf ListCache
  19809. * @param {string} key The key of the value to remove.
  19810. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19811. */
  19812. function listCacheDelete(key) {
  19813. var data = this.__data__,
  19814. index = assocIndexOf(data, key);
  19815. if (index < 0) {
  19816. return false;
  19817. }
  19818. var lastIndex = data.length - 1;
  19819. if (index == lastIndex) {
  19820. data.pop();
  19821. } else {
  19822. splice.call(data, index, 1);
  19823. }
  19824. --this.size;
  19825. return true;
  19826. }
  19827. /**
  19828. * Gets the list cache value for `key`.
  19829. *
  19830. * @private
  19831. * @name get
  19832. * @memberOf ListCache
  19833. * @param {string} key The key of the value to get.
  19834. * @returns {*} Returns the entry value.
  19835. */
  19836. function listCacheGet(key) {
  19837. var data = this.__data__,
  19838. index = assocIndexOf(data, key);
  19839. return index < 0 ? undefined : data[index][1];
  19840. }
  19841. /**
  19842. * Checks if a list cache value for `key` exists.
  19843. *
  19844. * @private
  19845. * @name has
  19846. * @memberOf ListCache
  19847. * @param {string} key The key of the entry to check.
  19848. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19849. */
  19850. function listCacheHas(key) {
  19851. return assocIndexOf(this.__data__, key) > -1;
  19852. }
  19853. /**
  19854. * Sets the list cache `key` to `value`.
  19855. *
  19856. * @private
  19857. * @name set
  19858. * @memberOf ListCache
  19859. * @param {string} key The key of the value to set.
  19860. * @param {*} value The value to set.
  19861. * @returns {Object} Returns the list cache instance.
  19862. */
  19863. function listCacheSet(key, value) {
  19864. var data = this.__data__,
  19865. index = assocIndexOf(data, key);
  19866. if (index < 0) {
  19867. ++this.size;
  19868. data.push([key, value]);
  19869. } else {
  19870. data[index][1] = value;
  19871. }
  19872. return this;
  19873. }
  19874. // Add methods to `ListCache`.
  19875. ListCache.prototype.clear = listCacheClear;
  19876. ListCache.prototype['delete'] = listCacheDelete;
  19877. ListCache.prototype.get = listCacheGet;
  19878. ListCache.prototype.has = listCacheHas;
  19879. ListCache.prototype.set = listCacheSet;
  19880. /*------------------------------------------------------------------------*/
  19881. /**
  19882. * Creates a map cache object to store key-value pairs.
  19883. *
  19884. * @private
  19885. * @constructor
  19886. * @param {Array} [entries] The key-value pairs to cache.
  19887. */
  19888. function MapCache(entries) {
  19889. var index = -1,
  19890. length = entries == null ? 0 : entries.length;
  19891. this.clear();
  19892. while (++index < length) {
  19893. var entry = entries[index];
  19894. this.set(entry[0], entry[1]);
  19895. }
  19896. }
  19897. /**
  19898. * Removes all key-value entries from the map.
  19899. *
  19900. * @private
  19901. * @name clear
  19902. * @memberOf MapCache
  19903. */
  19904. function mapCacheClear() {
  19905. this.size = 0;
  19906. this.__data__ = {
  19907. 'hash': new Hash,
  19908. 'map': new (Map || ListCache),
  19909. 'string': new Hash
  19910. };
  19911. }
  19912. /**
  19913. * Removes `key` and its value from the map.
  19914. *
  19915. * @private
  19916. * @name delete
  19917. * @memberOf MapCache
  19918. * @param {string} key The key of the value to remove.
  19919. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19920. */
  19921. function mapCacheDelete(key) {
  19922. var result = getMapData(this, key)['delete'](key);
  19923. this.size -= result ? 1 : 0;
  19924. return result;
  19925. }
  19926. /**
  19927. * Gets the map value for `key`.
  19928. *
  19929. * @private
  19930. * @name get
  19931. * @memberOf MapCache
  19932. * @param {string} key The key of the value to get.
  19933. * @returns {*} Returns the entry value.
  19934. */
  19935. function mapCacheGet(key) {
  19936. return getMapData(this, key).get(key);
  19937. }
  19938. /**
  19939. * Checks if a map value for `key` exists.
  19940. *
  19941. * @private
  19942. * @name has
  19943. * @memberOf MapCache
  19944. * @param {string} key The key of the entry to check.
  19945. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19946. */
  19947. function mapCacheHas(key) {
  19948. return getMapData(this, key).has(key);
  19949. }
  19950. /**
  19951. * Sets the map `key` to `value`.
  19952. *
  19953. * @private
  19954. * @name set
  19955. * @memberOf MapCache
  19956. * @param {string} key The key of the value to set.
  19957. * @param {*} value The value to set.
  19958. * @returns {Object} Returns the map cache instance.
  19959. */
  19960. function mapCacheSet(key, value) {
  19961. var data = getMapData(this, key),
  19962. size = data.size;
  19963. data.set(key, value);
  19964. this.size += data.size == size ? 0 : 1;
  19965. return this;
  19966. }
  19967. // Add methods to `MapCache`.
  19968. MapCache.prototype.clear = mapCacheClear;
  19969. MapCache.prototype['delete'] = mapCacheDelete;
  19970. MapCache.prototype.get = mapCacheGet;
  19971. MapCache.prototype.has = mapCacheHas;
  19972. MapCache.prototype.set = mapCacheSet;
  19973. /*------------------------------------------------------------------------*/
  19974. /**
  19975. *
  19976. * Creates an array cache object to store unique values.
  19977. *
  19978. * @private
  19979. * @constructor
  19980. * @param {Array} [values] The values to cache.
  19981. */
  19982. function SetCache(values) {
  19983. var index = -1,
  19984. length = values == null ? 0 : values.length;
  19985. this.__data__ = new MapCache;
  19986. while (++index < length) {
  19987. this.add(values[index]);
  19988. }
  19989. }
  19990. /**
  19991. * Adds `value` to the array cache.
  19992. *
  19993. * @private
  19994. * @name add
  19995. * @memberOf SetCache
  19996. * @alias push
  19997. * @param {*} value The value to cache.
  19998. * @returns {Object} Returns the cache instance.
  19999. */
  20000. function setCacheAdd(value) {
  20001. this.__data__.set(value, HASH_UNDEFINED);
  20002. return this;
  20003. }
  20004. /**
  20005. * Checks if `value` is in the array cache.
  20006. *
  20007. * @private
  20008. * @name has
  20009. * @memberOf SetCache
  20010. * @param {*} value The value to search for.
  20011. * @returns {number} Returns `true` if `value` is found, else `false`.
  20012. */
  20013. function setCacheHas(value) {
  20014. return this.__data__.has(value);
  20015. }
  20016. // Add methods to `SetCache`.
  20017. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20018. SetCache.prototype.has = setCacheHas;
  20019. /*------------------------------------------------------------------------*/
  20020. /**
  20021. * Creates a stack cache object to store key-value pairs.
  20022. *
  20023. * @private
  20024. * @constructor
  20025. * @param {Array} [entries] The key-value pairs to cache.
  20026. */
  20027. function Stack(entries) {
  20028. var data = this.__data__ = new ListCache(entries);
  20029. this.size = data.size;
  20030. }
  20031. /**
  20032. * Removes all key-value entries from the stack.
  20033. *
  20034. * @private
  20035. * @name clear
  20036. * @memberOf Stack
  20037. */
  20038. function stackClear() {
  20039. this.__data__ = new ListCache;
  20040. this.size = 0;
  20041. }
  20042. /**
  20043. * Removes `key` and its value from the stack.
  20044. *
  20045. * @private
  20046. * @name delete
  20047. * @memberOf Stack
  20048. * @param {string} key The key of the value to remove.
  20049. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20050. */
  20051. function stackDelete(key) {
  20052. var data = this.__data__,
  20053. result = data['delete'](key);
  20054. this.size = data.size;
  20055. return result;
  20056. }
  20057. /**
  20058. * Gets the stack value for `key`.
  20059. *
  20060. * @private
  20061. * @name get
  20062. * @memberOf Stack
  20063. * @param {string} key The key of the value to get.
  20064. * @returns {*} Returns the entry value.
  20065. */
  20066. function stackGet(key) {
  20067. return this.__data__.get(key);
  20068. }
  20069. /**
  20070. * Checks if a stack value for `key` exists.
  20071. *
  20072. * @private
  20073. * @name has
  20074. * @memberOf Stack
  20075. * @param {string} key The key of the entry to check.
  20076. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20077. */
  20078. function stackHas(key) {
  20079. return this.__data__.has(key);
  20080. }
  20081. /**
  20082. * Sets the stack `key` to `value`.
  20083. *
  20084. * @private
  20085. * @name set
  20086. * @memberOf Stack
  20087. * @param {string} key The key of the value to set.
  20088. * @param {*} value The value to set.
  20089. * @returns {Object} Returns the stack cache instance.
  20090. */
  20091. function stackSet(key, value) {
  20092. var data = this.__data__;
  20093. if (data instanceof ListCache) {
  20094. var pairs = data.__data__;
  20095. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20096. pairs.push([key, value]);
  20097. this.size = ++data.size;
  20098. return this;
  20099. }
  20100. data = this.__data__ = new MapCache(pairs);
  20101. }
  20102. data.set(key, value);
  20103. this.size = data.size;
  20104. return this;
  20105. }
  20106. // Add methods to `Stack`.
  20107. Stack.prototype.clear = stackClear;
  20108. Stack.prototype['delete'] = stackDelete;
  20109. Stack.prototype.get = stackGet;
  20110. Stack.prototype.has = stackHas;
  20111. Stack.prototype.set = stackSet;
  20112. /*------------------------------------------------------------------------*/
  20113. /**
  20114. * Creates an array of the enumerable property names of the array-like `value`.
  20115. *
  20116. * @private
  20117. * @param {*} value The value to query.
  20118. * @param {boolean} inherited Specify returning inherited property names.
  20119. * @returns {Array} Returns the array of property names.
  20120. */
  20121. function arrayLikeKeys(value, inherited) {
  20122. var isArr = isArray(value),
  20123. isArg = !isArr && isArguments(value),
  20124. isBuff = !isArr && !isArg && isBuffer(value),
  20125. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20126. skipIndexes = isArr || isArg || isBuff || isType,
  20127. result = skipIndexes ? baseTimes(value.length, String) : [],
  20128. length = result.length;
  20129. for (var key in value) {
  20130. if ((inherited || hasOwnProperty.call(value, key)) &&
  20131. !(skipIndexes && (
  20132. // Safari 9 has enumerable `arguments.length` in strict mode.
  20133. key == 'length' ||
  20134. // Node.js 0.10 has enumerable non-index properties on buffers.
  20135. (isBuff && (key == 'offset' || key == 'parent')) ||
  20136. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20137. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20138. // Skip index properties.
  20139. isIndex(key, length)
  20140. ))) {
  20141. result.push(key);
  20142. }
  20143. }
  20144. return result;
  20145. }
  20146. /**
  20147. * A specialized version of `_.sample` for arrays.
  20148. *
  20149. * @private
  20150. * @param {Array} array The array to sample.
  20151. * @returns {*} Returns the random element.
  20152. */
  20153. function arraySample(array) {
  20154. var length = array.length;
  20155. return length ? array[baseRandom(0, length - 1)] : undefined;
  20156. }
  20157. /**
  20158. * A specialized version of `_.sampleSize` for arrays.
  20159. *
  20160. * @private
  20161. * @param {Array} array The array to sample.
  20162. * @param {number} n The number of elements to sample.
  20163. * @returns {Array} Returns the random elements.
  20164. */
  20165. function arraySampleSize(array, n) {
  20166. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20167. }
  20168. /**
  20169. * A specialized version of `_.shuffle` for arrays.
  20170. *
  20171. * @private
  20172. * @param {Array} array The array to shuffle.
  20173. * @returns {Array} Returns the new shuffled array.
  20174. */
  20175. function arrayShuffle(array) {
  20176. return shuffleSelf(copyArray(array));
  20177. }
  20178. /**
  20179. * This function is like `assignValue` except that it doesn't assign
  20180. * `undefined` values.
  20181. *
  20182. * @private
  20183. * @param {Object} object The object to modify.
  20184. * @param {string} key The key of the property to assign.
  20185. * @param {*} value The value to assign.
  20186. */
  20187. function assignMergeValue(object, key, value) {
  20188. if ((value !== undefined && !eq(object[key], value)) ||
  20189. (value === undefined && !(key in object))) {
  20190. baseAssignValue(object, key, value);
  20191. }
  20192. }
  20193. /**
  20194. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20195. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20196. * for equality comparisons.
  20197. *
  20198. * @private
  20199. * @param {Object} object The object to modify.
  20200. * @param {string} key The key of the property to assign.
  20201. * @param {*} value The value to assign.
  20202. */
  20203. function assignValue(object, key, value) {
  20204. var objValue = object[key];
  20205. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20206. (value === undefined && !(key in object))) {
  20207. baseAssignValue(object, key, value);
  20208. }
  20209. }
  20210. /**
  20211. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20212. *
  20213. * @private
  20214. * @param {Array} array The array to inspect.
  20215. * @param {*} key The key to search for.
  20216. * @returns {number} Returns the index of the matched value, else `-1`.
  20217. */
  20218. function assocIndexOf(array, key) {
  20219. var length = array.length;
  20220. while (length--) {
  20221. if (eq(array[length][0], key)) {
  20222. return length;
  20223. }
  20224. }
  20225. return -1;
  20226. }
  20227. /**
  20228. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20229. * by `iteratee` and values set by `setter`.
  20230. *
  20231. * @private
  20232. * @param {Array|Object} collection The collection to iterate over.
  20233. * @param {Function} setter The function to set `accumulator` values.
  20234. * @param {Function} iteratee The iteratee to transform keys.
  20235. * @param {Object} accumulator The initial aggregated object.
  20236. * @returns {Function} Returns `accumulator`.
  20237. */
  20238. function baseAggregator(collection, setter, iteratee, accumulator) {
  20239. baseEach(collection, function(value, key, collection) {
  20240. setter(accumulator, value, iteratee(value), collection);
  20241. });
  20242. return accumulator;
  20243. }
  20244. /**
  20245. * The base implementation of `_.assign` without support for multiple sources
  20246. * or `customizer` functions.
  20247. *
  20248. * @private
  20249. * @param {Object} object The destination object.
  20250. * @param {Object} source The source object.
  20251. * @returns {Object} Returns `object`.
  20252. */
  20253. function baseAssign(object, source) {
  20254. return object && copyObject(source, keys(source), object);
  20255. }
  20256. /**
  20257. * The base implementation of `_.assignIn` without support for multiple sources
  20258. * or `customizer` functions.
  20259. *
  20260. * @private
  20261. * @param {Object} object The destination object.
  20262. * @param {Object} source The source object.
  20263. * @returns {Object} Returns `object`.
  20264. */
  20265. function baseAssignIn(object, source) {
  20266. return object && copyObject(source, keysIn(source), object);
  20267. }
  20268. /**
  20269. * The base implementation of `assignValue` and `assignMergeValue` without
  20270. * value checks.
  20271. *
  20272. * @private
  20273. * @param {Object} object The object to modify.
  20274. * @param {string} key The key of the property to assign.
  20275. * @param {*} value The value to assign.
  20276. */
  20277. function baseAssignValue(object, key, value) {
  20278. if (key == '__proto__' && defineProperty) {
  20279. defineProperty(object, key, {
  20280. 'configurable': true,
  20281. 'enumerable': true,
  20282. 'value': value,
  20283. 'writable': true
  20284. });
  20285. } else {
  20286. object[key] = value;
  20287. }
  20288. }
  20289. /**
  20290. * The base implementation of `_.at` without support for individual paths.
  20291. *
  20292. * @private
  20293. * @param {Object} object The object to iterate over.
  20294. * @param {string[]} paths The property paths to pick.
  20295. * @returns {Array} Returns the picked elements.
  20296. */
  20297. function baseAt(object, paths) {
  20298. var index = -1,
  20299. length = paths.length,
  20300. result = Array(length),
  20301. skip = object == null;
  20302. while (++index < length) {
  20303. result[index] = skip ? undefined : get(object, paths[index]);
  20304. }
  20305. return result;
  20306. }
  20307. /**
  20308. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20309. *
  20310. * @private
  20311. * @param {number} number The number to clamp.
  20312. * @param {number} [lower] The lower bound.
  20313. * @param {number} upper The upper bound.
  20314. * @returns {number} Returns the clamped number.
  20315. */
  20316. function baseClamp(number, lower, upper) {
  20317. if (number === number) {
  20318. if (upper !== undefined) {
  20319. number = number <= upper ? number : upper;
  20320. }
  20321. if (lower !== undefined) {
  20322. number = number >= lower ? number : lower;
  20323. }
  20324. }
  20325. return number;
  20326. }
  20327. /**
  20328. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20329. * traversed objects.
  20330. *
  20331. * @private
  20332. * @param {*} value The value to clone.
  20333. * @param {boolean} bitmask The bitmask flags.
  20334. * 1 - Deep clone
  20335. * 2 - Flatten inherited properties
  20336. * 4 - Clone symbols
  20337. * @param {Function} [customizer] The function to customize cloning.
  20338. * @param {string} [key] The key of `value`.
  20339. * @param {Object} [object] The parent object of `value`.
  20340. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20341. * @returns {*} Returns the cloned value.
  20342. */
  20343. function baseClone(value, bitmask, customizer, key, object, stack) {
  20344. var result,
  20345. isDeep = bitmask & CLONE_DEEP_FLAG,
  20346. isFlat = bitmask & CLONE_FLAT_FLAG,
  20347. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20348. if (customizer) {
  20349. result = object ? customizer(value, key, object, stack) : customizer(value);
  20350. }
  20351. if (result !== undefined) {
  20352. return result;
  20353. }
  20354. if (!isObject(value)) {
  20355. return value;
  20356. }
  20357. var isArr = isArray(value);
  20358. if (isArr) {
  20359. result = initCloneArray(value);
  20360. if (!isDeep) {
  20361. return copyArray(value, result);
  20362. }
  20363. } else {
  20364. var tag = getTag(value),
  20365. isFunc = tag == funcTag || tag == genTag;
  20366. if (isBuffer(value)) {
  20367. return cloneBuffer(value, isDeep);
  20368. }
  20369. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20370. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20371. if (!isDeep) {
  20372. return isFlat
  20373. ? copySymbolsIn(value, baseAssignIn(result, value))
  20374. : copySymbols(value, baseAssign(result, value));
  20375. }
  20376. } else {
  20377. if (!cloneableTags[tag]) {
  20378. return object ? value : {};
  20379. }
  20380. result = initCloneByTag(value, tag, isDeep);
  20381. }
  20382. }
  20383. // Check for circular references and return its corresponding clone.
  20384. stack || (stack = new Stack);
  20385. var stacked = stack.get(value);
  20386. if (stacked) {
  20387. return stacked;
  20388. }
  20389. stack.set(value, result);
  20390. if (isSet(value)) {
  20391. value.forEach(function(subValue) {
  20392. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20393. });
  20394. } else if (isMap(value)) {
  20395. value.forEach(function(subValue, key) {
  20396. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20397. });
  20398. }
  20399. var keysFunc = isFull
  20400. ? (isFlat ? getAllKeysIn : getAllKeys)
  20401. : (isFlat ? keysIn : keys);
  20402. var props = isArr ? undefined : keysFunc(value);
  20403. arrayEach(props || value, function(subValue, key) {
  20404. if (props) {
  20405. key = subValue;
  20406. subValue = value[key];
  20407. }
  20408. // Recursively populate clone (susceptible to call stack limits).
  20409. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20410. });
  20411. return result;
  20412. }
  20413. /**
  20414. * The base implementation of `_.conforms` which doesn't clone `source`.
  20415. *
  20416. * @private
  20417. * @param {Object} source The object of property predicates to conform to.
  20418. * @returns {Function} Returns the new spec function.
  20419. */
  20420. function baseConforms(source) {
  20421. var props = keys(source);
  20422. return function(object) {
  20423. return baseConformsTo(object, source, props);
  20424. };
  20425. }
  20426. /**
  20427. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20428. *
  20429. * @private
  20430. * @param {Object} object The object to inspect.
  20431. * @param {Object} source The object of property predicates to conform to.
  20432. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20433. */
  20434. function baseConformsTo(object, source, props) {
  20435. var length = props.length;
  20436. if (object == null) {
  20437. return !length;
  20438. }
  20439. object = Object(object);
  20440. while (length--) {
  20441. var key = props[length],
  20442. predicate = source[key],
  20443. value = object[key];
  20444. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20445. return false;
  20446. }
  20447. }
  20448. return true;
  20449. }
  20450. /**
  20451. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20452. * to provide to `func`.
  20453. *
  20454. * @private
  20455. * @param {Function} func The function to delay.
  20456. * @param {number} wait The number of milliseconds to delay invocation.
  20457. * @param {Array} args The arguments to provide to `func`.
  20458. * @returns {number|Object} Returns the timer id or timeout object.
  20459. */
  20460. function baseDelay(func, wait, args) {
  20461. if (typeof func != 'function') {
  20462. throw new TypeError(FUNC_ERROR_TEXT);
  20463. }
  20464. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20465. }
  20466. /**
  20467. * The base implementation of methods like `_.difference` without support
  20468. * for excluding multiple arrays or iteratee shorthands.
  20469. *
  20470. * @private
  20471. * @param {Array} array The array to inspect.
  20472. * @param {Array} values The values to exclude.
  20473. * @param {Function} [iteratee] The iteratee invoked per element.
  20474. * @param {Function} [comparator] The comparator invoked per element.
  20475. * @returns {Array} Returns the new array of filtered values.
  20476. */
  20477. function baseDifference(array, values, iteratee, comparator) {
  20478. var index = -1,
  20479. includes = arrayIncludes,
  20480. isCommon = true,
  20481. length = array.length,
  20482. result = [],
  20483. valuesLength = values.length;
  20484. if (!length) {
  20485. return result;
  20486. }
  20487. if (iteratee) {
  20488. values = arrayMap(values, baseUnary(iteratee));
  20489. }
  20490. if (comparator) {
  20491. includes = arrayIncludesWith;
  20492. isCommon = false;
  20493. }
  20494. else if (values.length >= LARGE_ARRAY_SIZE) {
  20495. includes = cacheHas;
  20496. isCommon = false;
  20497. values = new SetCache(values);
  20498. }
  20499. outer:
  20500. while (++index < length) {
  20501. var value = array[index],
  20502. computed = iteratee == null ? value : iteratee(value);
  20503. value = (comparator || value !== 0) ? value : 0;
  20504. if (isCommon && computed === computed) {
  20505. var valuesIndex = valuesLength;
  20506. while (valuesIndex--) {
  20507. if (values[valuesIndex] === computed) {
  20508. continue outer;
  20509. }
  20510. }
  20511. result.push(value);
  20512. }
  20513. else if (!includes(values, computed, comparator)) {
  20514. result.push(value);
  20515. }
  20516. }
  20517. return result;
  20518. }
  20519. /**
  20520. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20521. *
  20522. * @private
  20523. * @param {Array|Object} collection The collection to iterate over.
  20524. * @param {Function} iteratee The function invoked per iteration.
  20525. * @returns {Array|Object} Returns `collection`.
  20526. */
  20527. var baseEach = createBaseEach(baseForOwn);
  20528. /**
  20529. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20530. *
  20531. * @private
  20532. * @param {Array|Object} collection The collection to iterate over.
  20533. * @param {Function} iteratee The function invoked per iteration.
  20534. * @returns {Array|Object} Returns `collection`.
  20535. */
  20536. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20537. /**
  20538. * The base implementation of `_.every` without support for iteratee shorthands.
  20539. *
  20540. * @private
  20541. * @param {Array|Object} collection The collection to iterate over.
  20542. * @param {Function} predicate The function invoked per iteration.
  20543. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20544. * else `false`
  20545. */
  20546. function baseEvery(collection, predicate) {
  20547. var result = true;
  20548. baseEach(collection, function(value, index, collection) {
  20549. result = !!predicate(value, index, collection);
  20550. return result;
  20551. });
  20552. return result;
  20553. }
  20554. /**
  20555. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20556. * `comparator` to determine the extremum value.
  20557. *
  20558. * @private
  20559. * @param {Array} array The array to iterate over.
  20560. * @param {Function} iteratee The iteratee invoked per iteration.
  20561. * @param {Function} comparator The comparator used to compare values.
  20562. * @returns {*} Returns the extremum value.
  20563. */
  20564. function baseExtremum(array, iteratee, comparator) {
  20565. var index = -1,
  20566. length = array.length;
  20567. while (++index < length) {
  20568. var value = array[index],
  20569. current = iteratee(value);
  20570. if (current != null && (computed === undefined
  20571. ? (current === current && !isSymbol(current))
  20572. : comparator(current, computed)
  20573. )) {
  20574. var computed = current,
  20575. result = value;
  20576. }
  20577. }
  20578. return result;
  20579. }
  20580. /**
  20581. * The base implementation of `_.fill` without an iteratee call guard.
  20582. *
  20583. * @private
  20584. * @param {Array} array The array to fill.
  20585. * @param {*} value The value to fill `array` with.
  20586. * @param {number} [start=0] The start position.
  20587. * @param {number} [end=array.length] The end position.
  20588. * @returns {Array} Returns `array`.
  20589. */
  20590. function baseFill(array, value, start, end) {
  20591. var length = array.length;
  20592. start = toInteger(start);
  20593. if (start < 0) {
  20594. start = -start > length ? 0 : (length + start);
  20595. }
  20596. end = (end === undefined || end > length) ? length : toInteger(end);
  20597. if (end < 0) {
  20598. end += length;
  20599. }
  20600. end = start > end ? 0 : toLength(end);
  20601. while (start < end) {
  20602. array[start++] = value;
  20603. }
  20604. return array;
  20605. }
  20606. /**
  20607. * The base implementation of `_.filter` without support for iteratee shorthands.
  20608. *
  20609. * @private
  20610. * @param {Array|Object} collection The collection to iterate over.
  20611. * @param {Function} predicate The function invoked per iteration.
  20612. * @returns {Array} Returns the new filtered array.
  20613. */
  20614. function baseFilter(collection, predicate) {
  20615. var result = [];
  20616. baseEach(collection, function(value, index, collection) {
  20617. if (predicate(value, index, collection)) {
  20618. result.push(value);
  20619. }
  20620. });
  20621. return result;
  20622. }
  20623. /**
  20624. * The base implementation of `_.flatten` with support for restricting flattening.
  20625. *
  20626. * @private
  20627. * @param {Array} array The array to flatten.
  20628. * @param {number} depth The maximum recursion depth.
  20629. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20630. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20631. * @param {Array} [result=[]] The initial result value.
  20632. * @returns {Array} Returns the new flattened array.
  20633. */
  20634. function baseFlatten(array, depth, predicate, isStrict, result) {
  20635. var index = -1,
  20636. length = array.length;
  20637. predicate || (predicate = isFlattenable);
  20638. result || (result = []);
  20639. while (++index < length) {
  20640. var value = array[index];
  20641. if (depth > 0 && predicate(value)) {
  20642. if (depth > 1) {
  20643. // Recursively flatten arrays (susceptible to call stack limits).
  20644. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20645. } else {
  20646. arrayPush(result, value);
  20647. }
  20648. } else if (!isStrict) {
  20649. result[result.length] = value;
  20650. }
  20651. }
  20652. return result;
  20653. }
  20654. /**
  20655. * The base implementation of `baseForOwn` which iterates over `object`
  20656. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20657. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20658. *
  20659. * @private
  20660. * @param {Object} object The object to iterate over.
  20661. * @param {Function} iteratee The function invoked per iteration.
  20662. * @param {Function} keysFunc The function to get the keys of `object`.
  20663. * @returns {Object} Returns `object`.
  20664. */
  20665. var baseFor = createBaseFor();
  20666. /**
  20667. * This function is like `baseFor` except that it iterates over properties
  20668. * in the opposite order.
  20669. *
  20670. * @private
  20671. * @param {Object} object The object to iterate over.
  20672. * @param {Function} iteratee The function invoked per iteration.
  20673. * @param {Function} keysFunc The function to get the keys of `object`.
  20674. * @returns {Object} Returns `object`.
  20675. */
  20676. var baseForRight = createBaseFor(true);
  20677. /**
  20678. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20679. *
  20680. * @private
  20681. * @param {Object} object The object to iterate over.
  20682. * @param {Function} iteratee The function invoked per iteration.
  20683. * @returns {Object} Returns `object`.
  20684. */
  20685. function baseForOwn(object, iteratee) {
  20686. return object && baseFor(object, iteratee, keys);
  20687. }
  20688. /**
  20689. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20690. *
  20691. * @private
  20692. * @param {Object} object The object to iterate over.
  20693. * @param {Function} iteratee The function invoked per iteration.
  20694. * @returns {Object} Returns `object`.
  20695. */
  20696. function baseForOwnRight(object, iteratee) {
  20697. return object && baseForRight(object, iteratee, keys);
  20698. }
  20699. /**
  20700. * The base implementation of `_.functions` which creates an array of
  20701. * `object` function property names filtered from `props`.
  20702. *
  20703. * @private
  20704. * @param {Object} object The object to inspect.
  20705. * @param {Array} props The property names to filter.
  20706. * @returns {Array} Returns the function names.
  20707. */
  20708. function baseFunctions(object, props) {
  20709. return arrayFilter(props, function(key) {
  20710. return isFunction(object[key]);
  20711. });
  20712. }
  20713. /**
  20714. * The base implementation of `_.get` without support for default values.
  20715. *
  20716. * @private
  20717. * @param {Object} object The object to query.
  20718. * @param {Array|string} path The path of the property to get.
  20719. * @returns {*} Returns the resolved value.
  20720. */
  20721. function baseGet(object, path) {
  20722. path = castPath(path, object);
  20723. var index = 0,
  20724. length = path.length;
  20725. while (object != null && index < length) {
  20726. object = object[toKey(path[index++])];
  20727. }
  20728. return (index && index == length) ? object : undefined;
  20729. }
  20730. /**
  20731. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  20732. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  20733. * symbols of `object`.
  20734. *
  20735. * @private
  20736. * @param {Object} object The object to query.
  20737. * @param {Function} keysFunc The function to get the keys of `object`.
  20738. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  20739. * @returns {Array} Returns the array of property names and symbols.
  20740. */
  20741. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  20742. var result = keysFunc(object);
  20743. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  20744. }
  20745. /**
  20746. * The base implementation of `getTag` without fallbacks for buggy environments.
  20747. *
  20748. * @private
  20749. * @param {*} value The value to query.
  20750. * @returns {string} Returns the `toStringTag`.
  20751. */
  20752. function baseGetTag(value) {
  20753. if (value == null) {
  20754. return value === undefined ? undefinedTag : nullTag;
  20755. }
  20756. return (symToStringTag && symToStringTag in Object(value))
  20757. ? getRawTag(value)
  20758. : objectToString(value);
  20759. }
  20760. /**
  20761. * The base implementation of `_.gt` which doesn't coerce arguments.
  20762. *
  20763. * @private
  20764. * @param {*} value The value to compare.
  20765. * @param {*} other The other value to compare.
  20766. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  20767. * else `false`.
  20768. */
  20769. function baseGt(value, other) {
  20770. return value > other;
  20771. }
  20772. /**
  20773. * The base implementation of `_.has` without support for deep paths.
  20774. *
  20775. * @private
  20776. * @param {Object} [object] The object to query.
  20777. * @param {Array|string} key The key to check.
  20778. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20779. */
  20780. function baseHas(object, key) {
  20781. return object != null && hasOwnProperty.call(object, key);
  20782. }
  20783. /**
  20784. * The base implementation of `_.hasIn` without support for deep paths.
  20785. *
  20786. * @private
  20787. * @param {Object} [object] The object to query.
  20788. * @param {Array|string} key The key to check.
  20789. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20790. */
  20791. function baseHasIn(object, key) {
  20792. return object != null && key in Object(object);
  20793. }
  20794. /**
  20795. * The base implementation of `_.inRange` which doesn't coerce arguments.
  20796. *
  20797. * @private
  20798. * @param {number} number The number to check.
  20799. * @param {number} start The start of the range.
  20800. * @param {number} end The end of the range.
  20801. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  20802. */
  20803. function baseInRange(number, start, end) {
  20804. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  20805. }
  20806. /**
  20807. * The base implementation of methods like `_.intersection`, without support
  20808. * for iteratee shorthands, that accepts an array of arrays to inspect.
  20809. *
  20810. * @private
  20811. * @param {Array} arrays The arrays to inspect.
  20812. * @param {Function} [iteratee] The iteratee invoked per element.
  20813. * @param {Function} [comparator] The comparator invoked per element.
  20814. * @returns {Array} Returns the new array of shared values.
  20815. */
  20816. function baseIntersection(arrays, iteratee, comparator) {
  20817. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  20818. length = arrays[0].length,
  20819. othLength = arrays.length,
  20820. othIndex = othLength,
  20821. caches = Array(othLength),
  20822. maxLength = Infinity,
  20823. result = [];
  20824. while (othIndex--) {
  20825. var array = arrays[othIndex];
  20826. if (othIndex && iteratee) {
  20827. array = arrayMap(array, baseUnary(iteratee));
  20828. }
  20829. maxLength = nativeMin(array.length, maxLength);
  20830. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  20831. ? new SetCache(othIndex && array)
  20832. : undefined;
  20833. }
  20834. array = arrays[0];
  20835. var index = -1,
  20836. seen = caches[0];
  20837. outer:
  20838. while (++index < length && result.length < maxLength) {
  20839. var value = array[index],
  20840. computed = iteratee ? iteratee(value) : value;
  20841. value = (comparator || value !== 0) ? value : 0;
  20842. if (!(seen
  20843. ? cacheHas(seen, computed)
  20844. : includes(result, computed, comparator)
  20845. )) {
  20846. othIndex = othLength;
  20847. while (--othIndex) {
  20848. var cache = caches[othIndex];
  20849. if (!(cache
  20850. ? cacheHas(cache, computed)
  20851. : includes(arrays[othIndex], computed, comparator))
  20852. ) {
  20853. continue outer;
  20854. }
  20855. }
  20856. if (seen) {
  20857. seen.push(computed);
  20858. }
  20859. result.push(value);
  20860. }
  20861. }
  20862. return result;
  20863. }
  20864. /**
  20865. * The base implementation of `_.invert` and `_.invertBy` which inverts
  20866. * `object` with values transformed by `iteratee` and set by `setter`.
  20867. *
  20868. * @private
  20869. * @param {Object} object The object to iterate over.
  20870. * @param {Function} setter The function to set `accumulator` values.
  20871. * @param {Function} iteratee The iteratee to transform values.
  20872. * @param {Object} accumulator The initial inverted object.
  20873. * @returns {Function} Returns `accumulator`.
  20874. */
  20875. function baseInverter(object, setter, iteratee, accumulator) {
  20876. baseForOwn(object, function(value, key, object) {
  20877. setter(accumulator, iteratee(value), key, object);
  20878. });
  20879. return accumulator;
  20880. }
  20881. /**
  20882. * The base implementation of `_.invoke` without support for individual
  20883. * method arguments.
  20884. *
  20885. * @private
  20886. * @param {Object} object The object to query.
  20887. * @param {Array|string} path The path of the method to invoke.
  20888. * @param {Array} args The arguments to invoke the method with.
  20889. * @returns {*} Returns the result of the invoked method.
  20890. */
  20891. function baseInvoke(object, path, args) {
  20892. path = castPath(path, object);
  20893. object = parent(object, path);
  20894. var func = object == null ? object : object[toKey(last(path))];
  20895. return func == null ? undefined : apply(func, object, args);
  20896. }
  20897. /**
  20898. * The base implementation of `_.isArguments`.
  20899. *
  20900. * @private
  20901. * @param {*} value The value to check.
  20902. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  20903. */
  20904. function baseIsArguments(value) {
  20905. return isObjectLike(value) && baseGetTag(value) == argsTag;
  20906. }
  20907. /**
  20908. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  20909. *
  20910. * @private
  20911. * @param {*} value The value to check.
  20912. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  20913. */
  20914. function baseIsArrayBuffer(value) {
  20915. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  20916. }
  20917. /**
  20918. * The base implementation of `_.isDate` without Node.js optimizations.
  20919. *
  20920. * @private
  20921. * @param {*} value The value to check.
  20922. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  20923. */
  20924. function baseIsDate(value) {
  20925. return isObjectLike(value) && baseGetTag(value) == dateTag;
  20926. }
  20927. /**
  20928. * The base implementation of `_.isEqual` which supports partial comparisons
  20929. * and tracks traversed objects.
  20930. *
  20931. * @private
  20932. * @param {*} value The value to compare.
  20933. * @param {*} other The other value to compare.
  20934. * @param {boolean} bitmask The bitmask flags.
  20935. * 1 - Unordered comparison
  20936. * 2 - Partial comparison
  20937. * @param {Function} [customizer] The function to customize comparisons.
  20938. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  20939. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  20940. */
  20941. function baseIsEqual(value, other, bitmask, customizer, stack) {
  20942. if (value === other) {
  20943. return true;
  20944. }
  20945. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  20946. return value !== value && other !== other;
  20947. }
  20948. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  20949. }
  20950. /**
  20951. * A specialized version of `baseIsEqual` for arrays and objects which performs
  20952. * deep comparisons and tracks traversed objects enabling objects with circular
  20953. * references to be compared.
  20954. *
  20955. * @private
  20956. * @param {Object} object The object to compare.
  20957. * @param {Object} other The other object to compare.
  20958. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  20959. * @param {Function} customizer The function to customize comparisons.
  20960. * @param {Function} equalFunc The function to determine equivalents of values.
  20961. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  20962. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  20963. */
  20964. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  20965. var objIsArr = isArray(object),
  20966. othIsArr = isArray(other),
  20967. objTag = objIsArr ? arrayTag : getTag(object),
  20968. othTag = othIsArr ? arrayTag : getTag(other);
  20969. objTag = objTag == argsTag ? objectTag : objTag;
  20970. othTag = othTag == argsTag ? objectTag : othTag;
  20971. var objIsObj = objTag == objectTag,
  20972. othIsObj = othTag == objectTag,
  20973. isSameTag = objTag == othTag;
  20974. if (isSameTag && isBuffer(object)) {
  20975. if (!isBuffer(other)) {
  20976. return false;
  20977. }
  20978. objIsArr = true;
  20979. objIsObj = false;
  20980. }
  20981. if (isSameTag && !objIsObj) {
  20982. stack || (stack = new Stack);
  20983. return (objIsArr || isTypedArray(object))
  20984. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  20985. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  20986. }
  20987. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  20988. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  20989. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  20990. if (objIsWrapped || othIsWrapped) {
  20991. var objUnwrapped = objIsWrapped ? object.value() : object,
  20992. othUnwrapped = othIsWrapped ? other.value() : other;
  20993. stack || (stack = new Stack);
  20994. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  20995. }
  20996. }
  20997. if (!isSameTag) {
  20998. return false;
  20999. }
  21000. stack || (stack = new Stack);
  21001. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21002. }
  21003. /**
  21004. * The base implementation of `_.isMap` without Node.js optimizations.
  21005. *
  21006. * @private
  21007. * @param {*} value The value to check.
  21008. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21009. */
  21010. function baseIsMap(value) {
  21011. return isObjectLike(value) && getTag(value) == mapTag;
  21012. }
  21013. /**
  21014. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21015. *
  21016. * @private
  21017. * @param {Object} object The object to inspect.
  21018. * @param {Object} source The object of property values to match.
  21019. * @param {Array} matchData The property names, values, and compare flags to match.
  21020. * @param {Function} [customizer] The function to customize comparisons.
  21021. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21022. */
  21023. function baseIsMatch(object, source, matchData, customizer) {
  21024. var index = matchData.length,
  21025. length = index,
  21026. noCustomizer = !customizer;
  21027. if (object == null) {
  21028. return !length;
  21029. }
  21030. object = Object(object);
  21031. while (index--) {
  21032. var data = matchData[index];
  21033. if ((noCustomizer && data[2])
  21034. ? data[1] !== object[data[0]]
  21035. : !(data[0] in object)
  21036. ) {
  21037. return false;
  21038. }
  21039. }
  21040. while (++index < length) {
  21041. data = matchData[index];
  21042. var key = data[0],
  21043. objValue = object[key],
  21044. srcValue = data[1];
  21045. if (noCustomizer && data[2]) {
  21046. if (objValue === undefined && !(key in object)) {
  21047. return false;
  21048. }
  21049. } else {
  21050. var stack = new Stack;
  21051. if (customizer) {
  21052. var result = customizer(objValue, srcValue, key, object, source, stack);
  21053. }
  21054. if (!(result === undefined
  21055. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21056. : result
  21057. )) {
  21058. return false;
  21059. }
  21060. }
  21061. }
  21062. return true;
  21063. }
  21064. /**
  21065. * The base implementation of `_.isNative` without bad shim checks.
  21066. *
  21067. * @private
  21068. * @param {*} value The value to check.
  21069. * @returns {boolean} Returns `true` if `value` is a native function,
  21070. * else `false`.
  21071. */
  21072. function baseIsNative(value) {
  21073. if (!isObject(value) || isMasked(value)) {
  21074. return false;
  21075. }
  21076. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21077. return pattern.test(toSource(value));
  21078. }
  21079. /**
  21080. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21081. *
  21082. * @private
  21083. * @param {*} value The value to check.
  21084. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21085. */
  21086. function baseIsRegExp(value) {
  21087. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21088. }
  21089. /**
  21090. * The base implementation of `_.isSet` without Node.js optimizations.
  21091. *
  21092. * @private
  21093. * @param {*} value The value to check.
  21094. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21095. */
  21096. function baseIsSet(value) {
  21097. return isObjectLike(value) && getTag(value) == setTag;
  21098. }
  21099. /**
  21100. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21101. *
  21102. * @private
  21103. * @param {*} value The value to check.
  21104. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21105. */
  21106. function baseIsTypedArray(value) {
  21107. return isObjectLike(value) &&
  21108. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21109. }
  21110. /**
  21111. * The base implementation of `_.iteratee`.
  21112. *
  21113. * @private
  21114. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21115. * @returns {Function} Returns the iteratee.
  21116. */
  21117. function baseIteratee(value) {
  21118. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21119. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21120. if (typeof value == 'function') {
  21121. return value;
  21122. }
  21123. if (value == null) {
  21124. return identity;
  21125. }
  21126. if (typeof value == 'object') {
  21127. return isArray(value)
  21128. ? baseMatchesProperty(value[0], value[1])
  21129. : baseMatches(value);
  21130. }
  21131. return property(value);
  21132. }
  21133. /**
  21134. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21135. *
  21136. * @private
  21137. * @param {Object} object The object to query.
  21138. * @returns {Array} Returns the array of property names.
  21139. */
  21140. function baseKeys(object) {
  21141. if (!isPrototype(object)) {
  21142. return nativeKeys(object);
  21143. }
  21144. var result = [];
  21145. for (var key in Object(object)) {
  21146. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21147. result.push(key);
  21148. }
  21149. }
  21150. return result;
  21151. }
  21152. /**
  21153. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21154. *
  21155. * @private
  21156. * @param {Object} object The object to query.
  21157. * @returns {Array} Returns the array of property names.
  21158. */
  21159. function baseKeysIn(object) {
  21160. if (!isObject(object)) {
  21161. return nativeKeysIn(object);
  21162. }
  21163. var isProto = isPrototype(object),
  21164. result = [];
  21165. for (var key in object) {
  21166. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21167. result.push(key);
  21168. }
  21169. }
  21170. return result;
  21171. }
  21172. /**
  21173. * The base implementation of `_.lt` which doesn't coerce arguments.
  21174. *
  21175. * @private
  21176. * @param {*} value The value to compare.
  21177. * @param {*} other The other value to compare.
  21178. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21179. * else `false`.
  21180. */
  21181. function baseLt(value, other) {
  21182. return value < other;
  21183. }
  21184. /**
  21185. * The base implementation of `_.map` without support for iteratee shorthands.
  21186. *
  21187. * @private
  21188. * @param {Array|Object} collection The collection to iterate over.
  21189. * @param {Function} iteratee The function invoked per iteration.
  21190. * @returns {Array} Returns the new mapped array.
  21191. */
  21192. function baseMap(collection, iteratee) {
  21193. var index = -1,
  21194. result = isArrayLike(collection) ? Array(collection.length) : [];
  21195. baseEach(collection, function(value, key, collection) {
  21196. result[++index] = iteratee(value, key, collection);
  21197. });
  21198. return result;
  21199. }
  21200. /**
  21201. * The base implementation of `_.matches` which doesn't clone `source`.
  21202. *
  21203. * @private
  21204. * @param {Object} source The object of property values to match.
  21205. * @returns {Function} Returns the new spec function.
  21206. */
  21207. function baseMatches(source) {
  21208. var matchData = getMatchData(source);
  21209. if (matchData.length == 1 && matchData[0][2]) {
  21210. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21211. }
  21212. return function(object) {
  21213. return object === source || baseIsMatch(object, source, matchData);
  21214. };
  21215. }
  21216. /**
  21217. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21218. *
  21219. * @private
  21220. * @param {string} path The path of the property to get.
  21221. * @param {*} srcValue The value to match.
  21222. * @returns {Function} Returns the new spec function.
  21223. */
  21224. function baseMatchesProperty(path, srcValue) {
  21225. if (isKey(path) && isStrictComparable(srcValue)) {
  21226. return matchesStrictComparable(toKey(path), srcValue);
  21227. }
  21228. return function(object) {
  21229. var objValue = get(object, path);
  21230. return (objValue === undefined && objValue === srcValue)
  21231. ? hasIn(object, path)
  21232. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21233. };
  21234. }
  21235. /**
  21236. * The base implementation of `_.merge` without support for multiple sources.
  21237. *
  21238. * @private
  21239. * @param {Object} object The destination object.
  21240. * @param {Object} source The source object.
  21241. * @param {number} srcIndex The index of `source`.
  21242. * @param {Function} [customizer] The function to customize merged values.
  21243. * @param {Object} [stack] Tracks traversed source values and their merged
  21244. * counterparts.
  21245. */
  21246. function baseMerge(object, source, srcIndex, customizer, stack) {
  21247. if (object === source) {
  21248. return;
  21249. }
  21250. baseFor(source, function(srcValue, key) {
  21251. stack || (stack = new Stack);
  21252. if (isObject(srcValue)) {
  21253. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21254. }
  21255. else {
  21256. var newValue = customizer
  21257. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21258. : undefined;
  21259. if (newValue === undefined) {
  21260. newValue = srcValue;
  21261. }
  21262. assignMergeValue(object, key, newValue);
  21263. }
  21264. }, keysIn);
  21265. }
  21266. /**
  21267. * A specialized version of `baseMerge` for arrays and objects which performs
  21268. * deep merges and tracks traversed objects enabling objects with circular
  21269. * references to be merged.
  21270. *
  21271. * @private
  21272. * @param {Object} object The destination object.
  21273. * @param {Object} source The source object.
  21274. * @param {string} key The key of the value to merge.
  21275. * @param {number} srcIndex The index of `source`.
  21276. * @param {Function} mergeFunc The function to merge values.
  21277. * @param {Function} [customizer] The function to customize assigned values.
  21278. * @param {Object} [stack] Tracks traversed source values and their merged
  21279. * counterparts.
  21280. */
  21281. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21282. var objValue = safeGet(object, key),
  21283. srcValue = safeGet(source, key),
  21284. stacked = stack.get(srcValue);
  21285. if (stacked) {
  21286. assignMergeValue(object, key, stacked);
  21287. return;
  21288. }
  21289. var newValue = customizer
  21290. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21291. : undefined;
  21292. var isCommon = newValue === undefined;
  21293. if (isCommon) {
  21294. var isArr = isArray(srcValue),
  21295. isBuff = !isArr && isBuffer(srcValue),
  21296. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21297. newValue = srcValue;
  21298. if (isArr || isBuff || isTyped) {
  21299. if (isArray(objValue)) {
  21300. newValue = objValue;
  21301. }
  21302. else if (isArrayLikeObject(objValue)) {
  21303. newValue = copyArray(objValue);
  21304. }
  21305. else if (isBuff) {
  21306. isCommon = false;
  21307. newValue = cloneBuffer(srcValue, true);
  21308. }
  21309. else if (isTyped) {
  21310. isCommon = false;
  21311. newValue = cloneTypedArray(srcValue, true);
  21312. }
  21313. else {
  21314. newValue = [];
  21315. }
  21316. }
  21317. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21318. newValue = objValue;
  21319. if (isArguments(objValue)) {
  21320. newValue = toPlainObject(objValue);
  21321. }
  21322. else if (!isObject(objValue) || isFunction(objValue)) {
  21323. newValue = initCloneObject(srcValue);
  21324. }
  21325. }
  21326. else {
  21327. isCommon = false;
  21328. }
  21329. }
  21330. if (isCommon) {
  21331. // Recursively merge objects and arrays (susceptible to call stack limits).
  21332. stack.set(srcValue, newValue);
  21333. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21334. stack['delete'](srcValue);
  21335. }
  21336. assignMergeValue(object, key, newValue);
  21337. }
  21338. /**
  21339. * The base implementation of `_.nth` which doesn't coerce arguments.
  21340. *
  21341. * @private
  21342. * @param {Array} array The array to query.
  21343. * @param {number} n The index of the element to return.
  21344. * @returns {*} Returns the nth element of `array`.
  21345. */
  21346. function baseNth(array, n) {
  21347. var length = array.length;
  21348. if (!length) {
  21349. return;
  21350. }
  21351. n += n < 0 ? length : 0;
  21352. return isIndex(n, length) ? array[n] : undefined;
  21353. }
  21354. /**
  21355. * The base implementation of `_.orderBy` without param guards.
  21356. *
  21357. * @private
  21358. * @param {Array|Object} collection The collection to iterate over.
  21359. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21360. * @param {string[]} orders The sort orders of `iteratees`.
  21361. * @returns {Array} Returns the new sorted array.
  21362. */
  21363. function baseOrderBy(collection, iteratees, orders) {
  21364. var index = -1;
  21365. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21366. var result = baseMap(collection, function(value, key, collection) {
  21367. var criteria = arrayMap(iteratees, function(iteratee) {
  21368. return iteratee(value);
  21369. });
  21370. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21371. });
  21372. return baseSortBy(result, function(object, other) {
  21373. return compareMultiple(object, other, orders);
  21374. });
  21375. }
  21376. /**
  21377. * The base implementation of `_.pick` without support for individual
  21378. * property identifiers.
  21379. *
  21380. * @private
  21381. * @param {Object} object The source object.
  21382. * @param {string[]} paths The property paths to pick.
  21383. * @returns {Object} Returns the new object.
  21384. */
  21385. function basePick(object, paths) {
  21386. return basePickBy(object, paths, function(value, path) {
  21387. return hasIn(object, path);
  21388. });
  21389. }
  21390. /**
  21391. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21392. *
  21393. * @private
  21394. * @param {Object} object The source object.
  21395. * @param {string[]} paths The property paths to pick.
  21396. * @param {Function} predicate The function invoked per property.
  21397. * @returns {Object} Returns the new object.
  21398. */
  21399. function basePickBy(object, paths, predicate) {
  21400. var index = -1,
  21401. length = paths.length,
  21402. result = {};
  21403. while (++index < length) {
  21404. var path = paths[index],
  21405. value = baseGet(object, path);
  21406. if (predicate(value, path)) {
  21407. baseSet(result, castPath(path, object), value);
  21408. }
  21409. }
  21410. return result;
  21411. }
  21412. /**
  21413. * A specialized version of `baseProperty` which supports deep paths.
  21414. *
  21415. * @private
  21416. * @param {Array|string} path The path of the property to get.
  21417. * @returns {Function} Returns the new accessor function.
  21418. */
  21419. function basePropertyDeep(path) {
  21420. return function(object) {
  21421. return baseGet(object, path);
  21422. };
  21423. }
  21424. /**
  21425. * The base implementation of `_.pullAllBy` without support for iteratee
  21426. * shorthands.
  21427. *
  21428. * @private
  21429. * @param {Array} array The array to modify.
  21430. * @param {Array} values The values to remove.
  21431. * @param {Function} [iteratee] The iteratee invoked per element.
  21432. * @param {Function} [comparator] The comparator invoked per element.
  21433. * @returns {Array} Returns `array`.
  21434. */
  21435. function basePullAll(array, values, iteratee, comparator) {
  21436. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21437. index = -1,
  21438. length = values.length,
  21439. seen = array;
  21440. if (array === values) {
  21441. values = copyArray(values);
  21442. }
  21443. if (iteratee) {
  21444. seen = arrayMap(array, baseUnary(iteratee));
  21445. }
  21446. while (++index < length) {
  21447. var fromIndex = 0,
  21448. value = values[index],
  21449. computed = iteratee ? iteratee(value) : value;
  21450. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21451. if (seen !== array) {
  21452. splice.call(seen, fromIndex, 1);
  21453. }
  21454. splice.call(array, fromIndex, 1);
  21455. }
  21456. }
  21457. return array;
  21458. }
  21459. /**
  21460. * The base implementation of `_.pullAt` without support for individual
  21461. * indexes or capturing the removed elements.
  21462. *
  21463. * @private
  21464. * @param {Array} array The array to modify.
  21465. * @param {number[]} indexes The indexes of elements to remove.
  21466. * @returns {Array} Returns `array`.
  21467. */
  21468. function basePullAt(array, indexes) {
  21469. var length = array ? indexes.length : 0,
  21470. lastIndex = length - 1;
  21471. while (length--) {
  21472. var index = indexes[length];
  21473. if (length == lastIndex || index !== previous) {
  21474. var previous = index;
  21475. if (isIndex(index)) {
  21476. splice.call(array, index, 1);
  21477. } else {
  21478. baseUnset(array, index);
  21479. }
  21480. }
  21481. }
  21482. return array;
  21483. }
  21484. /**
  21485. * The base implementation of `_.random` without support for returning
  21486. * floating-point numbers.
  21487. *
  21488. * @private
  21489. * @param {number} lower The lower bound.
  21490. * @param {number} upper The upper bound.
  21491. * @returns {number} Returns the random number.
  21492. */
  21493. function baseRandom(lower, upper) {
  21494. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21495. }
  21496. /**
  21497. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21498. * coerce arguments.
  21499. *
  21500. * @private
  21501. * @param {number} start The start of the range.
  21502. * @param {number} end The end of the range.
  21503. * @param {number} step The value to increment or decrement by.
  21504. * @param {boolean} [fromRight] Specify iterating from right to left.
  21505. * @returns {Array} Returns the range of numbers.
  21506. */
  21507. function baseRange(start, end, step, fromRight) {
  21508. var index = -1,
  21509. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21510. result = Array(length);
  21511. while (length--) {
  21512. result[fromRight ? length : ++index] = start;
  21513. start += step;
  21514. }
  21515. return result;
  21516. }
  21517. /**
  21518. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21519. *
  21520. * @private
  21521. * @param {string} string The string to repeat.
  21522. * @param {number} n The number of times to repeat the string.
  21523. * @returns {string} Returns the repeated string.
  21524. */
  21525. function baseRepeat(string, n) {
  21526. var result = '';
  21527. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21528. return result;
  21529. }
  21530. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21531. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21532. do {
  21533. if (n % 2) {
  21534. result += string;
  21535. }
  21536. n = nativeFloor(n / 2);
  21537. if (n) {
  21538. string += string;
  21539. }
  21540. } while (n);
  21541. return result;
  21542. }
  21543. /**
  21544. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21545. *
  21546. * @private
  21547. * @param {Function} func The function to apply a rest parameter to.
  21548. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21549. * @returns {Function} Returns the new function.
  21550. */
  21551. function baseRest(func, start) {
  21552. return setToString(overRest(func, start, identity), func + '');
  21553. }
  21554. /**
  21555. * The base implementation of `_.sample`.
  21556. *
  21557. * @private
  21558. * @param {Array|Object} collection The collection to sample.
  21559. * @returns {*} Returns the random element.
  21560. */
  21561. function baseSample(collection) {
  21562. return arraySample(values(collection));
  21563. }
  21564. /**
  21565. * The base implementation of `_.sampleSize` without param guards.
  21566. *
  21567. * @private
  21568. * @param {Array|Object} collection The collection to sample.
  21569. * @param {number} n The number of elements to sample.
  21570. * @returns {Array} Returns the random elements.
  21571. */
  21572. function baseSampleSize(collection, n) {
  21573. var array = values(collection);
  21574. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21575. }
  21576. /**
  21577. * The base implementation of `_.set`.
  21578. *
  21579. * @private
  21580. * @param {Object} object The object to modify.
  21581. * @param {Array|string} path The path of the property to set.
  21582. * @param {*} value The value to set.
  21583. * @param {Function} [customizer] The function to customize path creation.
  21584. * @returns {Object} Returns `object`.
  21585. */
  21586. function baseSet(object, path, value, customizer) {
  21587. if (!isObject(object)) {
  21588. return object;
  21589. }
  21590. path = castPath(path, object);
  21591. var index = -1,
  21592. length = path.length,
  21593. lastIndex = length - 1,
  21594. nested = object;
  21595. while (nested != null && ++index < length) {
  21596. var key = toKey(path[index]),
  21597. newValue = value;
  21598. if (index != lastIndex) {
  21599. var objValue = nested[key];
  21600. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21601. if (newValue === undefined) {
  21602. newValue = isObject(objValue)
  21603. ? objValue
  21604. : (isIndex(path[index + 1]) ? [] : {});
  21605. }
  21606. }
  21607. assignValue(nested, key, newValue);
  21608. nested = nested[key];
  21609. }
  21610. return object;
  21611. }
  21612. /**
  21613. * The base implementation of `setData` without support for hot loop shorting.
  21614. *
  21615. * @private
  21616. * @param {Function} func The function to associate metadata with.
  21617. * @param {*} data The metadata.
  21618. * @returns {Function} Returns `func`.
  21619. */
  21620. var baseSetData = !metaMap ? identity : function(func, data) {
  21621. metaMap.set(func, data);
  21622. return func;
  21623. };
  21624. /**
  21625. * The base implementation of `setToString` without support for hot loop shorting.
  21626. *
  21627. * @private
  21628. * @param {Function} func The function to modify.
  21629. * @param {Function} string The `toString` result.
  21630. * @returns {Function} Returns `func`.
  21631. */
  21632. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21633. return defineProperty(func, 'toString', {
  21634. 'configurable': true,
  21635. 'enumerable': false,
  21636. 'value': constant(string),
  21637. 'writable': true
  21638. });
  21639. };
  21640. /**
  21641. * The base implementation of `_.shuffle`.
  21642. *
  21643. * @private
  21644. * @param {Array|Object} collection The collection to shuffle.
  21645. * @returns {Array} Returns the new shuffled array.
  21646. */
  21647. function baseShuffle(collection) {
  21648. return shuffleSelf(values(collection));
  21649. }
  21650. /**
  21651. * The base implementation of `_.slice` without an iteratee call guard.
  21652. *
  21653. * @private
  21654. * @param {Array} array The array to slice.
  21655. * @param {number} [start=0] The start position.
  21656. * @param {number} [end=array.length] The end position.
  21657. * @returns {Array} Returns the slice of `array`.
  21658. */
  21659. function baseSlice(array, start, end) {
  21660. var index = -1,
  21661. length = array.length;
  21662. if (start < 0) {
  21663. start = -start > length ? 0 : (length + start);
  21664. }
  21665. end = end > length ? length : end;
  21666. if (end < 0) {
  21667. end += length;
  21668. }
  21669. length = start > end ? 0 : ((end - start) >>> 0);
  21670. start >>>= 0;
  21671. var result = Array(length);
  21672. while (++index < length) {
  21673. result[index] = array[index + start];
  21674. }
  21675. return result;
  21676. }
  21677. /**
  21678. * The base implementation of `_.some` without support for iteratee shorthands.
  21679. *
  21680. * @private
  21681. * @param {Array|Object} collection The collection to iterate over.
  21682. * @param {Function} predicate The function invoked per iteration.
  21683. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21684. * else `false`.
  21685. */
  21686. function baseSome(collection, predicate) {
  21687. var result;
  21688. baseEach(collection, function(value, index, collection) {
  21689. result = predicate(value, index, collection);
  21690. return !result;
  21691. });
  21692. return !!result;
  21693. }
  21694. /**
  21695. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21696. * performs a binary search of `array` to determine the index at which `value`
  21697. * should be inserted into `array` in order to maintain its sort order.
  21698. *
  21699. * @private
  21700. * @param {Array} array The sorted array to inspect.
  21701. * @param {*} value The value to evaluate.
  21702. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21703. * @returns {number} Returns the index at which `value` should be inserted
  21704. * into `array`.
  21705. */
  21706. function baseSortedIndex(array, value, retHighest) {
  21707. var low = 0,
  21708. high = array == null ? low : array.length;
  21709. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21710. while (low < high) {
  21711. var mid = (low + high) >>> 1,
  21712. computed = array[mid];
  21713. if (computed !== null && !isSymbol(computed) &&
  21714. (retHighest ? (computed <= value) : (computed < value))) {
  21715. low = mid + 1;
  21716. } else {
  21717. high = mid;
  21718. }
  21719. }
  21720. return high;
  21721. }
  21722. return baseSortedIndexBy(array, value, identity, retHighest);
  21723. }
  21724. /**
  21725. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  21726. * which invokes `iteratee` for `value` and each element of `array` to compute
  21727. * their sort ranking. The iteratee is invoked with one argument; (value).
  21728. *
  21729. * @private
  21730. * @param {Array} array The sorted array to inspect.
  21731. * @param {*} value The value to evaluate.
  21732. * @param {Function} iteratee The iteratee invoked per element.
  21733. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21734. * @returns {number} Returns the index at which `value` should be inserted
  21735. * into `array`.
  21736. */
  21737. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  21738. value = iteratee(value);
  21739. var low = 0,
  21740. high = array == null ? 0 : array.length,
  21741. valIsNaN = value !== value,
  21742. valIsNull = value === null,
  21743. valIsSymbol = isSymbol(value),
  21744. valIsUndefined = value === undefined;
  21745. while (low < high) {
  21746. var mid = nativeFloor((low + high) / 2),
  21747. computed = iteratee(array[mid]),
  21748. othIsDefined = computed !== undefined,
  21749. othIsNull = computed === null,
  21750. othIsReflexive = computed === computed,
  21751. othIsSymbol = isSymbol(computed);
  21752. if (valIsNaN) {
  21753. var setLow = retHighest || othIsReflexive;
  21754. } else if (valIsUndefined) {
  21755. setLow = othIsReflexive && (retHighest || othIsDefined);
  21756. } else if (valIsNull) {
  21757. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  21758. } else if (valIsSymbol) {
  21759. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  21760. } else if (othIsNull || othIsSymbol) {
  21761. setLow = false;
  21762. } else {
  21763. setLow = retHighest ? (computed <= value) : (computed < value);
  21764. }
  21765. if (setLow) {
  21766. low = mid + 1;
  21767. } else {
  21768. high = mid;
  21769. }
  21770. }
  21771. return nativeMin(high, MAX_ARRAY_INDEX);
  21772. }
  21773. /**
  21774. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  21775. * support for iteratee shorthands.
  21776. *
  21777. * @private
  21778. * @param {Array} array The array to inspect.
  21779. * @param {Function} [iteratee] The iteratee invoked per element.
  21780. * @returns {Array} Returns the new duplicate free array.
  21781. */
  21782. function baseSortedUniq(array, iteratee) {
  21783. var index = -1,
  21784. length = array.length,
  21785. resIndex = 0,
  21786. result = [];
  21787. while (++index < length) {
  21788. var value = array[index],
  21789. computed = iteratee ? iteratee(value) : value;
  21790. if (!index || !eq(computed, seen)) {
  21791. var seen = computed;
  21792. result[resIndex++] = value === 0 ? 0 : value;
  21793. }
  21794. }
  21795. return result;
  21796. }
  21797. /**
  21798. * The base implementation of `_.toNumber` which doesn't ensure correct
  21799. * conversions of binary, hexadecimal, or octal string values.
  21800. *
  21801. * @private
  21802. * @param {*} value The value to process.
  21803. * @returns {number} Returns the number.
  21804. */
  21805. function baseToNumber(value) {
  21806. if (typeof value == 'number') {
  21807. return value;
  21808. }
  21809. if (isSymbol(value)) {
  21810. return NAN;
  21811. }
  21812. return +value;
  21813. }
  21814. /**
  21815. * The base implementation of `_.toString` which doesn't convert nullish
  21816. * values to empty strings.
  21817. *
  21818. * @private
  21819. * @param {*} value The value to process.
  21820. * @returns {string} Returns the string.
  21821. */
  21822. function baseToString(value) {
  21823. // Exit early for strings to avoid a performance hit in some environments.
  21824. if (typeof value == 'string') {
  21825. return value;
  21826. }
  21827. if (isArray(value)) {
  21828. // Recursively convert values (susceptible to call stack limits).
  21829. return arrayMap(value, baseToString) + '';
  21830. }
  21831. if (isSymbol(value)) {
  21832. return symbolToString ? symbolToString.call(value) : '';
  21833. }
  21834. var result = (value + '');
  21835. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  21836. }
  21837. /**
  21838. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  21839. *
  21840. * @private
  21841. * @param {Array} array The array to inspect.
  21842. * @param {Function} [iteratee] The iteratee invoked per element.
  21843. * @param {Function} [comparator] The comparator invoked per element.
  21844. * @returns {Array} Returns the new duplicate free array.
  21845. */
  21846. function baseUniq(array, iteratee, comparator) {
  21847. var index = -1,
  21848. includes = arrayIncludes,
  21849. length = array.length,
  21850. isCommon = true,
  21851. result = [],
  21852. seen = result;
  21853. if (comparator) {
  21854. isCommon = false;
  21855. includes = arrayIncludesWith;
  21856. }
  21857. else if (length >= LARGE_ARRAY_SIZE) {
  21858. var set = iteratee ? null : createSet(array);
  21859. if (set) {
  21860. return setToArray(set);
  21861. }
  21862. isCommon = false;
  21863. includes = cacheHas;
  21864. seen = new SetCache;
  21865. }
  21866. else {
  21867. seen = iteratee ? [] : result;
  21868. }
  21869. outer:
  21870. while (++index < length) {
  21871. var value = array[index],
  21872. computed = iteratee ? iteratee(value) : value;
  21873. value = (comparator || value !== 0) ? value : 0;
  21874. if (isCommon && computed === computed) {
  21875. var seenIndex = seen.length;
  21876. while (seenIndex--) {
  21877. if (seen[seenIndex] === computed) {
  21878. continue outer;
  21879. }
  21880. }
  21881. if (iteratee) {
  21882. seen.push(computed);
  21883. }
  21884. result.push(value);
  21885. }
  21886. else if (!includes(seen, computed, comparator)) {
  21887. if (seen !== result) {
  21888. seen.push(computed);
  21889. }
  21890. result.push(value);
  21891. }
  21892. }
  21893. return result;
  21894. }
  21895. /**
  21896. * The base implementation of `_.unset`.
  21897. *
  21898. * @private
  21899. * @param {Object} object The object to modify.
  21900. * @param {Array|string} path The property path to unset.
  21901. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  21902. */
  21903. function baseUnset(object, path) {
  21904. path = castPath(path, object);
  21905. object = parent(object, path);
  21906. return object == null || delete object[toKey(last(path))];
  21907. }
  21908. /**
  21909. * The base implementation of `_.update`.
  21910. *
  21911. * @private
  21912. * @param {Object} object The object to modify.
  21913. * @param {Array|string} path The path of the property to update.
  21914. * @param {Function} updater The function to produce the updated value.
  21915. * @param {Function} [customizer] The function to customize path creation.
  21916. * @returns {Object} Returns `object`.
  21917. */
  21918. function baseUpdate(object, path, updater, customizer) {
  21919. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  21920. }
  21921. /**
  21922. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  21923. * without support for iteratee shorthands.
  21924. *
  21925. * @private
  21926. * @param {Array} array The array to query.
  21927. * @param {Function} predicate The function invoked per iteration.
  21928. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  21929. * @param {boolean} [fromRight] Specify iterating from right to left.
  21930. * @returns {Array} Returns the slice of `array`.
  21931. */
  21932. function baseWhile(array, predicate, isDrop, fromRight) {
  21933. var length = array.length,
  21934. index = fromRight ? length : -1;
  21935. while ((fromRight ? index-- : ++index < length) &&
  21936. predicate(array[index], index, array)) {}
  21937. return isDrop
  21938. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  21939. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  21940. }
  21941. /**
  21942. * The base implementation of `wrapperValue` which returns the result of
  21943. * performing a sequence of actions on the unwrapped `value`, where each
  21944. * successive action is supplied the return value of the previous.
  21945. *
  21946. * @private
  21947. * @param {*} value The unwrapped value.
  21948. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  21949. * @returns {*} Returns the resolved value.
  21950. */
  21951. function baseWrapperValue(value, actions) {
  21952. var result = value;
  21953. if (result instanceof LazyWrapper) {
  21954. result = result.value();
  21955. }
  21956. return arrayReduce(actions, function(result, action) {
  21957. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  21958. }, result);
  21959. }
  21960. /**
  21961. * The base implementation of methods like `_.xor`, without support for
  21962. * iteratee shorthands, that accepts an array of arrays to inspect.
  21963. *
  21964. * @private
  21965. * @param {Array} arrays The arrays to inspect.
  21966. * @param {Function} [iteratee] The iteratee invoked per element.
  21967. * @param {Function} [comparator] The comparator invoked per element.
  21968. * @returns {Array} Returns the new array of values.
  21969. */
  21970. function baseXor(arrays, iteratee, comparator) {
  21971. var length = arrays.length;
  21972. if (length < 2) {
  21973. return length ? baseUniq(arrays[0]) : [];
  21974. }
  21975. var index = -1,
  21976. result = Array(length);
  21977. while (++index < length) {
  21978. var array = arrays[index],
  21979. othIndex = -1;
  21980. while (++othIndex < length) {
  21981. if (othIndex != index) {
  21982. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  21983. }
  21984. }
  21985. }
  21986. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  21987. }
  21988. /**
  21989. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  21990. *
  21991. * @private
  21992. * @param {Array} props The property identifiers.
  21993. * @param {Array} values The property values.
  21994. * @param {Function} assignFunc The function to assign values.
  21995. * @returns {Object} Returns the new object.
  21996. */
  21997. function baseZipObject(props, values, assignFunc) {
  21998. var index = -1,
  21999. length = props.length,
  22000. valsLength = values.length,
  22001. result = {};
  22002. while (++index < length) {
  22003. var value = index < valsLength ? values[index] : undefined;
  22004. assignFunc(result, props[index], value);
  22005. }
  22006. return result;
  22007. }
  22008. /**
  22009. * Casts `value` to an empty array if it's not an array like object.
  22010. *
  22011. * @private
  22012. * @param {*} value The value to inspect.
  22013. * @returns {Array|Object} Returns the cast array-like object.
  22014. */
  22015. function castArrayLikeObject(value) {
  22016. return isArrayLikeObject(value) ? value : [];
  22017. }
  22018. /**
  22019. * Casts `value` to `identity` if it's not a function.
  22020. *
  22021. * @private
  22022. * @param {*} value The value to inspect.
  22023. * @returns {Function} Returns cast function.
  22024. */
  22025. function castFunction(value) {
  22026. return typeof value == 'function' ? value : identity;
  22027. }
  22028. /**
  22029. * Casts `value` to a path array if it's not one.
  22030. *
  22031. * @private
  22032. * @param {*} value The value to inspect.
  22033. * @param {Object} [object] The object to query keys on.
  22034. * @returns {Array} Returns the cast property path array.
  22035. */
  22036. function castPath(value, object) {
  22037. if (isArray(value)) {
  22038. return value;
  22039. }
  22040. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22041. }
  22042. /**
  22043. * A `baseRest` alias which can be replaced with `identity` by module
  22044. * replacement plugins.
  22045. *
  22046. * @private
  22047. * @type {Function}
  22048. * @param {Function} func The function to apply a rest parameter to.
  22049. * @returns {Function} Returns the new function.
  22050. */
  22051. var castRest = baseRest;
  22052. /**
  22053. * Casts `array` to a slice if it's needed.
  22054. *
  22055. * @private
  22056. * @param {Array} array The array to inspect.
  22057. * @param {number} start The start position.
  22058. * @param {number} [end=array.length] The end position.
  22059. * @returns {Array} Returns the cast slice.
  22060. */
  22061. function castSlice(array, start, end) {
  22062. var length = array.length;
  22063. end = end === undefined ? length : end;
  22064. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22065. }
  22066. /**
  22067. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22068. *
  22069. * @private
  22070. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22071. */
  22072. var clearTimeout = ctxClearTimeout || function(id) {
  22073. return root.clearTimeout(id);
  22074. };
  22075. /**
  22076. * Creates a clone of `buffer`.
  22077. *
  22078. * @private
  22079. * @param {Buffer} buffer The buffer to clone.
  22080. * @param {boolean} [isDeep] Specify a deep clone.
  22081. * @returns {Buffer} Returns the cloned buffer.
  22082. */
  22083. function cloneBuffer(buffer, isDeep) {
  22084. if (isDeep) {
  22085. return buffer.slice();
  22086. }
  22087. var length = buffer.length,
  22088. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22089. buffer.copy(result);
  22090. return result;
  22091. }
  22092. /**
  22093. * Creates a clone of `arrayBuffer`.
  22094. *
  22095. * @private
  22096. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22097. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22098. */
  22099. function cloneArrayBuffer(arrayBuffer) {
  22100. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22101. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22102. return result;
  22103. }
  22104. /**
  22105. * Creates a clone of `dataView`.
  22106. *
  22107. * @private
  22108. * @param {Object} dataView The data view to clone.
  22109. * @param {boolean} [isDeep] Specify a deep clone.
  22110. * @returns {Object} Returns the cloned data view.
  22111. */
  22112. function cloneDataView(dataView, isDeep) {
  22113. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22114. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22115. }
  22116. /**
  22117. * Creates a clone of `regexp`.
  22118. *
  22119. * @private
  22120. * @param {Object} regexp The regexp to clone.
  22121. * @returns {Object} Returns the cloned regexp.
  22122. */
  22123. function cloneRegExp(regexp) {
  22124. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22125. result.lastIndex = regexp.lastIndex;
  22126. return result;
  22127. }
  22128. /**
  22129. * Creates a clone of the `symbol` object.
  22130. *
  22131. * @private
  22132. * @param {Object} symbol The symbol object to clone.
  22133. * @returns {Object} Returns the cloned symbol object.
  22134. */
  22135. function cloneSymbol(symbol) {
  22136. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22137. }
  22138. /**
  22139. * Creates a clone of `typedArray`.
  22140. *
  22141. * @private
  22142. * @param {Object} typedArray The typed array to clone.
  22143. * @param {boolean} [isDeep] Specify a deep clone.
  22144. * @returns {Object} Returns the cloned typed array.
  22145. */
  22146. function cloneTypedArray(typedArray, isDeep) {
  22147. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22148. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22149. }
  22150. /**
  22151. * Compares values to sort them in ascending order.
  22152. *
  22153. * @private
  22154. * @param {*} value The value to compare.
  22155. * @param {*} other The other value to compare.
  22156. * @returns {number} Returns the sort order indicator for `value`.
  22157. */
  22158. function compareAscending(value, other) {
  22159. if (value !== other) {
  22160. var valIsDefined = value !== undefined,
  22161. valIsNull = value === null,
  22162. valIsReflexive = value === value,
  22163. valIsSymbol = isSymbol(value);
  22164. var othIsDefined = other !== undefined,
  22165. othIsNull = other === null,
  22166. othIsReflexive = other === other,
  22167. othIsSymbol = isSymbol(other);
  22168. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22169. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22170. (valIsNull && othIsDefined && othIsReflexive) ||
  22171. (!valIsDefined && othIsReflexive) ||
  22172. !valIsReflexive) {
  22173. return 1;
  22174. }
  22175. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22176. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22177. (othIsNull && valIsDefined && valIsReflexive) ||
  22178. (!othIsDefined && valIsReflexive) ||
  22179. !othIsReflexive) {
  22180. return -1;
  22181. }
  22182. }
  22183. return 0;
  22184. }
  22185. /**
  22186. * Used by `_.orderBy` to compare multiple properties of a value to another
  22187. * and stable sort them.
  22188. *
  22189. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22190. * specify an order of "desc" for descending or "asc" for ascending sort order
  22191. * of corresponding values.
  22192. *
  22193. * @private
  22194. * @param {Object} object The object to compare.
  22195. * @param {Object} other The other object to compare.
  22196. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22197. * @returns {number} Returns the sort order indicator for `object`.
  22198. */
  22199. function compareMultiple(object, other, orders) {
  22200. var index = -1,
  22201. objCriteria = object.criteria,
  22202. othCriteria = other.criteria,
  22203. length = objCriteria.length,
  22204. ordersLength = orders.length;
  22205. while (++index < length) {
  22206. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22207. if (result) {
  22208. if (index >= ordersLength) {
  22209. return result;
  22210. }
  22211. var order = orders[index];
  22212. return result * (order == 'desc' ? -1 : 1);
  22213. }
  22214. }
  22215. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22216. // that causes it, under certain circumstances, to provide the same value for
  22217. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22218. // for more details.
  22219. //
  22220. // This also ensures a stable sort in V8 and other engines.
  22221. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22222. return object.index - other.index;
  22223. }
  22224. /**
  22225. * Creates an array that is the composition of partially applied arguments,
  22226. * placeholders, and provided arguments into a single array of arguments.
  22227. *
  22228. * @private
  22229. * @param {Array} args The provided arguments.
  22230. * @param {Array} partials The arguments to prepend to those provided.
  22231. * @param {Array} holders The `partials` placeholder indexes.
  22232. * @params {boolean} [isCurried] Specify composing for a curried function.
  22233. * @returns {Array} Returns the new array of composed arguments.
  22234. */
  22235. function composeArgs(args, partials, holders, isCurried) {
  22236. var argsIndex = -1,
  22237. argsLength = args.length,
  22238. holdersLength = holders.length,
  22239. leftIndex = -1,
  22240. leftLength = partials.length,
  22241. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22242. result = Array(leftLength + rangeLength),
  22243. isUncurried = !isCurried;
  22244. while (++leftIndex < leftLength) {
  22245. result[leftIndex] = partials[leftIndex];
  22246. }
  22247. while (++argsIndex < holdersLength) {
  22248. if (isUncurried || argsIndex < argsLength) {
  22249. result[holders[argsIndex]] = args[argsIndex];
  22250. }
  22251. }
  22252. while (rangeLength--) {
  22253. result[leftIndex++] = args[argsIndex++];
  22254. }
  22255. return result;
  22256. }
  22257. /**
  22258. * This function is like `composeArgs` except that the arguments composition
  22259. * is tailored for `_.partialRight`.
  22260. *
  22261. * @private
  22262. * @param {Array} args The provided arguments.
  22263. * @param {Array} partials The arguments to append to those provided.
  22264. * @param {Array} holders The `partials` placeholder indexes.
  22265. * @params {boolean} [isCurried] Specify composing for a curried function.
  22266. * @returns {Array} Returns the new array of composed arguments.
  22267. */
  22268. function composeArgsRight(args, partials, holders, isCurried) {
  22269. var argsIndex = -1,
  22270. argsLength = args.length,
  22271. holdersIndex = -1,
  22272. holdersLength = holders.length,
  22273. rightIndex = -1,
  22274. rightLength = partials.length,
  22275. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22276. result = Array(rangeLength + rightLength),
  22277. isUncurried = !isCurried;
  22278. while (++argsIndex < rangeLength) {
  22279. result[argsIndex] = args[argsIndex];
  22280. }
  22281. var offset = argsIndex;
  22282. while (++rightIndex < rightLength) {
  22283. result[offset + rightIndex] = partials[rightIndex];
  22284. }
  22285. while (++holdersIndex < holdersLength) {
  22286. if (isUncurried || argsIndex < argsLength) {
  22287. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22288. }
  22289. }
  22290. return result;
  22291. }
  22292. /**
  22293. * Copies the values of `source` to `array`.
  22294. *
  22295. * @private
  22296. * @param {Array} source The array to copy values from.
  22297. * @param {Array} [array=[]] The array to copy values to.
  22298. * @returns {Array} Returns `array`.
  22299. */
  22300. function copyArray(source, array) {
  22301. var index = -1,
  22302. length = source.length;
  22303. array || (array = Array(length));
  22304. while (++index < length) {
  22305. array[index] = source[index];
  22306. }
  22307. return array;
  22308. }
  22309. /**
  22310. * Copies properties of `source` to `object`.
  22311. *
  22312. * @private
  22313. * @param {Object} source The object to copy properties from.
  22314. * @param {Array} props The property identifiers to copy.
  22315. * @param {Object} [object={}] The object to copy properties to.
  22316. * @param {Function} [customizer] The function to customize copied values.
  22317. * @returns {Object} Returns `object`.
  22318. */
  22319. function copyObject(source, props, object, customizer) {
  22320. var isNew = !object;
  22321. object || (object = {});
  22322. var index = -1,
  22323. length = props.length;
  22324. while (++index < length) {
  22325. var key = props[index];
  22326. var newValue = customizer
  22327. ? customizer(object[key], source[key], key, object, source)
  22328. : undefined;
  22329. if (newValue === undefined) {
  22330. newValue = source[key];
  22331. }
  22332. if (isNew) {
  22333. baseAssignValue(object, key, newValue);
  22334. } else {
  22335. assignValue(object, key, newValue);
  22336. }
  22337. }
  22338. return object;
  22339. }
  22340. /**
  22341. * Copies own symbols of `source` to `object`.
  22342. *
  22343. * @private
  22344. * @param {Object} source The object to copy symbols from.
  22345. * @param {Object} [object={}] The object to copy symbols to.
  22346. * @returns {Object} Returns `object`.
  22347. */
  22348. function copySymbols(source, object) {
  22349. return copyObject(source, getSymbols(source), object);
  22350. }
  22351. /**
  22352. * Copies own and inherited symbols of `source` to `object`.
  22353. *
  22354. * @private
  22355. * @param {Object} source The object to copy symbols from.
  22356. * @param {Object} [object={}] The object to copy symbols to.
  22357. * @returns {Object} Returns `object`.
  22358. */
  22359. function copySymbolsIn(source, object) {
  22360. return copyObject(source, getSymbolsIn(source), object);
  22361. }
  22362. /**
  22363. * Creates a function like `_.groupBy`.
  22364. *
  22365. * @private
  22366. * @param {Function} setter The function to set accumulator values.
  22367. * @param {Function} [initializer] The accumulator object initializer.
  22368. * @returns {Function} Returns the new aggregator function.
  22369. */
  22370. function createAggregator(setter, initializer) {
  22371. return function(collection, iteratee) {
  22372. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22373. accumulator = initializer ? initializer() : {};
  22374. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22375. };
  22376. }
  22377. /**
  22378. * Creates a function like `_.assign`.
  22379. *
  22380. * @private
  22381. * @param {Function} assigner The function to assign values.
  22382. * @returns {Function} Returns the new assigner function.
  22383. */
  22384. function createAssigner(assigner) {
  22385. return baseRest(function(object, sources) {
  22386. var index = -1,
  22387. length = sources.length,
  22388. customizer = length > 1 ? sources[length - 1] : undefined,
  22389. guard = length > 2 ? sources[2] : undefined;
  22390. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22391. ? (length--, customizer)
  22392. : undefined;
  22393. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22394. customizer = length < 3 ? undefined : customizer;
  22395. length = 1;
  22396. }
  22397. object = Object(object);
  22398. while (++index < length) {
  22399. var source = sources[index];
  22400. if (source) {
  22401. assigner(object, source, index, customizer);
  22402. }
  22403. }
  22404. return object;
  22405. });
  22406. }
  22407. /**
  22408. * Creates a `baseEach` or `baseEachRight` function.
  22409. *
  22410. * @private
  22411. * @param {Function} eachFunc The function to iterate over a collection.
  22412. * @param {boolean} [fromRight] Specify iterating from right to left.
  22413. * @returns {Function} Returns the new base function.
  22414. */
  22415. function createBaseEach(eachFunc, fromRight) {
  22416. return function(collection, iteratee) {
  22417. if (collection == null) {
  22418. return collection;
  22419. }
  22420. if (!isArrayLike(collection)) {
  22421. return eachFunc(collection, iteratee);
  22422. }
  22423. var length = collection.length,
  22424. index = fromRight ? length : -1,
  22425. iterable = Object(collection);
  22426. while ((fromRight ? index-- : ++index < length)) {
  22427. if (iteratee(iterable[index], index, iterable) === false) {
  22428. break;
  22429. }
  22430. }
  22431. return collection;
  22432. };
  22433. }
  22434. /**
  22435. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22436. *
  22437. * @private
  22438. * @param {boolean} [fromRight] Specify iterating from right to left.
  22439. * @returns {Function} Returns the new base function.
  22440. */
  22441. function createBaseFor(fromRight) {
  22442. return function(object, iteratee, keysFunc) {
  22443. var index = -1,
  22444. iterable = Object(object),
  22445. props = keysFunc(object),
  22446. length = props.length;
  22447. while (length--) {
  22448. var key = props[fromRight ? length : ++index];
  22449. if (iteratee(iterable[key], key, iterable) === false) {
  22450. break;
  22451. }
  22452. }
  22453. return object;
  22454. };
  22455. }
  22456. /**
  22457. * Creates a function that wraps `func` to invoke it with the optional `this`
  22458. * binding of `thisArg`.
  22459. *
  22460. * @private
  22461. * @param {Function} func The function to wrap.
  22462. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22463. * @param {*} [thisArg] The `this` binding of `func`.
  22464. * @returns {Function} Returns the new wrapped function.
  22465. */
  22466. function createBind(func, bitmask, thisArg) {
  22467. var isBind = bitmask & WRAP_BIND_FLAG,
  22468. Ctor = createCtor(func);
  22469. function wrapper() {
  22470. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22471. return fn.apply(isBind ? thisArg : this, arguments);
  22472. }
  22473. return wrapper;
  22474. }
  22475. /**
  22476. * Creates a function like `_.lowerFirst`.
  22477. *
  22478. * @private
  22479. * @param {string} methodName The name of the `String` case method to use.
  22480. * @returns {Function} Returns the new case function.
  22481. */
  22482. function createCaseFirst(methodName) {
  22483. return function(string) {
  22484. string = toString(string);
  22485. var strSymbols = hasUnicode(string)
  22486. ? stringToArray(string)
  22487. : undefined;
  22488. var chr = strSymbols
  22489. ? strSymbols[0]
  22490. : string.charAt(0);
  22491. var trailing = strSymbols
  22492. ? castSlice(strSymbols, 1).join('')
  22493. : string.slice(1);
  22494. return chr[methodName]() + trailing;
  22495. };
  22496. }
  22497. /**
  22498. * Creates a function like `_.camelCase`.
  22499. *
  22500. * @private
  22501. * @param {Function} callback The function to combine each word.
  22502. * @returns {Function} Returns the new compounder function.
  22503. */
  22504. function createCompounder(callback) {
  22505. return function(string) {
  22506. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22507. };
  22508. }
  22509. /**
  22510. * Creates a function that produces an instance of `Ctor` regardless of
  22511. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22512. *
  22513. * @private
  22514. * @param {Function} Ctor The constructor to wrap.
  22515. * @returns {Function} Returns the new wrapped function.
  22516. */
  22517. function createCtor(Ctor) {
  22518. return function() {
  22519. // Use a `switch` statement to work with class constructors. See
  22520. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22521. // for more details.
  22522. var args = arguments;
  22523. switch (args.length) {
  22524. case 0: return new Ctor;
  22525. case 1: return new Ctor(args[0]);
  22526. case 2: return new Ctor(args[0], args[1]);
  22527. case 3: return new Ctor(args[0], args[1], args[2]);
  22528. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22529. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22530. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22531. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22532. }
  22533. var thisBinding = baseCreate(Ctor.prototype),
  22534. result = Ctor.apply(thisBinding, args);
  22535. // Mimic the constructor's `return` behavior.
  22536. // See https://es5.github.io/#x13.2.2 for more details.
  22537. return isObject(result) ? result : thisBinding;
  22538. };
  22539. }
  22540. /**
  22541. * Creates a function that wraps `func` to enable currying.
  22542. *
  22543. * @private
  22544. * @param {Function} func The function to wrap.
  22545. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22546. * @param {number} arity The arity of `func`.
  22547. * @returns {Function} Returns the new wrapped function.
  22548. */
  22549. function createCurry(func, bitmask, arity) {
  22550. var Ctor = createCtor(func);
  22551. function wrapper() {
  22552. var length = arguments.length,
  22553. args = Array(length),
  22554. index = length,
  22555. placeholder = getHolder(wrapper);
  22556. while (index--) {
  22557. args[index] = arguments[index];
  22558. }
  22559. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22560. ? []
  22561. : replaceHolders(args, placeholder);
  22562. length -= holders.length;
  22563. if (length < arity) {
  22564. return createRecurry(
  22565. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22566. args, holders, undefined, undefined, arity - length);
  22567. }
  22568. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22569. return apply(fn, this, args);
  22570. }
  22571. return wrapper;
  22572. }
  22573. /**
  22574. * Creates a `_.find` or `_.findLast` function.
  22575. *
  22576. * @private
  22577. * @param {Function} findIndexFunc The function to find the collection index.
  22578. * @returns {Function} Returns the new find function.
  22579. */
  22580. function createFind(findIndexFunc) {
  22581. return function(collection, predicate, fromIndex) {
  22582. var iterable = Object(collection);
  22583. if (!isArrayLike(collection)) {
  22584. var iteratee = getIteratee(predicate, 3);
  22585. collection = keys(collection);
  22586. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22587. }
  22588. var index = findIndexFunc(collection, predicate, fromIndex);
  22589. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22590. };
  22591. }
  22592. /**
  22593. * Creates a `_.flow` or `_.flowRight` function.
  22594. *
  22595. * @private
  22596. * @param {boolean} [fromRight] Specify iterating from right to left.
  22597. * @returns {Function} Returns the new flow function.
  22598. */
  22599. function createFlow(fromRight) {
  22600. return flatRest(function(funcs) {
  22601. var length = funcs.length,
  22602. index = length,
  22603. prereq = LodashWrapper.prototype.thru;
  22604. if (fromRight) {
  22605. funcs.reverse();
  22606. }
  22607. while (index--) {
  22608. var func = funcs[index];
  22609. if (typeof func != 'function') {
  22610. throw new TypeError(FUNC_ERROR_TEXT);
  22611. }
  22612. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22613. var wrapper = new LodashWrapper([], true);
  22614. }
  22615. }
  22616. index = wrapper ? index : length;
  22617. while (++index < length) {
  22618. func = funcs[index];
  22619. var funcName = getFuncName(func),
  22620. data = funcName == 'wrapper' ? getData(func) : undefined;
  22621. if (data && isLaziable(data[0]) &&
  22622. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22623. !data[4].length && data[9] == 1
  22624. ) {
  22625. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22626. } else {
  22627. wrapper = (func.length == 1 && isLaziable(func))
  22628. ? wrapper[funcName]()
  22629. : wrapper.thru(func);
  22630. }
  22631. }
  22632. return function() {
  22633. var args = arguments,
  22634. value = args[0];
  22635. if (wrapper && args.length == 1 && isArray(value)) {
  22636. return wrapper.plant(value).value();
  22637. }
  22638. var index = 0,
  22639. result = length ? funcs[index].apply(this, args) : value;
  22640. while (++index < length) {
  22641. result = funcs[index].call(this, result);
  22642. }
  22643. return result;
  22644. };
  22645. });
  22646. }
  22647. /**
  22648. * Creates a function that wraps `func` to invoke it with optional `this`
  22649. * binding of `thisArg`, partial application, and currying.
  22650. *
  22651. * @private
  22652. * @param {Function|string} func The function or method name to wrap.
  22653. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22654. * @param {*} [thisArg] The `this` binding of `func`.
  22655. * @param {Array} [partials] The arguments to prepend to those provided to
  22656. * the new function.
  22657. * @param {Array} [holders] The `partials` placeholder indexes.
  22658. * @param {Array} [partialsRight] The arguments to append to those provided
  22659. * to the new function.
  22660. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22661. * @param {Array} [argPos] The argument positions of the new function.
  22662. * @param {number} [ary] The arity cap of `func`.
  22663. * @param {number} [arity] The arity of `func`.
  22664. * @returns {Function} Returns the new wrapped function.
  22665. */
  22666. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22667. var isAry = bitmask & WRAP_ARY_FLAG,
  22668. isBind = bitmask & WRAP_BIND_FLAG,
  22669. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22670. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22671. isFlip = bitmask & WRAP_FLIP_FLAG,
  22672. Ctor = isBindKey ? undefined : createCtor(func);
  22673. function wrapper() {
  22674. var length = arguments.length,
  22675. args = Array(length),
  22676. index = length;
  22677. while (index--) {
  22678. args[index] = arguments[index];
  22679. }
  22680. if (isCurried) {
  22681. var placeholder = getHolder(wrapper),
  22682. holdersCount = countHolders(args, placeholder);
  22683. }
  22684. if (partials) {
  22685. args = composeArgs(args, partials, holders, isCurried);
  22686. }
  22687. if (partialsRight) {
  22688. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22689. }
  22690. length -= holdersCount;
  22691. if (isCurried && length < arity) {
  22692. var newHolders = replaceHolders(args, placeholder);
  22693. return createRecurry(
  22694. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22695. args, newHolders, argPos, ary, arity - length
  22696. );
  22697. }
  22698. var thisBinding = isBind ? thisArg : this,
  22699. fn = isBindKey ? thisBinding[func] : func;
  22700. length = args.length;
  22701. if (argPos) {
  22702. args = reorder(args, argPos);
  22703. } else if (isFlip && length > 1) {
  22704. args.reverse();
  22705. }
  22706. if (isAry && ary < length) {
  22707. args.length = ary;
  22708. }
  22709. if (this && this !== root && this instanceof wrapper) {
  22710. fn = Ctor || createCtor(fn);
  22711. }
  22712. return fn.apply(thisBinding, args);
  22713. }
  22714. return wrapper;
  22715. }
  22716. /**
  22717. * Creates a function like `_.invertBy`.
  22718. *
  22719. * @private
  22720. * @param {Function} setter The function to set accumulator values.
  22721. * @param {Function} toIteratee The function to resolve iteratees.
  22722. * @returns {Function} Returns the new inverter function.
  22723. */
  22724. function createInverter(setter, toIteratee) {
  22725. return function(object, iteratee) {
  22726. return baseInverter(object, setter, toIteratee(iteratee), {});
  22727. };
  22728. }
  22729. /**
  22730. * Creates a function that performs a mathematical operation on two values.
  22731. *
  22732. * @private
  22733. * @param {Function} operator The function to perform the operation.
  22734. * @param {number} [defaultValue] The value used for `undefined` arguments.
  22735. * @returns {Function} Returns the new mathematical operation function.
  22736. */
  22737. function createMathOperation(operator, defaultValue) {
  22738. return function(value, other) {
  22739. var result;
  22740. if (value === undefined && other === undefined) {
  22741. return defaultValue;
  22742. }
  22743. if (value !== undefined) {
  22744. result = value;
  22745. }
  22746. if (other !== undefined) {
  22747. if (result === undefined) {
  22748. return other;
  22749. }
  22750. if (typeof value == 'string' || typeof other == 'string') {
  22751. value = baseToString(value);
  22752. other = baseToString(other);
  22753. } else {
  22754. value = baseToNumber(value);
  22755. other = baseToNumber(other);
  22756. }
  22757. result = operator(value, other);
  22758. }
  22759. return result;
  22760. };
  22761. }
  22762. /**
  22763. * Creates a function like `_.over`.
  22764. *
  22765. * @private
  22766. * @param {Function} arrayFunc The function to iterate over iteratees.
  22767. * @returns {Function} Returns the new over function.
  22768. */
  22769. function createOver(arrayFunc) {
  22770. return flatRest(function(iteratees) {
  22771. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  22772. return baseRest(function(args) {
  22773. var thisArg = this;
  22774. return arrayFunc(iteratees, function(iteratee) {
  22775. return apply(iteratee, thisArg, args);
  22776. });
  22777. });
  22778. });
  22779. }
  22780. /**
  22781. * Creates the padding for `string` based on `length`. The `chars` string
  22782. * is truncated if the number of characters exceeds `length`.
  22783. *
  22784. * @private
  22785. * @param {number} length The padding length.
  22786. * @param {string} [chars=' '] The string used as padding.
  22787. * @returns {string} Returns the padding for `string`.
  22788. */
  22789. function createPadding(length, chars) {
  22790. chars = chars === undefined ? ' ' : baseToString(chars);
  22791. var charsLength = chars.length;
  22792. if (charsLength < 2) {
  22793. return charsLength ? baseRepeat(chars, length) : chars;
  22794. }
  22795. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  22796. return hasUnicode(chars)
  22797. ? castSlice(stringToArray(result), 0, length).join('')
  22798. : result.slice(0, length);
  22799. }
  22800. /**
  22801. * Creates a function that wraps `func` to invoke it with the `this` binding
  22802. * of `thisArg` and `partials` prepended to the arguments it receives.
  22803. *
  22804. * @private
  22805. * @param {Function} func The function to wrap.
  22806. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22807. * @param {*} thisArg The `this` binding of `func`.
  22808. * @param {Array} partials The arguments to prepend to those provided to
  22809. * the new function.
  22810. * @returns {Function} Returns the new wrapped function.
  22811. */
  22812. function createPartial(func, bitmask, thisArg, partials) {
  22813. var isBind = bitmask & WRAP_BIND_FLAG,
  22814. Ctor = createCtor(func);
  22815. function wrapper() {
  22816. var argsIndex = -1,
  22817. argsLength = arguments.length,
  22818. leftIndex = -1,
  22819. leftLength = partials.length,
  22820. args = Array(leftLength + argsLength),
  22821. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22822. while (++leftIndex < leftLength) {
  22823. args[leftIndex] = partials[leftIndex];
  22824. }
  22825. while (argsLength--) {
  22826. args[leftIndex++] = arguments[++argsIndex];
  22827. }
  22828. return apply(fn, isBind ? thisArg : this, args);
  22829. }
  22830. return wrapper;
  22831. }
  22832. /**
  22833. * Creates a `_.range` or `_.rangeRight` function.
  22834. *
  22835. * @private
  22836. * @param {boolean} [fromRight] Specify iterating from right to left.
  22837. * @returns {Function} Returns the new range function.
  22838. */
  22839. function createRange(fromRight) {
  22840. return function(start, end, step) {
  22841. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  22842. end = step = undefined;
  22843. }
  22844. // Ensure the sign of `-0` is preserved.
  22845. start = toFinite(start);
  22846. if (end === undefined) {
  22847. end = start;
  22848. start = 0;
  22849. } else {
  22850. end = toFinite(end);
  22851. }
  22852. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  22853. return baseRange(start, end, step, fromRight);
  22854. };
  22855. }
  22856. /**
  22857. * Creates a function that performs a relational operation on two values.
  22858. *
  22859. * @private
  22860. * @param {Function} operator The function to perform the operation.
  22861. * @returns {Function} Returns the new relational operation function.
  22862. */
  22863. function createRelationalOperation(operator) {
  22864. return function(value, other) {
  22865. if (!(typeof value == 'string' && typeof other == 'string')) {
  22866. value = toNumber(value);
  22867. other = toNumber(other);
  22868. }
  22869. return operator(value, other);
  22870. };
  22871. }
  22872. /**
  22873. * Creates a function that wraps `func` to continue currying.
  22874. *
  22875. * @private
  22876. * @param {Function} func The function to wrap.
  22877. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22878. * @param {Function} wrapFunc The function to create the `func` wrapper.
  22879. * @param {*} placeholder The placeholder value.
  22880. * @param {*} [thisArg] The `this` binding of `func`.
  22881. * @param {Array} [partials] The arguments to prepend to those provided to
  22882. * the new function.
  22883. * @param {Array} [holders] The `partials` placeholder indexes.
  22884. * @param {Array} [argPos] The argument positions of the new function.
  22885. * @param {number} [ary] The arity cap of `func`.
  22886. * @param {number} [arity] The arity of `func`.
  22887. * @returns {Function} Returns the new wrapped function.
  22888. */
  22889. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  22890. var isCurry = bitmask & WRAP_CURRY_FLAG,
  22891. newHolders = isCurry ? holders : undefined,
  22892. newHoldersRight = isCurry ? undefined : holders,
  22893. newPartials = isCurry ? partials : undefined,
  22894. newPartialsRight = isCurry ? undefined : partials;
  22895. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  22896. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  22897. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  22898. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  22899. }
  22900. var newData = [
  22901. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  22902. newHoldersRight, argPos, ary, arity
  22903. ];
  22904. var result = wrapFunc.apply(undefined, newData);
  22905. if (isLaziable(func)) {
  22906. setData(result, newData);
  22907. }
  22908. result.placeholder = placeholder;
  22909. return setWrapToString(result, func, bitmask);
  22910. }
  22911. /**
  22912. * Creates a function like `_.round`.
  22913. *
  22914. * @private
  22915. * @param {string} methodName The name of the `Math` method to use when rounding.
  22916. * @returns {Function} Returns the new round function.
  22917. */
  22918. function createRound(methodName) {
  22919. var func = Math[methodName];
  22920. return function(number, precision) {
  22921. number = toNumber(number);
  22922. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  22923. if (precision && nativeIsFinite(number)) {
  22924. // Shift with exponential notation to avoid floating-point issues.
  22925. // See [MDN](https://mdn.io/round#Examples) for more details.
  22926. var pair = (toString(number) + 'e').split('e'),
  22927. value = func(pair[0] + 'e' + (+pair[1] + precision));
  22928. pair = (toString(value) + 'e').split('e');
  22929. return +(pair[0] + 'e' + (+pair[1] - precision));
  22930. }
  22931. return func(number);
  22932. };
  22933. }
  22934. /**
  22935. * Creates a set object of `values`.
  22936. *
  22937. * @private
  22938. * @param {Array} values The values to add to the set.
  22939. * @returns {Object} Returns the new set.
  22940. */
  22941. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  22942. return new Set(values);
  22943. };
  22944. /**
  22945. * Creates a `_.toPairs` or `_.toPairsIn` function.
  22946. *
  22947. * @private
  22948. * @param {Function} keysFunc The function to get the keys of a given object.
  22949. * @returns {Function} Returns the new pairs function.
  22950. */
  22951. function createToPairs(keysFunc) {
  22952. return function(object) {
  22953. var tag = getTag(object);
  22954. if (tag == mapTag) {
  22955. return mapToArray(object);
  22956. }
  22957. if (tag == setTag) {
  22958. return setToPairs(object);
  22959. }
  22960. return baseToPairs(object, keysFunc(object));
  22961. };
  22962. }
  22963. /**
  22964. * Creates a function that either curries or invokes `func` with optional
  22965. * `this` binding and partially applied arguments.
  22966. *
  22967. * @private
  22968. * @param {Function|string} func The function or method name to wrap.
  22969. * @param {number} bitmask The bitmask flags.
  22970. * 1 - `_.bind`
  22971. * 2 - `_.bindKey`
  22972. * 4 - `_.curry` or `_.curryRight` of a bound function
  22973. * 8 - `_.curry`
  22974. * 16 - `_.curryRight`
  22975. * 32 - `_.partial`
  22976. * 64 - `_.partialRight`
  22977. * 128 - `_.rearg`
  22978. * 256 - `_.ary`
  22979. * 512 - `_.flip`
  22980. * @param {*} [thisArg] The `this` binding of `func`.
  22981. * @param {Array} [partials] The arguments to be partially applied.
  22982. * @param {Array} [holders] The `partials` placeholder indexes.
  22983. * @param {Array} [argPos] The argument positions of the new function.
  22984. * @param {number} [ary] The arity cap of `func`.
  22985. * @param {number} [arity] The arity of `func`.
  22986. * @returns {Function} Returns the new wrapped function.
  22987. */
  22988. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  22989. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  22990. if (!isBindKey && typeof func != 'function') {
  22991. throw new TypeError(FUNC_ERROR_TEXT);
  22992. }
  22993. var length = partials ? partials.length : 0;
  22994. if (!length) {
  22995. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  22996. partials = holders = undefined;
  22997. }
  22998. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  22999. arity = arity === undefined ? arity : toInteger(arity);
  23000. length -= holders ? holders.length : 0;
  23001. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23002. var partialsRight = partials,
  23003. holdersRight = holders;
  23004. partials = holders = undefined;
  23005. }
  23006. var data = isBindKey ? undefined : getData(func);
  23007. var newData = [
  23008. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23009. argPos, ary, arity
  23010. ];
  23011. if (data) {
  23012. mergeData(newData, data);
  23013. }
  23014. func = newData[0];
  23015. bitmask = newData[1];
  23016. thisArg = newData[2];
  23017. partials = newData[3];
  23018. holders = newData[4];
  23019. arity = newData[9] = newData[9] === undefined
  23020. ? (isBindKey ? 0 : func.length)
  23021. : nativeMax(newData[9] - length, 0);
  23022. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23023. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23024. }
  23025. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23026. var result = createBind(func, bitmask, thisArg);
  23027. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23028. result = createCurry(func, bitmask, arity);
  23029. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23030. result = createPartial(func, bitmask, thisArg, partials);
  23031. } else {
  23032. result = createHybrid.apply(undefined, newData);
  23033. }
  23034. var setter = data ? baseSetData : setData;
  23035. return setWrapToString(setter(result, newData), func, bitmask);
  23036. }
  23037. /**
  23038. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23039. * of source objects to the destination object for all destination properties
  23040. * that resolve to `undefined`.
  23041. *
  23042. * @private
  23043. * @param {*} objValue The destination value.
  23044. * @param {*} srcValue The source value.
  23045. * @param {string} key The key of the property to assign.
  23046. * @param {Object} object The parent object of `objValue`.
  23047. * @returns {*} Returns the value to assign.
  23048. */
  23049. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23050. if (objValue === undefined ||
  23051. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23052. return srcValue;
  23053. }
  23054. return objValue;
  23055. }
  23056. /**
  23057. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23058. * objects into destination objects that are passed thru.
  23059. *
  23060. * @private
  23061. * @param {*} objValue The destination value.
  23062. * @param {*} srcValue The source value.
  23063. * @param {string} key The key of the property to merge.
  23064. * @param {Object} object The parent object of `objValue`.
  23065. * @param {Object} source The parent object of `srcValue`.
  23066. * @param {Object} [stack] Tracks traversed source values and their merged
  23067. * counterparts.
  23068. * @returns {*} Returns the value to assign.
  23069. */
  23070. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23071. if (isObject(objValue) && isObject(srcValue)) {
  23072. // Recursively merge objects and arrays (susceptible to call stack limits).
  23073. stack.set(srcValue, objValue);
  23074. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23075. stack['delete'](srcValue);
  23076. }
  23077. return objValue;
  23078. }
  23079. /**
  23080. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23081. * objects.
  23082. *
  23083. * @private
  23084. * @param {*} value The value to inspect.
  23085. * @param {string} key The key of the property to inspect.
  23086. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23087. */
  23088. function customOmitClone(value) {
  23089. return isPlainObject(value) ? undefined : value;
  23090. }
  23091. /**
  23092. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23093. * partial deep comparisons.
  23094. *
  23095. * @private
  23096. * @param {Array} array The array to compare.
  23097. * @param {Array} other The other array to compare.
  23098. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23099. * @param {Function} customizer The function to customize comparisons.
  23100. * @param {Function} equalFunc The function to determine equivalents of values.
  23101. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23102. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23103. */
  23104. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23105. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23106. arrLength = array.length,
  23107. othLength = other.length;
  23108. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23109. return false;
  23110. }
  23111. // Assume cyclic values are equal.
  23112. var stacked = stack.get(array);
  23113. if (stacked && stack.get(other)) {
  23114. return stacked == other;
  23115. }
  23116. var index = -1,
  23117. result = true,
  23118. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23119. stack.set(array, other);
  23120. stack.set(other, array);
  23121. // Ignore non-index properties.
  23122. while (++index < arrLength) {
  23123. var arrValue = array[index],
  23124. othValue = other[index];
  23125. if (customizer) {
  23126. var compared = isPartial
  23127. ? customizer(othValue, arrValue, index, other, array, stack)
  23128. : customizer(arrValue, othValue, index, array, other, stack);
  23129. }
  23130. if (compared !== undefined) {
  23131. if (compared) {
  23132. continue;
  23133. }
  23134. result = false;
  23135. break;
  23136. }
  23137. // Recursively compare arrays (susceptible to call stack limits).
  23138. if (seen) {
  23139. if (!arraySome(other, function(othValue, othIndex) {
  23140. if (!cacheHas(seen, othIndex) &&
  23141. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23142. return seen.push(othIndex);
  23143. }
  23144. })) {
  23145. result = false;
  23146. break;
  23147. }
  23148. } else if (!(
  23149. arrValue === othValue ||
  23150. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23151. )) {
  23152. result = false;
  23153. break;
  23154. }
  23155. }
  23156. stack['delete'](array);
  23157. stack['delete'](other);
  23158. return result;
  23159. }
  23160. /**
  23161. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23162. * the same `toStringTag`.
  23163. *
  23164. * **Note:** This function only supports comparing values with tags of
  23165. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23166. *
  23167. * @private
  23168. * @param {Object} object The object to compare.
  23169. * @param {Object} other The other object to compare.
  23170. * @param {string} tag The `toStringTag` of the objects to compare.
  23171. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23172. * @param {Function} customizer The function to customize comparisons.
  23173. * @param {Function} equalFunc The function to determine equivalents of values.
  23174. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23175. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23176. */
  23177. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23178. switch (tag) {
  23179. case dataViewTag:
  23180. if ((object.byteLength != other.byteLength) ||
  23181. (object.byteOffset != other.byteOffset)) {
  23182. return false;
  23183. }
  23184. object = object.buffer;
  23185. other = other.buffer;
  23186. case arrayBufferTag:
  23187. if ((object.byteLength != other.byteLength) ||
  23188. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23189. return false;
  23190. }
  23191. return true;
  23192. case boolTag:
  23193. case dateTag:
  23194. case numberTag:
  23195. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23196. // Invalid dates are coerced to `NaN`.
  23197. return eq(+object, +other);
  23198. case errorTag:
  23199. return object.name == other.name && object.message == other.message;
  23200. case regexpTag:
  23201. case stringTag:
  23202. // Coerce regexes to strings and treat strings, primitives and objects,
  23203. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23204. // for more details.
  23205. return object == (other + '');
  23206. case mapTag:
  23207. var convert = mapToArray;
  23208. case setTag:
  23209. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23210. convert || (convert = setToArray);
  23211. if (object.size != other.size && !isPartial) {
  23212. return false;
  23213. }
  23214. // Assume cyclic values are equal.
  23215. var stacked = stack.get(object);
  23216. if (stacked) {
  23217. return stacked == other;
  23218. }
  23219. bitmask |= COMPARE_UNORDERED_FLAG;
  23220. // Recursively compare objects (susceptible to call stack limits).
  23221. stack.set(object, other);
  23222. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23223. stack['delete'](object);
  23224. return result;
  23225. case symbolTag:
  23226. if (symbolValueOf) {
  23227. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23228. }
  23229. }
  23230. return false;
  23231. }
  23232. /**
  23233. * A specialized version of `baseIsEqualDeep` for objects with support for
  23234. * partial deep comparisons.
  23235. *
  23236. * @private
  23237. * @param {Object} object The object to compare.
  23238. * @param {Object} other The other object to compare.
  23239. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23240. * @param {Function} customizer The function to customize comparisons.
  23241. * @param {Function} equalFunc The function to determine equivalents of values.
  23242. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23243. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23244. */
  23245. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23246. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23247. objProps = getAllKeys(object),
  23248. objLength = objProps.length,
  23249. othProps = getAllKeys(other),
  23250. othLength = othProps.length;
  23251. if (objLength != othLength && !isPartial) {
  23252. return false;
  23253. }
  23254. var index = objLength;
  23255. while (index--) {
  23256. var key = objProps[index];
  23257. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23258. return false;
  23259. }
  23260. }
  23261. // Assume cyclic values are equal.
  23262. var stacked = stack.get(object);
  23263. if (stacked && stack.get(other)) {
  23264. return stacked == other;
  23265. }
  23266. var result = true;
  23267. stack.set(object, other);
  23268. stack.set(other, object);
  23269. var skipCtor = isPartial;
  23270. while (++index < objLength) {
  23271. key = objProps[index];
  23272. var objValue = object[key],
  23273. othValue = other[key];
  23274. if (customizer) {
  23275. var compared = isPartial
  23276. ? customizer(othValue, objValue, key, other, object, stack)
  23277. : customizer(objValue, othValue, key, object, other, stack);
  23278. }
  23279. // Recursively compare objects (susceptible to call stack limits).
  23280. if (!(compared === undefined
  23281. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23282. : compared
  23283. )) {
  23284. result = false;
  23285. break;
  23286. }
  23287. skipCtor || (skipCtor = key == 'constructor');
  23288. }
  23289. if (result && !skipCtor) {
  23290. var objCtor = object.constructor,
  23291. othCtor = other.constructor;
  23292. // Non `Object` object instances with different constructors are not equal.
  23293. if (objCtor != othCtor &&
  23294. ('constructor' in object && 'constructor' in other) &&
  23295. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23296. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23297. result = false;
  23298. }
  23299. }
  23300. stack['delete'](object);
  23301. stack['delete'](other);
  23302. return result;
  23303. }
  23304. /**
  23305. * A specialized version of `baseRest` which flattens the rest array.
  23306. *
  23307. * @private
  23308. * @param {Function} func The function to apply a rest parameter to.
  23309. * @returns {Function} Returns the new function.
  23310. */
  23311. function flatRest(func) {
  23312. return setToString(overRest(func, undefined, flatten), func + '');
  23313. }
  23314. /**
  23315. * Creates an array of own enumerable property names and symbols of `object`.
  23316. *
  23317. * @private
  23318. * @param {Object} object The object to query.
  23319. * @returns {Array} Returns the array of property names and symbols.
  23320. */
  23321. function getAllKeys(object) {
  23322. return baseGetAllKeys(object, keys, getSymbols);
  23323. }
  23324. /**
  23325. * Creates an array of own and inherited enumerable property names and
  23326. * symbols of `object`.
  23327. *
  23328. * @private
  23329. * @param {Object} object The object to query.
  23330. * @returns {Array} Returns the array of property names and symbols.
  23331. */
  23332. function getAllKeysIn(object) {
  23333. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23334. }
  23335. /**
  23336. * Gets metadata for `func`.
  23337. *
  23338. * @private
  23339. * @param {Function} func The function to query.
  23340. * @returns {*} Returns the metadata for `func`.
  23341. */
  23342. var getData = !metaMap ? noop : function(func) {
  23343. return metaMap.get(func);
  23344. };
  23345. /**
  23346. * Gets the name of `func`.
  23347. *
  23348. * @private
  23349. * @param {Function} func The function to query.
  23350. * @returns {string} Returns the function name.
  23351. */
  23352. function getFuncName(func) {
  23353. var result = (func.name + ''),
  23354. array = realNames[result],
  23355. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23356. while (length--) {
  23357. var data = array[length],
  23358. otherFunc = data.func;
  23359. if (otherFunc == null || otherFunc == func) {
  23360. return data.name;
  23361. }
  23362. }
  23363. return result;
  23364. }
  23365. /**
  23366. * Gets the argument placeholder value for `func`.
  23367. *
  23368. * @private
  23369. * @param {Function} func The function to inspect.
  23370. * @returns {*} Returns the placeholder value.
  23371. */
  23372. function getHolder(func) {
  23373. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23374. return object.placeholder;
  23375. }
  23376. /**
  23377. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23378. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23379. * If arguments are provided, the chosen function is invoked with them and
  23380. * its result is returned.
  23381. *
  23382. * @private
  23383. * @param {*} [value] The value to convert to an iteratee.
  23384. * @param {number} [arity] The arity of the created iteratee.
  23385. * @returns {Function} Returns the chosen function or its result.
  23386. */
  23387. function getIteratee() {
  23388. var result = lodash.iteratee || iteratee;
  23389. result = result === iteratee ? baseIteratee : result;
  23390. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23391. }
  23392. /**
  23393. * Gets the data for `map`.
  23394. *
  23395. * @private
  23396. * @param {Object} map The map to query.
  23397. * @param {string} key The reference key.
  23398. * @returns {*} Returns the map data.
  23399. */
  23400. function getMapData(map, key) {
  23401. var data = map.__data__;
  23402. return isKeyable(key)
  23403. ? data[typeof key == 'string' ? 'string' : 'hash']
  23404. : data.map;
  23405. }
  23406. /**
  23407. * Gets the property names, values, and compare flags of `object`.
  23408. *
  23409. * @private
  23410. * @param {Object} object The object to query.
  23411. * @returns {Array} Returns the match data of `object`.
  23412. */
  23413. function getMatchData(object) {
  23414. var result = keys(object),
  23415. length = result.length;
  23416. while (length--) {
  23417. var key = result[length],
  23418. value = object[key];
  23419. result[length] = [key, value, isStrictComparable(value)];
  23420. }
  23421. return result;
  23422. }
  23423. /**
  23424. * Gets the native function at `key` of `object`.
  23425. *
  23426. * @private
  23427. * @param {Object} object The object to query.
  23428. * @param {string} key The key of the method to get.
  23429. * @returns {*} Returns the function if it's native, else `undefined`.
  23430. */
  23431. function getNative(object, key) {
  23432. var value = getValue(object, key);
  23433. return baseIsNative(value) ? value : undefined;
  23434. }
  23435. /**
  23436. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23437. *
  23438. * @private
  23439. * @param {*} value The value to query.
  23440. * @returns {string} Returns the raw `toStringTag`.
  23441. */
  23442. function getRawTag(value) {
  23443. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23444. tag = value[symToStringTag];
  23445. try {
  23446. value[symToStringTag] = undefined;
  23447. var unmasked = true;
  23448. } catch (e) {}
  23449. var result = nativeObjectToString.call(value);
  23450. if (unmasked) {
  23451. if (isOwn) {
  23452. value[symToStringTag] = tag;
  23453. } else {
  23454. delete value[symToStringTag];
  23455. }
  23456. }
  23457. return result;
  23458. }
  23459. /**
  23460. * Creates an array of the own enumerable symbols of `object`.
  23461. *
  23462. * @private
  23463. * @param {Object} object The object to query.
  23464. * @returns {Array} Returns the array of symbols.
  23465. */
  23466. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23467. if (object == null) {
  23468. return [];
  23469. }
  23470. object = Object(object);
  23471. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23472. return propertyIsEnumerable.call(object, symbol);
  23473. });
  23474. };
  23475. /**
  23476. * Creates an array of the own and inherited enumerable symbols of `object`.
  23477. *
  23478. * @private
  23479. * @param {Object} object The object to query.
  23480. * @returns {Array} Returns the array of symbols.
  23481. */
  23482. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23483. var result = [];
  23484. while (object) {
  23485. arrayPush(result, getSymbols(object));
  23486. object = getPrototype(object);
  23487. }
  23488. return result;
  23489. };
  23490. /**
  23491. * Gets the `toStringTag` of `value`.
  23492. *
  23493. * @private
  23494. * @param {*} value The value to query.
  23495. * @returns {string} Returns the `toStringTag`.
  23496. */
  23497. var getTag = baseGetTag;
  23498. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23499. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23500. (Map && getTag(new Map) != mapTag) ||
  23501. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23502. (Set && getTag(new Set) != setTag) ||
  23503. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23504. getTag = function(value) {
  23505. var result = baseGetTag(value),
  23506. Ctor = result == objectTag ? value.constructor : undefined,
  23507. ctorString = Ctor ? toSource(Ctor) : '';
  23508. if (ctorString) {
  23509. switch (ctorString) {
  23510. case dataViewCtorString: return dataViewTag;
  23511. case mapCtorString: return mapTag;
  23512. case promiseCtorString: return promiseTag;
  23513. case setCtorString: return setTag;
  23514. case weakMapCtorString: return weakMapTag;
  23515. }
  23516. }
  23517. return result;
  23518. };
  23519. }
  23520. /**
  23521. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23522. *
  23523. * @private
  23524. * @param {number} start The start of the view.
  23525. * @param {number} end The end of the view.
  23526. * @param {Array} transforms The transformations to apply to the view.
  23527. * @returns {Object} Returns an object containing the `start` and `end`
  23528. * positions of the view.
  23529. */
  23530. function getView(start, end, transforms) {
  23531. var index = -1,
  23532. length = transforms.length;
  23533. while (++index < length) {
  23534. var data = transforms[index],
  23535. size = data.size;
  23536. switch (data.type) {
  23537. case 'drop': start += size; break;
  23538. case 'dropRight': end -= size; break;
  23539. case 'take': end = nativeMin(end, start + size); break;
  23540. case 'takeRight': start = nativeMax(start, end - size); break;
  23541. }
  23542. }
  23543. return { 'start': start, 'end': end };
  23544. }
  23545. /**
  23546. * Extracts wrapper details from the `source` body comment.
  23547. *
  23548. * @private
  23549. * @param {string} source The source to inspect.
  23550. * @returns {Array} Returns the wrapper details.
  23551. */
  23552. function getWrapDetails(source) {
  23553. var match = source.match(reWrapDetails);
  23554. return match ? match[1].split(reSplitDetails) : [];
  23555. }
  23556. /**
  23557. * Checks if `path` exists on `object`.
  23558. *
  23559. * @private
  23560. * @param {Object} object The object to query.
  23561. * @param {Array|string} path The path to check.
  23562. * @param {Function} hasFunc The function to check properties.
  23563. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23564. */
  23565. function hasPath(object, path, hasFunc) {
  23566. path = castPath(path, object);
  23567. var index = -1,
  23568. length = path.length,
  23569. result = false;
  23570. while (++index < length) {
  23571. var key = toKey(path[index]);
  23572. if (!(result = object != null && hasFunc(object, key))) {
  23573. break;
  23574. }
  23575. object = object[key];
  23576. }
  23577. if (result || ++index != length) {
  23578. return result;
  23579. }
  23580. length = object == null ? 0 : object.length;
  23581. return !!length && isLength(length) && isIndex(key, length) &&
  23582. (isArray(object) || isArguments(object));
  23583. }
  23584. /**
  23585. * Initializes an array clone.
  23586. *
  23587. * @private
  23588. * @param {Array} array The array to clone.
  23589. * @returns {Array} Returns the initialized clone.
  23590. */
  23591. function initCloneArray(array) {
  23592. var length = array.length,
  23593. result = new array.constructor(length);
  23594. // Add properties assigned by `RegExp#exec`.
  23595. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23596. result.index = array.index;
  23597. result.input = array.input;
  23598. }
  23599. return result;
  23600. }
  23601. /**
  23602. * Initializes an object clone.
  23603. *
  23604. * @private
  23605. * @param {Object} object The object to clone.
  23606. * @returns {Object} Returns the initialized clone.
  23607. */
  23608. function initCloneObject(object) {
  23609. return (typeof object.constructor == 'function' && !isPrototype(object))
  23610. ? baseCreate(getPrototype(object))
  23611. : {};
  23612. }
  23613. /**
  23614. * Initializes an object clone based on its `toStringTag`.
  23615. *
  23616. * **Note:** This function only supports cloning values with tags of
  23617. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23618. *
  23619. * @private
  23620. * @param {Object} object The object to clone.
  23621. * @param {string} tag The `toStringTag` of the object to clone.
  23622. * @param {boolean} [isDeep] Specify a deep clone.
  23623. * @returns {Object} Returns the initialized clone.
  23624. */
  23625. function initCloneByTag(object, tag, isDeep) {
  23626. var Ctor = object.constructor;
  23627. switch (tag) {
  23628. case arrayBufferTag:
  23629. return cloneArrayBuffer(object);
  23630. case boolTag:
  23631. case dateTag:
  23632. return new Ctor(+object);
  23633. case dataViewTag:
  23634. return cloneDataView(object, isDeep);
  23635. case float32Tag: case float64Tag:
  23636. case int8Tag: case int16Tag: case int32Tag:
  23637. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23638. return cloneTypedArray(object, isDeep);
  23639. case mapTag:
  23640. return new Ctor;
  23641. case numberTag:
  23642. case stringTag:
  23643. return new Ctor(object);
  23644. case regexpTag:
  23645. return cloneRegExp(object);
  23646. case setTag:
  23647. return new Ctor;
  23648. case symbolTag:
  23649. return cloneSymbol(object);
  23650. }
  23651. }
  23652. /**
  23653. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23654. *
  23655. * @private
  23656. * @param {string} source The source to modify.
  23657. * @returns {Array} details The details to insert.
  23658. * @returns {string} Returns the modified source.
  23659. */
  23660. function insertWrapDetails(source, details) {
  23661. var length = details.length;
  23662. if (!length) {
  23663. return source;
  23664. }
  23665. var lastIndex = length - 1;
  23666. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23667. details = details.join(length > 2 ? ', ' : ' ');
  23668. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23669. }
  23670. /**
  23671. * Checks if `value` is a flattenable `arguments` object or array.
  23672. *
  23673. * @private
  23674. * @param {*} value The value to check.
  23675. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23676. */
  23677. function isFlattenable(value) {
  23678. return isArray(value) || isArguments(value) ||
  23679. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23680. }
  23681. /**
  23682. * Checks if `value` is a valid array-like index.
  23683. *
  23684. * @private
  23685. * @param {*} value The value to check.
  23686. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23687. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23688. */
  23689. function isIndex(value, length) {
  23690. var type = typeof value;
  23691. length = length == null ? MAX_SAFE_INTEGER : length;
  23692. return !!length &&
  23693. (type == 'number' ||
  23694. (type != 'symbol' && reIsUint.test(value))) &&
  23695. (value > -1 && value % 1 == 0 && value < length);
  23696. }
  23697. /**
  23698. * Checks if the given arguments are from an iteratee call.
  23699. *
  23700. * @private
  23701. * @param {*} value The potential iteratee value argument.
  23702. * @param {*} index The potential iteratee index or key argument.
  23703. * @param {*} object The potential iteratee object argument.
  23704. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23705. * else `false`.
  23706. */
  23707. function isIterateeCall(value, index, object) {
  23708. if (!isObject(object)) {
  23709. return false;
  23710. }
  23711. var type = typeof index;
  23712. if (type == 'number'
  23713. ? (isArrayLike(object) && isIndex(index, object.length))
  23714. : (type == 'string' && index in object)
  23715. ) {
  23716. return eq(object[index], value);
  23717. }
  23718. return false;
  23719. }
  23720. /**
  23721. * Checks if `value` is a property name and not a property path.
  23722. *
  23723. * @private
  23724. * @param {*} value The value to check.
  23725. * @param {Object} [object] The object to query keys on.
  23726. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  23727. */
  23728. function isKey(value, object) {
  23729. if (isArray(value)) {
  23730. return false;
  23731. }
  23732. var type = typeof value;
  23733. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  23734. value == null || isSymbol(value)) {
  23735. return true;
  23736. }
  23737. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  23738. (object != null && value in Object(object));
  23739. }
  23740. /**
  23741. * Checks if `value` is suitable for use as unique object key.
  23742. *
  23743. * @private
  23744. * @param {*} value The value to check.
  23745. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  23746. */
  23747. function isKeyable(value) {
  23748. var type = typeof value;
  23749. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  23750. ? (value !== '__proto__')
  23751. : (value === null);
  23752. }
  23753. /**
  23754. * Checks if `func` has a lazy counterpart.
  23755. *
  23756. * @private
  23757. * @param {Function} func The function to check.
  23758. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  23759. * else `false`.
  23760. */
  23761. function isLaziable(func) {
  23762. var funcName = getFuncName(func),
  23763. other = lodash[funcName];
  23764. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  23765. return false;
  23766. }
  23767. if (func === other) {
  23768. return true;
  23769. }
  23770. var data = getData(other);
  23771. return !!data && func === data[0];
  23772. }
  23773. /**
  23774. * Checks if `func` has its source masked.
  23775. *
  23776. * @private
  23777. * @param {Function} func The function to check.
  23778. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  23779. */
  23780. function isMasked(func) {
  23781. return !!maskSrcKey && (maskSrcKey in func);
  23782. }
  23783. /**
  23784. * Checks if `func` is capable of being masked.
  23785. *
  23786. * @private
  23787. * @param {*} value The value to check.
  23788. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  23789. */
  23790. var isMaskable = coreJsData ? isFunction : stubFalse;
  23791. /**
  23792. * Checks if `value` is likely a prototype object.
  23793. *
  23794. * @private
  23795. * @param {*} value The value to check.
  23796. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  23797. */
  23798. function isPrototype(value) {
  23799. var Ctor = value && value.constructor,
  23800. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  23801. return value === proto;
  23802. }
  23803. /**
  23804. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  23805. *
  23806. * @private
  23807. * @param {*} value The value to check.
  23808. * @returns {boolean} Returns `true` if `value` if suitable for strict
  23809. * equality comparisons, else `false`.
  23810. */
  23811. function isStrictComparable(value) {
  23812. return value === value && !isObject(value);
  23813. }
  23814. /**
  23815. * A specialized version of `matchesProperty` for source values suitable
  23816. * for strict equality comparisons, i.e. `===`.
  23817. *
  23818. * @private
  23819. * @param {string} key The key of the property to get.
  23820. * @param {*} srcValue The value to match.
  23821. * @returns {Function} Returns the new spec function.
  23822. */
  23823. function matchesStrictComparable(key, srcValue) {
  23824. return function(object) {
  23825. if (object == null) {
  23826. return false;
  23827. }
  23828. return object[key] === srcValue &&
  23829. (srcValue !== undefined || (key in Object(object)));
  23830. };
  23831. }
  23832. /**
  23833. * A specialized version of `_.memoize` which clears the memoized function's
  23834. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  23835. *
  23836. * @private
  23837. * @param {Function} func The function to have its output memoized.
  23838. * @returns {Function} Returns the new memoized function.
  23839. */
  23840. function memoizeCapped(func) {
  23841. var result = memoize(func, function(key) {
  23842. if (cache.size === MAX_MEMOIZE_SIZE) {
  23843. cache.clear();
  23844. }
  23845. return key;
  23846. });
  23847. var cache = result.cache;
  23848. return result;
  23849. }
  23850. /**
  23851. * Merges the function metadata of `source` into `data`.
  23852. *
  23853. * Merging metadata reduces the number of wrappers used to invoke a function.
  23854. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  23855. * may be applied regardless of execution order. Methods like `_.ary` and
  23856. * `_.rearg` modify function arguments, making the order in which they are
  23857. * executed important, preventing the merging of metadata. However, we make
  23858. * an exception for a safe combined case where curried functions have `_.ary`
  23859. * and or `_.rearg` applied.
  23860. *
  23861. * @private
  23862. * @param {Array} data The destination metadata.
  23863. * @param {Array} source The source metadata.
  23864. * @returns {Array} Returns `data`.
  23865. */
  23866. function mergeData(data, source) {
  23867. var bitmask = data[1],
  23868. srcBitmask = source[1],
  23869. newBitmask = bitmask | srcBitmask,
  23870. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  23871. var isCombo =
  23872. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  23873. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  23874. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  23875. // Exit early if metadata can't be merged.
  23876. if (!(isCommon || isCombo)) {
  23877. return data;
  23878. }
  23879. // Use source `thisArg` if available.
  23880. if (srcBitmask & WRAP_BIND_FLAG) {
  23881. data[2] = source[2];
  23882. // Set when currying a bound function.
  23883. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  23884. }
  23885. // Compose partial arguments.
  23886. var value = source[3];
  23887. if (value) {
  23888. var partials = data[3];
  23889. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  23890. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  23891. }
  23892. // Compose partial right arguments.
  23893. value = source[5];
  23894. if (value) {
  23895. partials = data[5];
  23896. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  23897. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  23898. }
  23899. // Use source `argPos` if available.
  23900. value = source[7];
  23901. if (value) {
  23902. data[7] = value;
  23903. }
  23904. // Use source `ary` if it's smaller.
  23905. if (srcBitmask & WRAP_ARY_FLAG) {
  23906. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  23907. }
  23908. // Use source `arity` if one is not provided.
  23909. if (data[9] == null) {
  23910. data[9] = source[9];
  23911. }
  23912. // Use source `func` and merge bitmasks.
  23913. data[0] = source[0];
  23914. data[1] = newBitmask;
  23915. return data;
  23916. }
  23917. /**
  23918. * This function is like
  23919. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  23920. * except that it includes inherited enumerable properties.
  23921. *
  23922. * @private
  23923. * @param {Object} object The object to query.
  23924. * @returns {Array} Returns the array of property names.
  23925. */
  23926. function nativeKeysIn(object) {
  23927. var result = [];
  23928. if (object != null) {
  23929. for (var key in Object(object)) {
  23930. result.push(key);
  23931. }
  23932. }
  23933. return result;
  23934. }
  23935. /**
  23936. * Converts `value` to a string using `Object.prototype.toString`.
  23937. *
  23938. * @private
  23939. * @param {*} value The value to convert.
  23940. * @returns {string} Returns the converted string.
  23941. */
  23942. function objectToString(value) {
  23943. return nativeObjectToString.call(value);
  23944. }
  23945. /**
  23946. * A specialized version of `baseRest` which transforms the rest array.
  23947. *
  23948. * @private
  23949. * @param {Function} func The function to apply a rest parameter to.
  23950. * @param {number} [start=func.length-1] The start position of the rest parameter.
  23951. * @param {Function} transform The rest array transform.
  23952. * @returns {Function} Returns the new function.
  23953. */
  23954. function overRest(func, start, transform) {
  23955. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  23956. return function() {
  23957. var args = arguments,
  23958. index = -1,
  23959. length = nativeMax(args.length - start, 0),
  23960. array = Array(length);
  23961. while (++index < length) {
  23962. array[index] = args[start + index];
  23963. }
  23964. index = -1;
  23965. var otherArgs = Array(start + 1);
  23966. while (++index < start) {
  23967. otherArgs[index] = args[index];
  23968. }
  23969. otherArgs[start] = transform(array);
  23970. return apply(func, this, otherArgs);
  23971. };
  23972. }
  23973. /**
  23974. * Gets the parent value at `path` of `object`.
  23975. *
  23976. * @private
  23977. * @param {Object} object The object to query.
  23978. * @param {Array} path The path to get the parent value of.
  23979. * @returns {*} Returns the parent value.
  23980. */
  23981. function parent(object, path) {
  23982. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  23983. }
  23984. /**
  23985. * Reorder `array` according to the specified indexes where the element at
  23986. * the first index is assigned as the first element, the element at
  23987. * the second index is assigned as the second element, and so on.
  23988. *
  23989. * @private
  23990. * @param {Array} array The array to reorder.
  23991. * @param {Array} indexes The arranged array indexes.
  23992. * @returns {Array} Returns `array`.
  23993. */
  23994. function reorder(array, indexes) {
  23995. var arrLength = array.length,
  23996. length = nativeMin(indexes.length, arrLength),
  23997. oldArray = copyArray(array);
  23998. while (length--) {
  23999. var index = indexes[length];
  24000. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24001. }
  24002. return array;
  24003. }
  24004. /**
  24005. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24006. *
  24007. * @private
  24008. * @param {Object} object The object to query.
  24009. * @param {string} key The key of the property to get.
  24010. * @returns {*} Returns the property value.
  24011. */
  24012. function safeGet(object, key) {
  24013. if (key === 'constructor' && typeof object[key] === 'function') {
  24014. return;
  24015. }
  24016. if (key == '__proto__') {
  24017. return;
  24018. }
  24019. return object[key];
  24020. }
  24021. /**
  24022. * Sets metadata for `func`.
  24023. *
  24024. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24025. * period of time, it will trip its breaker and transition to an identity
  24026. * function to avoid garbage collection pauses in V8. See
  24027. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24028. * for more details.
  24029. *
  24030. * @private
  24031. * @param {Function} func The function to associate metadata with.
  24032. * @param {*} data The metadata.
  24033. * @returns {Function} Returns `func`.
  24034. */
  24035. var setData = shortOut(baseSetData);
  24036. /**
  24037. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24038. *
  24039. * @private
  24040. * @param {Function} func The function to delay.
  24041. * @param {number} wait The number of milliseconds to delay invocation.
  24042. * @returns {number|Object} Returns the timer id or timeout object.
  24043. */
  24044. var setTimeout = ctxSetTimeout || function(func, wait) {
  24045. return root.setTimeout(func, wait);
  24046. };
  24047. /**
  24048. * Sets the `toString` method of `func` to return `string`.
  24049. *
  24050. * @private
  24051. * @param {Function} func The function to modify.
  24052. * @param {Function} string The `toString` result.
  24053. * @returns {Function} Returns `func`.
  24054. */
  24055. var setToString = shortOut(baseSetToString);
  24056. /**
  24057. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24058. * with wrapper details in a comment at the top of the source body.
  24059. *
  24060. * @private
  24061. * @param {Function} wrapper The function to modify.
  24062. * @param {Function} reference The reference function.
  24063. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24064. * @returns {Function} Returns `wrapper`.
  24065. */
  24066. function setWrapToString(wrapper, reference, bitmask) {
  24067. var source = (reference + '');
  24068. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24069. }
  24070. /**
  24071. * Creates a function that'll short out and invoke `identity` instead
  24072. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24073. * milliseconds.
  24074. *
  24075. * @private
  24076. * @param {Function} func The function to restrict.
  24077. * @returns {Function} Returns the new shortable function.
  24078. */
  24079. function shortOut(func) {
  24080. var count = 0,
  24081. lastCalled = 0;
  24082. return function() {
  24083. var stamp = nativeNow(),
  24084. remaining = HOT_SPAN - (stamp - lastCalled);
  24085. lastCalled = stamp;
  24086. if (remaining > 0) {
  24087. if (++count >= HOT_COUNT) {
  24088. return arguments[0];
  24089. }
  24090. } else {
  24091. count = 0;
  24092. }
  24093. return func.apply(undefined, arguments);
  24094. };
  24095. }
  24096. /**
  24097. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24098. *
  24099. * @private
  24100. * @param {Array} array The array to shuffle.
  24101. * @param {number} [size=array.length] The size of `array`.
  24102. * @returns {Array} Returns `array`.
  24103. */
  24104. function shuffleSelf(array, size) {
  24105. var index = -1,
  24106. length = array.length,
  24107. lastIndex = length - 1;
  24108. size = size === undefined ? length : size;
  24109. while (++index < size) {
  24110. var rand = baseRandom(index, lastIndex),
  24111. value = array[rand];
  24112. array[rand] = array[index];
  24113. array[index] = value;
  24114. }
  24115. array.length = size;
  24116. return array;
  24117. }
  24118. /**
  24119. * Converts `string` to a property path array.
  24120. *
  24121. * @private
  24122. * @param {string} string The string to convert.
  24123. * @returns {Array} Returns the property path array.
  24124. */
  24125. var stringToPath = memoizeCapped(function(string) {
  24126. var result = [];
  24127. if (string.charCodeAt(0) === 46 /* . */) {
  24128. result.push('');
  24129. }
  24130. string.replace(rePropName, function(match, number, quote, subString) {
  24131. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24132. });
  24133. return result;
  24134. });
  24135. /**
  24136. * Converts `value` to a string key if it's not a string or symbol.
  24137. *
  24138. * @private
  24139. * @param {*} value The value to inspect.
  24140. * @returns {string|symbol} Returns the key.
  24141. */
  24142. function toKey(value) {
  24143. if (typeof value == 'string' || isSymbol(value)) {
  24144. return value;
  24145. }
  24146. var result = (value + '');
  24147. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24148. }
  24149. /**
  24150. * Converts `func` to its source code.
  24151. *
  24152. * @private
  24153. * @param {Function} func The function to convert.
  24154. * @returns {string} Returns the source code.
  24155. */
  24156. function toSource(func) {
  24157. if (func != null) {
  24158. try {
  24159. return funcToString.call(func);
  24160. } catch (e) {}
  24161. try {
  24162. return (func + '');
  24163. } catch (e) {}
  24164. }
  24165. return '';
  24166. }
  24167. /**
  24168. * Updates wrapper `details` based on `bitmask` flags.
  24169. *
  24170. * @private
  24171. * @returns {Array} details The details to modify.
  24172. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24173. * @returns {Array} Returns `details`.
  24174. */
  24175. function updateWrapDetails(details, bitmask) {
  24176. arrayEach(wrapFlags, function(pair) {
  24177. var value = '_.' + pair[0];
  24178. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24179. details.push(value);
  24180. }
  24181. });
  24182. return details.sort();
  24183. }
  24184. /**
  24185. * Creates a clone of `wrapper`.
  24186. *
  24187. * @private
  24188. * @param {Object} wrapper The wrapper to clone.
  24189. * @returns {Object} Returns the cloned wrapper.
  24190. */
  24191. function wrapperClone(wrapper) {
  24192. if (wrapper instanceof LazyWrapper) {
  24193. return wrapper.clone();
  24194. }
  24195. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24196. result.__actions__ = copyArray(wrapper.__actions__);
  24197. result.__index__ = wrapper.__index__;
  24198. result.__values__ = wrapper.__values__;
  24199. return result;
  24200. }
  24201. /*------------------------------------------------------------------------*/
  24202. /**
  24203. * Creates an array of elements split into groups the length of `size`.
  24204. * If `array` can't be split evenly, the final chunk will be the remaining
  24205. * elements.
  24206. *
  24207. * @static
  24208. * @memberOf _
  24209. * @since 3.0.0
  24210. * @category Array
  24211. * @param {Array} array The array to process.
  24212. * @param {number} [size=1] The length of each chunk
  24213. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24214. * @returns {Array} Returns the new array of chunks.
  24215. * @example
  24216. *
  24217. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24218. * // => [['a', 'b'], ['c', 'd']]
  24219. *
  24220. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24221. * // => [['a', 'b', 'c'], ['d']]
  24222. */
  24223. function chunk(array, size, guard) {
  24224. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24225. size = 1;
  24226. } else {
  24227. size = nativeMax(toInteger(size), 0);
  24228. }
  24229. var length = array == null ? 0 : array.length;
  24230. if (!length || size < 1) {
  24231. return [];
  24232. }
  24233. var index = 0,
  24234. resIndex = 0,
  24235. result = Array(nativeCeil(length / size));
  24236. while (index < length) {
  24237. result[resIndex++] = baseSlice(array, index, (index += size));
  24238. }
  24239. return result;
  24240. }
  24241. /**
  24242. * Creates an array with all falsey values removed. The values `false`, `null`,
  24243. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24244. *
  24245. * @static
  24246. * @memberOf _
  24247. * @since 0.1.0
  24248. * @category Array
  24249. * @param {Array} array The array to compact.
  24250. * @returns {Array} Returns the new array of filtered values.
  24251. * @example
  24252. *
  24253. * _.compact([0, 1, false, 2, '', 3]);
  24254. * // => [1, 2, 3]
  24255. */
  24256. function compact(array) {
  24257. var index = -1,
  24258. length = array == null ? 0 : array.length,
  24259. resIndex = 0,
  24260. result = [];
  24261. while (++index < length) {
  24262. var value = array[index];
  24263. if (value) {
  24264. result[resIndex++] = value;
  24265. }
  24266. }
  24267. return result;
  24268. }
  24269. /**
  24270. * Creates a new array concatenating `array` with any additional arrays
  24271. * and/or values.
  24272. *
  24273. * @static
  24274. * @memberOf _
  24275. * @since 4.0.0
  24276. * @category Array
  24277. * @param {Array} array The array to concatenate.
  24278. * @param {...*} [values] The values to concatenate.
  24279. * @returns {Array} Returns the new concatenated array.
  24280. * @example
  24281. *
  24282. * var array = [1];
  24283. * var other = _.concat(array, 2, [3], [[4]]);
  24284. *
  24285. * console.log(other);
  24286. * // => [1, 2, 3, [4]]
  24287. *
  24288. * console.log(array);
  24289. * // => [1]
  24290. */
  24291. function concat() {
  24292. var length = arguments.length;
  24293. if (!length) {
  24294. return [];
  24295. }
  24296. var args = Array(length - 1),
  24297. array = arguments[0],
  24298. index = length;
  24299. while (index--) {
  24300. args[index - 1] = arguments[index];
  24301. }
  24302. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24303. }
  24304. /**
  24305. * Creates an array of `array` values not included in the other given arrays
  24306. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24307. * for equality comparisons. The order and references of result values are
  24308. * determined by the first array.
  24309. *
  24310. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24311. *
  24312. * @static
  24313. * @memberOf _
  24314. * @since 0.1.0
  24315. * @category Array
  24316. * @param {Array} array The array to inspect.
  24317. * @param {...Array} [values] The values to exclude.
  24318. * @returns {Array} Returns the new array of filtered values.
  24319. * @see _.without, _.xor
  24320. * @example
  24321. *
  24322. * _.difference([2, 1], [2, 3]);
  24323. * // => [1]
  24324. */
  24325. var difference = baseRest(function(array, values) {
  24326. return isArrayLikeObject(array)
  24327. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24328. : [];
  24329. });
  24330. /**
  24331. * This method is like `_.difference` except that it accepts `iteratee` which
  24332. * is invoked for each element of `array` and `values` to generate the criterion
  24333. * by which they're compared. The order and references of result values are
  24334. * determined by the first array. The iteratee is invoked with one argument:
  24335. * (value).
  24336. *
  24337. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24338. *
  24339. * @static
  24340. * @memberOf _
  24341. * @since 4.0.0
  24342. * @category Array
  24343. * @param {Array} array The array to inspect.
  24344. * @param {...Array} [values] The values to exclude.
  24345. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24346. * @returns {Array} Returns the new array of filtered values.
  24347. * @example
  24348. *
  24349. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24350. * // => [1.2]
  24351. *
  24352. * // The `_.property` iteratee shorthand.
  24353. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24354. * // => [{ 'x': 2 }]
  24355. */
  24356. var differenceBy = baseRest(function(array, values) {
  24357. var iteratee = last(values);
  24358. if (isArrayLikeObject(iteratee)) {
  24359. iteratee = undefined;
  24360. }
  24361. return isArrayLikeObject(array)
  24362. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24363. : [];
  24364. });
  24365. /**
  24366. * This method is like `_.difference` except that it accepts `comparator`
  24367. * which is invoked to compare elements of `array` to `values`. The order and
  24368. * references of result values are determined by the first array. The comparator
  24369. * is invoked with two arguments: (arrVal, othVal).
  24370. *
  24371. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24372. *
  24373. * @static
  24374. * @memberOf _
  24375. * @since 4.0.0
  24376. * @category Array
  24377. * @param {Array} array The array to inspect.
  24378. * @param {...Array} [values] The values to exclude.
  24379. * @param {Function} [comparator] The comparator invoked per element.
  24380. * @returns {Array} Returns the new array of filtered values.
  24381. * @example
  24382. *
  24383. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24384. *
  24385. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24386. * // => [{ 'x': 2, 'y': 1 }]
  24387. */
  24388. var differenceWith = baseRest(function(array, values) {
  24389. var comparator = last(values);
  24390. if (isArrayLikeObject(comparator)) {
  24391. comparator = undefined;
  24392. }
  24393. return isArrayLikeObject(array)
  24394. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24395. : [];
  24396. });
  24397. /**
  24398. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24399. *
  24400. * @static
  24401. * @memberOf _
  24402. * @since 0.5.0
  24403. * @category Array
  24404. * @param {Array} array The array to query.
  24405. * @param {number} [n=1] The number of elements to drop.
  24406. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24407. * @returns {Array} Returns the slice of `array`.
  24408. * @example
  24409. *
  24410. * _.drop([1, 2, 3]);
  24411. * // => [2, 3]
  24412. *
  24413. * _.drop([1, 2, 3], 2);
  24414. * // => [3]
  24415. *
  24416. * _.drop([1, 2, 3], 5);
  24417. * // => []
  24418. *
  24419. * _.drop([1, 2, 3], 0);
  24420. * // => [1, 2, 3]
  24421. */
  24422. function drop(array, n, guard) {
  24423. var length = array == null ? 0 : array.length;
  24424. if (!length) {
  24425. return [];
  24426. }
  24427. n = (guard || n === undefined) ? 1 : toInteger(n);
  24428. return baseSlice(array, n < 0 ? 0 : n, length);
  24429. }
  24430. /**
  24431. * Creates a slice of `array` with `n` elements dropped from the end.
  24432. *
  24433. * @static
  24434. * @memberOf _
  24435. * @since 3.0.0
  24436. * @category Array
  24437. * @param {Array} array The array to query.
  24438. * @param {number} [n=1] The number of elements to drop.
  24439. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24440. * @returns {Array} Returns the slice of `array`.
  24441. * @example
  24442. *
  24443. * _.dropRight([1, 2, 3]);
  24444. * // => [1, 2]
  24445. *
  24446. * _.dropRight([1, 2, 3], 2);
  24447. * // => [1]
  24448. *
  24449. * _.dropRight([1, 2, 3], 5);
  24450. * // => []
  24451. *
  24452. * _.dropRight([1, 2, 3], 0);
  24453. * // => [1, 2, 3]
  24454. */
  24455. function dropRight(array, n, guard) {
  24456. var length = array == null ? 0 : array.length;
  24457. if (!length) {
  24458. return [];
  24459. }
  24460. n = (guard || n === undefined) ? 1 : toInteger(n);
  24461. n = length - n;
  24462. return baseSlice(array, 0, n < 0 ? 0 : n);
  24463. }
  24464. /**
  24465. * Creates a slice of `array` excluding elements dropped from the end.
  24466. * Elements are dropped until `predicate` returns falsey. The predicate is
  24467. * invoked with three arguments: (value, index, array).
  24468. *
  24469. * @static
  24470. * @memberOf _
  24471. * @since 3.0.0
  24472. * @category Array
  24473. * @param {Array} array The array to query.
  24474. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24475. * @returns {Array} Returns the slice of `array`.
  24476. * @example
  24477. *
  24478. * var users = [
  24479. * { 'user': 'barney', 'active': true },
  24480. * { 'user': 'fred', 'active': false },
  24481. * { 'user': 'pebbles', 'active': false }
  24482. * ];
  24483. *
  24484. * _.dropRightWhile(users, function(o) { return !o.active; });
  24485. * // => objects for ['barney']
  24486. *
  24487. * // The `_.matches` iteratee shorthand.
  24488. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24489. * // => objects for ['barney', 'fred']
  24490. *
  24491. * // The `_.matchesProperty` iteratee shorthand.
  24492. * _.dropRightWhile(users, ['active', false]);
  24493. * // => objects for ['barney']
  24494. *
  24495. * // The `_.property` iteratee shorthand.
  24496. * _.dropRightWhile(users, 'active');
  24497. * // => objects for ['barney', 'fred', 'pebbles']
  24498. */
  24499. function dropRightWhile(array, predicate) {
  24500. return (array && array.length)
  24501. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24502. : [];
  24503. }
  24504. /**
  24505. * Creates a slice of `array` excluding elements dropped from the beginning.
  24506. * Elements are dropped until `predicate` returns falsey. The predicate is
  24507. * invoked with three arguments: (value, index, array).
  24508. *
  24509. * @static
  24510. * @memberOf _
  24511. * @since 3.0.0
  24512. * @category Array
  24513. * @param {Array} array The array to query.
  24514. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24515. * @returns {Array} Returns the slice of `array`.
  24516. * @example
  24517. *
  24518. * var users = [
  24519. * { 'user': 'barney', 'active': false },
  24520. * { 'user': 'fred', 'active': false },
  24521. * { 'user': 'pebbles', 'active': true }
  24522. * ];
  24523. *
  24524. * _.dropWhile(users, function(o) { return !o.active; });
  24525. * // => objects for ['pebbles']
  24526. *
  24527. * // The `_.matches` iteratee shorthand.
  24528. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24529. * // => objects for ['fred', 'pebbles']
  24530. *
  24531. * // The `_.matchesProperty` iteratee shorthand.
  24532. * _.dropWhile(users, ['active', false]);
  24533. * // => objects for ['pebbles']
  24534. *
  24535. * // The `_.property` iteratee shorthand.
  24536. * _.dropWhile(users, 'active');
  24537. * // => objects for ['barney', 'fred', 'pebbles']
  24538. */
  24539. function dropWhile(array, predicate) {
  24540. return (array && array.length)
  24541. ? baseWhile(array, getIteratee(predicate, 3), true)
  24542. : [];
  24543. }
  24544. /**
  24545. * Fills elements of `array` with `value` from `start` up to, but not
  24546. * including, `end`.
  24547. *
  24548. * **Note:** This method mutates `array`.
  24549. *
  24550. * @static
  24551. * @memberOf _
  24552. * @since 3.2.0
  24553. * @category Array
  24554. * @param {Array} array The array to fill.
  24555. * @param {*} value The value to fill `array` with.
  24556. * @param {number} [start=0] The start position.
  24557. * @param {number} [end=array.length] The end position.
  24558. * @returns {Array} Returns `array`.
  24559. * @example
  24560. *
  24561. * var array = [1, 2, 3];
  24562. *
  24563. * _.fill(array, 'a');
  24564. * console.log(array);
  24565. * // => ['a', 'a', 'a']
  24566. *
  24567. * _.fill(Array(3), 2);
  24568. * // => [2, 2, 2]
  24569. *
  24570. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24571. * // => [4, '*', '*', 10]
  24572. */
  24573. function fill(array, value, start, end) {
  24574. var length = array == null ? 0 : array.length;
  24575. if (!length) {
  24576. return [];
  24577. }
  24578. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24579. start = 0;
  24580. end = length;
  24581. }
  24582. return baseFill(array, value, start, end);
  24583. }
  24584. /**
  24585. * This method is like `_.find` except that it returns the index of the first
  24586. * element `predicate` returns truthy for instead of the element itself.
  24587. *
  24588. * @static
  24589. * @memberOf _
  24590. * @since 1.1.0
  24591. * @category Array
  24592. * @param {Array} array The array to inspect.
  24593. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24594. * @param {number} [fromIndex=0] The index to search from.
  24595. * @returns {number} Returns the index of the found element, else `-1`.
  24596. * @example
  24597. *
  24598. * var users = [
  24599. * { 'user': 'barney', 'active': false },
  24600. * { 'user': 'fred', 'active': false },
  24601. * { 'user': 'pebbles', 'active': true }
  24602. * ];
  24603. *
  24604. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24605. * // => 0
  24606. *
  24607. * // The `_.matches` iteratee shorthand.
  24608. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24609. * // => 1
  24610. *
  24611. * // The `_.matchesProperty` iteratee shorthand.
  24612. * _.findIndex(users, ['active', false]);
  24613. * // => 0
  24614. *
  24615. * // The `_.property` iteratee shorthand.
  24616. * _.findIndex(users, 'active');
  24617. * // => 2
  24618. */
  24619. function findIndex(array, predicate, fromIndex) {
  24620. var length = array == null ? 0 : array.length;
  24621. if (!length) {
  24622. return -1;
  24623. }
  24624. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24625. if (index < 0) {
  24626. index = nativeMax(length + index, 0);
  24627. }
  24628. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24629. }
  24630. /**
  24631. * This method is like `_.findIndex` except that it iterates over elements
  24632. * of `collection` from right to left.
  24633. *
  24634. * @static
  24635. * @memberOf _
  24636. * @since 2.0.0
  24637. * @category Array
  24638. * @param {Array} array The array to inspect.
  24639. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24640. * @param {number} [fromIndex=array.length-1] The index to search from.
  24641. * @returns {number} Returns the index of the found element, else `-1`.
  24642. * @example
  24643. *
  24644. * var users = [
  24645. * { 'user': 'barney', 'active': true },
  24646. * { 'user': 'fred', 'active': false },
  24647. * { 'user': 'pebbles', 'active': false }
  24648. * ];
  24649. *
  24650. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24651. * // => 2
  24652. *
  24653. * // The `_.matches` iteratee shorthand.
  24654. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24655. * // => 0
  24656. *
  24657. * // The `_.matchesProperty` iteratee shorthand.
  24658. * _.findLastIndex(users, ['active', false]);
  24659. * // => 2
  24660. *
  24661. * // The `_.property` iteratee shorthand.
  24662. * _.findLastIndex(users, 'active');
  24663. * // => 0
  24664. */
  24665. function findLastIndex(array, predicate, fromIndex) {
  24666. var length = array == null ? 0 : array.length;
  24667. if (!length) {
  24668. return -1;
  24669. }
  24670. var index = length - 1;
  24671. if (fromIndex !== undefined) {
  24672. index = toInteger(fromIndex);
  24673. index = fromIndex < 0
  24674. ? nativeMax(length + index, 0)
  24675. : nativeMin(index, length - 1);
  24676. }
  24677. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24678. }
  24679. /**
  24680. * Flattens `array` a single level deep.
  24681. *
  24682. * @static
  24683. * @memberOf _
  24684. * @since 0.1.0
  24685. * @category Array
  24686. * @param {Array} array The array to flatten.
  24687. * @returns {Array} Returns the new flattened array.
  24688. * @example
  24689. *
  24690. * _.flatten([1, [2, [3, [4]], 5]]);
  24691. * // => [1, 2, [3, [4]], 5]
  24692. */
  24693. function flatten(array) {
  24694. var length = array == null ? 0 : array.length;
  24695. return length ? baseFlatten(array, 1) : [];
  24696. }
  24697. /**
  24698. * Recursively flattens `array`.
  24699. *
  24700. * @static
  24701. * @memberOf _
  24702. * @since 3.0.0
  24703. * @category Array
  24704. * @param {Array} array The array to flatten.
  24705. * @returns {Array} Returns the new flattened array.
  24706. * @example
  24707. *
  24708. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24709. * // => [1, 2, 3, 4, 5]
  24710. */
  24711. function flattenDeep(array) {
  24712. var length = array == null ? 0 : array.length;
  24713. return length ? baseFlatten(array, INFINITY) : [];
  24714. }
  24715. /**
  24716. * Recursively flatten `array` up to `depth` times.
  24717. *
  24718. * @static
  24719. * @memberOf _
  24720. * @since 4.4.0
  24721. * @category Array
  24722. * @param {Array} array The array to flatten.
  24723. * @param {number} [depth=1] The maximum recursion depth.
  24724. * @returns {Array} Returns the new flattened array.
  24725. * @example
  24726. *
  24727. * var array = [1, [2, [3, [4]], 5]];
  24728. *
  24729. * _.flattenDepth(array, 1);
  24730. * // => [1, 2, [3, [4]], 5]
  24731. *
  24732. * _.flattenDepth(array, 2);
  24733. * // => [1, 2, 3, [4], 5]
  24734. */
  24735. function flattenDepth(array, depth) {
  24736. var length = array == null ? 0 : array.length;
  24737. if (!length) {
  24738. return [];
  24739. }
  24740. depth = depth === undefined ? 1 : toInteger(depth);
  24741. return baseFlatten(array, depth);
  24742. }
  24743. /**
  24744. * The inverse of `_.toPairs`; this method returns an object composed
  24745. * from key-value `pairs`.
  24746. *
  24747. * @static
  24748. * @memberOf _
  24749. * @since 4.0.0
  24750. * @category Array
  24751. * @param {Array} pairs The key-value pairs.
  24752. * @returns {Object} Returns the new object.
  24753. * @example
  24754. *
  24755. * _.fromPairs([['a', 1], ['b', 2]]);
  24756. * // => { 'a': 1, 'b': 2 }
  24757. */
  24758. function fromPairs(pairs) {
  24759. var index = -1,
  24760. length = pairs == null ? 0 : pairs.length,
  24761. result = {};
  24762. while (++index < length) {
  24763. var pair = pairs[index];
  24764. result[pair[0]] = pair[1];
  24765. }
  24766. return result;
  24767. }
  24768. /**
  24769. * Gets the first element of `array`.
  24770. *
  24771. * @static
  24772. * @memberOf _
  24773. * @since 0.1.0
  24774. * @alias first
  24775. * @category Array
  24776. * @param {Array} array The array to query.
  24777. * @returns {*} Returns the first element of `array`.
  24778. * @example
  24779. *
  24780. * _.head([1, 2, 3]);
  24781. * // => 1
  24782. *
  24783. * _.head([]);
  24784. * // => undefined
  24785. */
  24786. function head(array) {
  24787. return (array && array.length) ? array[0] : undefined;
  24788. }
  24789. /**
  24790. * Gets the index at which the first occurrence of `value` is found in `array`
  24791. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24792. * for equality comparisons. If `fromIndex` is negative, it's used as the
  24793. * offset from the end of `array`.
  24794. *
  24795. * @static
  24796. * @memberOf _
  24797. * @since 0.1.0
  24798. * @category Array
  24799. * @param {Array} array The array to inspect.
  24800. * @param {*} value The value to search for.
  24801. * @param {number} [fromIndex=0] The index to search from.
  24802. * @returns {number} Returns the index of the matched value, else `-1`.
  24803. * @example
  24804. *
  24805. * _.indexOf([1, 2, 1, 2], 2);
  24806. * // => 1
  24807. *
  24808. * // Search from the `fromIndex`.
  24809. * _.indexOf([1, 2, 1, 2], 2, 2);
  24810. * // => 3
  24811. */
  24812. function indexOf(array, value, fromIndex) {
  24813. var length = array == null ? 0 : array.length;
  24814. if (!length) {
  24815. return -1;
  24816. }
  24817. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24818. if (index < 0) {
  24819. index = nativeMax(length + index, 0);
  24820. }
  24821. return baseIndexOf(array, value, index);
  24822. }
  24823. /**
  24824. * Gets all but the last element of `array`.
  24825. *
  24826. * @static
  24827. * @memberOf _
  24828. * @since 0.1.0
  24829. * @category Array
  24830. * @param {Array} array The array to query.
  24831. * @returns {Array} Returns the slice of `array`.
  24832. * @example
  24833. *
  24834. * _.initial([1, 2, 3]);
  24835. * // => [1, 2]
  24836. */
  24837. function initial(array) {
  24838. var length = array == null ? 0 : array.length;
  24839. return length ? baseSlice(array, 0, -1) : [];
  24840. }
  24841. /**
  24842. * Creates an array of unique values that are included in all given arrays
  24843. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24844. * for equality comparisons. The order and references of result values are
  24845. * determined by the first array.
  24846. *
  24847. * @static
  24848. * @memberOf _
  24849. * @since 0.1.0
  24850. * @category Array
  24851. * @param {...Array} [arrays] The arrays to inspect.
  24852. * @returns {Array} Returns the new array of intersecting values.
  24853. * @example
  24854. *
  24855. * _.intersection([2, 1], [2, 3]);
  24856. * // => [2]
  24857. */
  24858. var intersection = baseRest(function(arrays) {
  24859. var mapped = arrayMap(arrays, castArrayLikeObject);
  24860. return (mapped.length && mapped[0] === arrays[0])
  24861. ? baseIntersection(mapped)
  24862. : [];
  24863. });
  24864. /**
  24865. * This method is like `_.intersection` except that it accepts `iteratee`
  24866. * which is invoked for each element of each `arrays` to generate the criterion
  24867. * by which they're compared. The order and references of result values are
  24868. * determined by the first array. The iteratee is invoked with one argument:
  24869. * (value).
  24870. *
  24871. * @static
  24872. * @memberOf _
  24873. * @since 4.0.0
  24874. * @category Array
  24875. * @param {...Array} [arrays] The arrays to inspect.
  24876. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24877. * @returns {Array} Returns the new array of intersecting values.
  24878. * @example
  24879. *
  24880. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24881. * // => [2.1]
  24882. *
  24883. * // The `_.property` iteratee shorthand.
  24884. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  24885. * // => [{ 'x': 1 }]
  24886. */
  24887. var intersectionBy = baseRest(function(arrays) {
  24888. var iteratee = last(arrays),
  24889. mapped = arrayMap(arrays, castArrayLikeObject);
  24890. if (iteratee === last(mapped)) {
  24891. iteratee = undefined;
  24892. } else {
  24893. mapped.pop();
  24894. }
  24895. return (mapped.length && mapped[0] === arrays[0])
  24896. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  24897. : [];
  24898. });
  24899. /**
  24900. * This method is like `_.intersection` except that it accepts `comparator`
  24901. * which is invoked to compare elements of `arrays`. The order and references
  24902. * of result values are determined by the first array. The comparator is
  24903. * invoked with two arguments: (arrVal, othVal).
  24904. *
  24905. * @static
  24906. * @memberOf _
  24907. * @since 4.0.0
  24908. * @category Array
  24909. * @param {...Array} [arrays] The arrays to inspect.
  24910. * @param {Function} [comparator] The comparator invoked per element.
  24911. * @returns {Array} Returns the new array of intersecting values.
  24912. * @example
  24913. *
  24914. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24915. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  24916. *
  24917. * _.intersectionWith(objects, others, _.isEqual);
  24918. * // => [{ 'x': 1, 'y': 2 }]
  24919. */
  24920. var intersectionWith = baseRest(function(arrays) {
  24921. var comparator = last(arrays),
  24922. mapped = arrayMap(arrays, castArrayLikeObject);
  24923. comparator = typeof comparator == 'function' ? comparator : undefined;
  24924. if (comparator) {
  24925. mapped.pop();
  24926. }
  24927. return (mapped.length && mapped[0] === arrays[0])
  24928. ? baseIntersection(mapped, undefined, comparator)
  24929. : [];
  24930. });
  24931. /**
  24932. * Converts all elements in `array` into a string separated by `separator`.
  24933. *
  24934. * @static
  24935. * @memberOf _
  24936. * @since 4.0.0
  24937. * @category Array
  24938. * @param {Array} array The array to convert.
  24939. * @param {string} [separator=','] The element separator.
  24940. * @returns {string} Returns the joined string.
  24941. * @example
  24942. *
  24943. * _.join(['a', 'b', 'c'], '~');
  24944. * // => 'a~b~c'
  24945. */
  24946. function join(array, separator) {
  24947. return array == null ? '' : nativeJoin.call(array, separator);
  24948. }
  24949. /**
  24950. * Gets the last element of `array`.
  24951. *
  24952. * @static
  24953. * @memberOf _
  24954. * @since 0.1.0
  24955. * @category Array
  24956. * @param {Array} array The array to query.
  24957. * @returns {*} Returns the last element of `array`.
  24958. * @example
  24959. *
  24960. * _.last([1, 2, 3]);
  24961. * // => 3
  24962. */
  24963. function last(array) {
  24964. var length = array == null ? 0 : array.length;
  24965. return length ? array[length - 1] : undefined;
  24966. }
  24967. /**
  24968. * This method is like `_.indexOf` except that it iterates over elements of
  24969. * `array` from right to left.
  24970. *
  24971. * @static
  24972. * @memberOf _
  24973. * @since 0.1.0
  24974. * @category Array
  24975. * @param {Array} array The array to inspect.
  24976. * @param {*} value The value to search for.
  24977. * @param {number} [fromIndex=array.length-1] The index to search from.
  24978. * @returns {number} Returns the index of the matched value, else `-1`.
  24979. * @example
  24980. *
  24981. * _.lastIndexOf([1, 2, 1, 2], 2);
  24982. * // => 3
  24983. *
  24984. * // Search from the `fromIndex`.
  24985. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  24986. * // => 1
  24987. */
  24988. function lastIndexOf(array, value, fromIndex) {
  24989. var length = array == null ? 0 : array.length;
  24990. if (!length) {
  24991. return -1;
  24992. }
  24993. var index = length;
  24994. if (fromIndex !== undefined) {
  24995. index = toInteger(fromIndex);
  24996. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  24997. }
  24998. return value === value
  24999. ? strictLastIndexOf(array, value, index)
  25000. : baseFindIndex(array, baseIsNaN, index, true);
  25001. }
  25002. /**
  25003. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25004. * element from the end is returned.
  25005. *
  25006. * @static
  25007. * @memberOf _
  25008. * @since 4.11.0
  25009. * @category Array
  25010. * @param {Array} array The array to query.
  25011. * @param {number} [n=0] The index of the element to return.
  25012. * @returns {*} Returns the nth element of `array`.
  25013. * @example
  25014. *
  25015. * var array = ['a', 'b', 'c', 'd'];
  25016. *
  25017. * _.nth(array, 1);
  25018. * // => 'b'
  25019. *
  25020. * _.nth(array, -2);
  25021. * // => 'c';
  25022. */
  25023. function nth(array, n) {
  25024. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25025. }
  25026. /**
  25027. * Removes all given values from `array` using
  25028. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25029. * for equality comparisons.
  25030. *
  25031. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25032. * to remove elements from an array by predicate.
  25033. *
  25034. * @static
  25035. * @memberOf _
  25036. * @since 2.0.0
  25037. * @category Array
  25038. * @param {Array} array The array to modify.
  25039. * @param {...*} [values] The values to remove.
  25040. * @returns {Array} Returns `array`.
  25041. * @example
  25042. *
  25043. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25044. *
  25045. * _.pull(array, 'a', 'c');
  25046. * console.log(array);
  25047. * // => ['b', 'b']
  25048. */
  25049. var pull = baseRest(pullAll);
  25050. /**
  25051. * This method is like `_.pull` except that it accepts an array of values to remove.
  25052. *
  25053. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25054. *
  25055. * @static
  25056. * @memberOf _
  25057. * @since 4.0.0
  25058. * @category Array
  25059. * @param {Array} array The array to modify.
  25060. * @param {Array} values The values to remove.
  25061. * @returns {Array} Returns `array`.
  25062. * @example
  25063. *
  25064. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25065. *
  25066. * _.pullAll(array, ['a', 'c']);
  25067. * console.log(array);
  25068. * // => ['b', 'b']
  25069. */
  25070. function pullAll(array, values) {
  25071. return (array && array.length && values && values.length)
  25072. ? basePullAll(array, values)
  25073. : array;
  25074. }
  25075. /**
  25076. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25077. * invoked for each element of `array` and `values` to generate the criterion
  25078. * by which they're compared. The iteratee is invoked with one argument: (value).
  25079. *
  25080. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25081. *
  25082. * @static
  25083. * @memberOf _
  25084. * @since 4.0.0
  25085. * @category Array
  25086. * @param {Array} array The array to modify.
  25087. * @param {Array} values The values to remove.
  25088. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25089. * @returns {Array} Returns `array`.
  25090. * @example
  25091. *
  25092. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25093. *
  25094. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25095. * console.log(array);
  25096. * // => [{ 'x': 2 }]
  25097. */
  25098. function pullAllBy(array, values, iteratee) {
  25099. return (array && array.length && values && values.length)
  25100. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25101. : array;
  25102. }
  25103. /**
  25104. * This method is like `_.pullAll` except that it accepts `comparator` which
  25105. * is invoked to compare elements of `array` to `values`. The comparator is
  25106. * invoked with two arguments: (arrVal, othVal).
  25107. *
  25108. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25109. *
  25110. * @static
  25111. * @memberOf _
  25112. * @since 4.6.0
  25113. * @category Array
  25114. * @param {Array} array The array to modify.
  25115. * @param {Array} values The values to remove.
  25116. * @param {Function} [comparator] The comparator invoked per element.
  25117. * @returns {Array} Returns `array`.
  25118. * @example
  25119. *
  25120. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25121. *
  25122. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25123. * console.log(array);
  25124. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25125. */
  25126. function pullAllWith(array, values, comparator) {
  25127. return (array && array.length && values && values.length)
  25128. ? basePullAll(array, values, undefined, comparator)
  25129. : array;
  25130. }
  25131. /**
  25132. * Removes elements from `array` corresponding to `indexes` and returns an
  25133. * array of removed elements.
  25134. *
  25135. * **Note:** Unlike `_.at`, this method mutates `array`.
  25136. *
  25137. * @static
  25138. * @memberOf _
  25139. * @since 3.0.0
  25140. * @category Array
  25141. * @param {Array} array The array to modify.
  25142. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25143. * @returns {Array} Returns the new array of removed elements.
  25144. * @example
  25145. *
  25146. * var array = ['a', 'b', 'c', 'd'];
  25147. * var pulled = _.pullAt(array, [1, 3]);
  25148. *
  25149. * console.log(array);
  25150. * // => ['a', 'c']
  25151. *
  25152. * console.log(pulled);
  25153. * // => ['b', 'd']
  25154. */
  25155. var pullAt = flatRest(function(array, indexes) {
  25156. var length = array == null ? 0 : array.length,
  25157. result = baseAt(array, indexes);
  25158. basePullAt(array, arrayMap(indexes, function(index) {
  25159. return isIndex(index, length) ? +index : index;
  25160. }).sort(compareAscending));
  25161. return result;
  25162. });
  25163. /**
  25164. * Removes all elements from `array` that `predicate` returns truthy for
  25165. * and returns an array of the removed elements. The predicate is invoked
  25166. * with three arguments: (value, index, array).
  25167. *
  25168. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25169. * to pull elements from an array by value.
  25170. *
  25171. * @static
  25172. * @memberOf _
  25173. * @since 2.0.0
  25174. * @category Array
  25175. * @param {Array} array The array to modify.
  25176. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25177. * @returns {Array} Returns the new array of removed elements.
  25178. * @example
  25179. *
  25180. * var array = [1, 2, 3, 4];
  25181. * var evens = _.remove(array, function(n) {
  25182. * return n % 2 == 0;
  25183. * });
  25184. *
  25185. * console.log(array);
  25186. * // => [1, 3]
  25187. *
  25188. * console.log(evens);
  25189. * // => [2, 4]
  25190. */
  25191. function remove(array, predicate) {
  25192. var result = [];
  25193. if (!(array && array.length)) {
  25194. return result;
  25195. }
  25196. var index = -1,
  25197. indexes = [],
  25198. length = array.length;
  25199. predicate = getIteratee(predicate, 3);
  25200. while (++index < length) {
  25201. var value = array[index];
  25202. if (predicate(value, index, array)) {
  25203. result.push(value);
  25204. indexes.push(index);
  25205. }
  25206. }
  25207. basePullAt(array, indexes);
  25208. return result;
  25209. }
  25210. /**
  25211. * Reverses `array` so that the first element becomes the last, the second
  25212. * element becomes the second to last, and so on.
  25213. *
  25214. * **Note:** This method mutates `array` and is based on
  25215. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25216. *
  25217. * @static
  25218. * @memberOf _
  25219. * @since 4.0.0
  25220. * @category Array
  25221. * @param {Array} array The array to modify.
  25222. * @returns {Array} Returns `array`.
  25223. * @example
  25224. *
  25225. * var array = [1, 2, 3];
  25226. *
  25227. * _.reverse(array);
  25228. * // => [3, 2, 1]
  25229. *
  25230. * console.log(array);
  25231. * // => [3, 2, 1]
  25232. */
  25233. function reverse(array) {
  25234. return array == null ? array : nativeReverse.call(array);
  25235. }
  25236. /**
  25237. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25238. *
  25239. * **Note:** This method is used instead of
  25240. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25241. * returned.
  25242. *
  25243. * @static
  25244. * @memberOf _
  25245. * @since 3.0.0
  25246. * @category Array
  25247. * @param {Array} array The array to slice.
  25248. * @param {number} [start=0] The start position.
  25249. * @param {number} [end=array.length] The end position.
  25250. * @returns {Array} Returns the slice of `array`.
  25251. */
  25252. function slice(array, start, end) {
  25253. var length = array == null ? 0 : array.length;
  25254. if (!length) {
  25255. return [];
  25256. }
  25257. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25258. start = 0;
  25259. end = length;
  25260. }
  25261. else {
  25262. start = start == null ? 0 : toInteger(start);
  25263. end = end === undefined ? length : toInteger(end);
  25264. }
  25265. return baseSlice(array, start, end);
  25266. }
  25267. /**
  25268. * Uses a binary search to determine the lowest index at which `value`
  25269. * should be inserted into `array` in order to maintain its sort order.
  25270. *
  25271. * @static
  25272. * @memberOf _
  25273. * @since 0.1.0
  25274. * @category Array
  25275. * @param {Array} array The sorted array to inspect.
  25276. * @param {*} value The value to evaluate.
  25277. * @returns {number} Returns the index at which `value` should be inserted
  25278. * into `array`.
  25279. * @example
  25280. *
  25281. * _.sortedIndex([30, 50], 40);
  25282. * // => 1
  25283. */
  25284. function sortedIndex(array, value) {
  25285. return baseSortedIndex(array, value);
  25286. }
  25287. /**
  25288. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25289. * which is invoked for `value` and each element of `array` to compute their
  25290. * sort ranking. The iteratee is invoked with one argument: (value).
  25291. *
  25292. * @static
  25293. * @memberOf _
  25294. * @since 4.0.0
  25295. * @category Array
  25296. * @param {Array} array The sorted array to inspect.
  25297. * @param {*} value The value to evaluate.
  25298. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25299. * @returns {number} Returns the index at which `value` should be inserted
  25300. * into `array`.
  25301. * @example
  25302. *
  25303. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25304. *
  25305. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25306. * // => 0
  25307. *
  25308. * // The `_.property` iteratee shorthand.
  25309. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25310. * // => 0
  25311. */
  25312. function sortedIndexBy(array, value, iteratee) {
  25313. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25314. }
  25315. /**
  25316. * This method is like `_.indexOf` except that it performs a binary
  25317. * search on a sorted `array`.
  25318. *
  25319. * @static
  25320. * @memberOf _
  25321. * @since 4.0.0
  25322. * @category Array
  25323. * @param {Array} array The array to inspect.
  25324. * @param {*} value The value to search for.
  25325. * @returns {number} Returns the index of the matched value, else `-1`.
  25326. * @example
  25327. *
  25328. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25329. * // => 1
  25330. */
  25331. function sortedIndexOf(array, value) {
  25332. var length = array == null ? 0 : array.length;
  25333. if (length) {
  25334. var index = baseSortedIndex(array, value);
  25335. if (index < length && eq(array[index], value)) {
  25336. return index;
  25337. }
  25338. }
  25339. return -1;
  25340. }
  25341. /**
  25342. * This method is like `_.sortedIndex` except that it returns the highest
  25343. * index at which `value` should be inserted into `array` in order to
  25344. * maintain its sort order.
  25345. *
  25346. * @static
  25347. * @memberOf _
  25348. * @since 3.0.0
  25349. * @category Array
  25350. * @param {Array} array The sorted array to inspect.
  25351. * @param {*} value The value to evaluate.
  25352. * @returns {number} Returns the index at which `value` should be inserted
  25353. * into `array`.
  25354. * @example
  25355. *
  25356. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25357. * // => 4
  25358. */
  25359. function sortedLastIndex(array, value) {
  25360. return baseSortedIndex(array, value, true);
  25361. }
  25362. /**
  25363. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25364. * which is invoked for `value` and each element of `array` to compute their
  25365. * sort ranking. The iteratee is invoked with one argument: (value).
  25366. *
  25367. * @static
  25368. * @memberOf _
  25369. * @since 4.0.0
  25370. * @category Array
  25371. * @param {Array} array The sorted array to inspect.
  25372. * @param {*} value The value to evaluate.
  25373. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25374. * @returns {number} Returns the index at which `value` should be inserted
  25375. * into `array`.
  25376. * @example
  25377. *
  25378. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25379. *
  25380. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25381. * // => 1
  25382. *
  25383. * // The `_.property` iteratee shorthand.
  25384. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25385. * // => 1
  25386. */
  25387. function sortedLastIndexBy(array, value, iteratee) {
  25388. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25389. }
  25390. /**
  25391. * This method is like `_.lastIndexOf` except that it performs a binary
  25392. * search on a sorted `array`.
  25393. *
  25394. * @static
  25395. * @memberOf _
  25396. * @since 4.0.0
  25397. * @category Array
  25398. * @param {Array} array The array to inspect.
  25399. * @param {*} value The value to search for.
  25400. * @returns {number} Returns the index of the matched value, else `-1`.
  25401. * @example
  25402. *
  25403. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25404. * // => 3
  25405. */
  25406. function sortedLastIndexOf(array, value) {
  25407. var length = array == null ? 0 : array.length;
  25408. if (length) {
  25409. var index = baseSortedIndex(array, value, true) - 1;
  25410. if (eq(array[index], value)) {
  25411. return index;
  25412. }
  25413. }
  25414. return -1;
  25415. }
  25416. /**
  25417. * This method is like `_.uniq` except that it's designed and optimized
  25418. * for sorted arrays.
  25419. *
  25420. * @static
  25421. * @memberOf _
  25422. * @since 4.0.0
  25423. * @category Array
  25424. * @param {Array} array The array to inspect.
  25425. * @returns {Array} Returns the new duplicate free array.
  25426. * @example
  25427. *
  25428. * _.sortedUniq([1, 1, 2]);
  25429. * // => [1, 2]
  25430. */
  25431. function sortedUniq(array) {
  25432. return (array && array.length)
  25433. ? baseSortedUniq(array)
  25434. : [];
  25435. }
  25436. /**
  25437. * This method is like `_.uniqBy` 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. * @param {Function} [iteratee] The iteratee invoked per element.
  25446. * @returns {Array} Returns the new duplicate free array.
  25447. * @example
  25448. *
  25449. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25450. * // => [1.1, 2.3]
  25451. */
  25452. function sortedUniqBy(array, iteratee) {
  25453. return (array && array.length)
  25454. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25455. : [];
  25456. }
  25457. /**
  25458. * Gets all but the first element of `array`.
  25459. *
  25460. * @static
  25461. * @memberOf _
  25462. * @since 4.0.0
  25463. * @category Array
  25464. * @param {Array} array The array to query.
  25465. * @returns {Array} Returns the slice of `array`.
  25466. * @example
  25467. *
  25468. * _.tail([1, 2, 3]);
  25469. * // => [2, 3]
  25470. */
  25471. function tail(array) {
  25472. var length = array == null ? 0 : array.length;
  25473. return length ? baseSlice(array, 1, length) : [];
  25474. }
  25475. /**
  25476. * Creates a slice of `array` with `n` elements taken from the beginning.
  25477. *
  25478. * @static
  25479. * @memberOf _
  25480. * @since 0.1.0
  25481. * @category Array
  25482. * @param {Array} array The array to query.
  25483. * @param {number} [n=1] The number of elements to take.
  25484. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25485. * @returns {Array} Returns the slice of `array`.
  25486. * @example
  25487. *
  25488. * _.take([1, 2, 3]);
  25489. * // => [1]
  25490. *
  25491. * _.take([1, 2, 3], 2);
  25492. * // => [1, 2]
  25493. *
  25494. * _.take([1, 2, 3], 5);
  25495. * // => [1, 2, 3]
  25496. *
  25497. * _.take([1, 2, 3], 0);
  25498. * // => []
  25499. */
  25500. function take(array, n, guard) {
  25501. if (!(array && array.length)) {
  25502. return [];
  25503. }
  25504. n = (guard || n === undefined) ? 1 : toInteger(n);
  25505. return baseSlice(array, 0, n < 0 ? 0 : n);
  25506. }
  25507. /**
  25508. * Creates a slice of `array` with `n` elements taken from the end.
  25509. *
  25510. * @static
  25511. * @memberOf _
  25512. * @since 3.0.0
  25513. * @category Array
  25514. * @param {Array} array The array to query.
  25515. * @param {number} [n=1] The number of elements to take.
  25516. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25517. * @returns {Array} Returns the slice of `array`.
  25518. * @example
  25519. *
  25520. * _.takeRight([1, 2, 3]);
  25521. * // => [3]
  25522. *
  25523. * _.takeRight([1, 2, 3], 2);
  25524. * // => [2, 3]
  25525. *
  25526. * _.takeRight([1, 2, 3], 5);
  25527. * // => [1, 2, 3]
  25528. *
  25529. * _.takeRight([1, 2, 3], 0);
  25530. * // => []
  25531. */
  25532. function takeRight(array, n, guard) {
  25533. var length = array == null ? 0 : array.length;
  25534. if (!length) {
  25535. return [];
  25536. }
  25537. n = (guard || n === undefined) ? 1 : toInteger(n);
  25538. n = length - n;
  25539. return baseSlice(array, n < 0 ? 0 : n, length);
  25540. }
  25541. /**
  25542. * Creates a slice of `array` with elements taken from the end. Elements are
  25543. * taken until `predicate` returns falsey. The predicate is invoked with
  25544. * three arguments: (value, index, array).
  25545. *
  25546. * @static
  25547. * @memberOf _
  25548. * @since 3.0.0
  25549. * @category Array
  25550. * @param {Array} array The array to query.
  25551. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25552. * @returns {Array} Returns the slice of `array`.
  25553. * @example
  25554. *
  25555. * var users = [
  25556. * { 'user': 'barney', 'active': true },
  25557. * { 'user': 'fred', 'active': false },
  25558. * { 'user': 'pebbles', 'active': false }
  25559. * ];
  25560. *
  25561. * _.takeRightWhile(users, function(o) { return !o.active; });
  25562. * // => objects for ['fred', 'pebbles']
  25563. *
  25564. * // The `_.matches` iteratee shorthand.
  25565. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25566. * // => objects for ['pebbles']
  25567. *
  25568. * // The `_.matchesProperty` iteratee shorthand.
  25569. * _.takeRightWhile(users, ['active', false]);
  25570. * // => objects for ['fred', 'pebbles']
  25571. *
  25572. * // The `_.property` iteratee shorthand.
  25573. * _.takeRightWhile(users, 'active');
  25574. * // => []
  25575. */
  25576. function takeRightWhile(array, predicate) {
  25577. return (array && array.length)
  25578. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25579. : [];
  25580. }
  25581. /**
  25582. * Creates a slice of `array` with elements taken from the beginning. Elements
  25583. * are taken until `predicate` returns falsey. The predicate is invoked with
  25584. * three arguments: (value, index, array).
  25585. *
  25586. * @static
  25587. * @memberOf _
  25588. * @since 3.0.0
  25589. * @category Array
  25590. * @param {Array} array The array to query.
  25591. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25592. * @returns {Array} Returns the slice of `array`.
  25593. * @example
  25594. *
  25595. * var users = [
  25596. * { 'user': 'barney', 'active': false },
  25597. * { 'user': 'fred', 'active': false },
  25598. * { 'user': 'pebbles', 'active': true }
  25599. * ];
  25600. *
  25601. * _.takeWhile(users, function(o) { return !o.active; });
  25602. * // => objects for ['barney', 'fred']
  25603. *
  25604. * // The `_.matches` iteratee shorthand.
  25605. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25606. * // => objects for ['barney']
  25607. *
  25608. * // The `_.matchesProperty` iteratee shorthand.
  25609. * _.takeWhile(users, ['active', false]);
  25610. * // => objects for ['barney', 'fred']
  25611. *
  25612. * // The `_.property` iteratee shorthand.
  25613. * _.takeWhile(users, 'active');
  25614. * // => []
  25615. */
  25616. function takeWhile(array, predicate) {
  25617. return (array && array.length)
  25618. ? baseWhile(array, getIteratee(predicate, 3))
  25619. : [];
  25620. }
  25621. /**
  25622. * Creates an array of unique values, in order, from all given arrays using
  25623. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25624. * for equality comparisons.
  25625. *
  25626. * @static
  25627. * @memberOf _
  25628. * @since 0.1.0
  25629. * @category Array
  25630. * @param {...Array} [arrays] The arrays to inspect.
  25631. * @returns {Array} Returns the new array of combined values.
  25632. * @example
  25633. *
  25634. * _.union([2], [1, 2]);
  25635. * // => [2, 1]
  25636. */
  25637. var union = baseRest(function(arrays) {
  25638. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25639. });
  25640. /**
  25641. * This method is like `_.union` except that it accepts `iteratee` which is
  25642. * invoked for each element of each `arrays` to generate the criterion by
  25643. * which uniqueness is computed. Result values are chosen from the first
  25644. * array in which the value occurs. The iteratee is invoked with one argument:
  25645. * (value).
  25646. *
  25647. * @static
  25648. * @memberOf _
  25649. * @since 4.0.0
  25650. * @category Array
  25651. * @param {...Array} [arrays] The arrays to inspect.
  25652. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25653. * @returns {Array} Returns the new array of combined values.
  25654. * @example
  25655. *
  25656. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25657. * // => [2.1, 1.2]
  25658. *
  25659. * // The `_.property` iteratee shorthand.
  25660. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25661. * // => [{ 'x': 1 }, { 'x': 2 }]
  25662. */
  25663. var unionBy = baseRest(function(arrays) {
  25664. var iteratee = last(arrays);
  25665. if (isArrayLikeObject(iteratee)) {
  25666. iteratee = undefined;
  25667. }
  25668. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25669. });
  25670. /**
  25671. * This method is like `_.union` except that it accepts `comparator` which
  25672. * is invoked to compare elements of `arrays`. Result values are chosen from
  25673. * the first array in which the value occurs. The comparator is invoked
  25674. * with two arguments: (arrVal, othVal).
  25675. *
  25676. * @static
  25677. * @memberOf _
  25678. * @since 4.0.0
  25679. * @category Array
  25680. * @param {...Array} [arrays] The arrays to inspect.
  25681. * @param {Function} [comparator] The comparator invoked per element.
  25682. * @returns {Array} Returns the new array of combined values.
  25683. * @example
  25684. *
  25685. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25686. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25687. *
  25688. * _.unionWith(objects, others, _.isEqual);
  25689. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25690. */
  25691. var unionWith = baseRest(function(arrays) {
  25692. var comparator = last(arrays);
  25693. comparator = typeof comparator == 'function' ? comparator : undefined;
  25694. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25695. });
  25696. /**
  25697. * Creates a duplicate-free version of an array, using
  25698. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25699. * for equality comparisons, in which only the first occurrence of each element
  25700. * is kept. The order of result values is determined by the order they occur
  25701. * in the array.
  25702. *
  25703. * @static
  25704. * @memberOf _
  25705. * @since 0.1.0
  25706. * @category Array
  25707. * @param {Array} array The array to inspect.
  25708. * @returns {Array} Returns the new duplicate free array.
  25709. * @example
  25710. *
  25711. * _.uniq([2, 1, 2]);
  25712. * // => [2, 1]
  25713. */
  25714. function uniq(array) {
  25715. return (array && array.length) ? baseUniq(array) : [];
  25716. }
  25717. /**
  25718. * This method is like `_.uniq` except that it accepts `iteratee` which is
  25719. * invoked for each element in `array` to generate the criterion by which
  25720. * uniqueness is computed. The order of result values is determined by the
  25721. * order they occur in the array. The iteratee is invoked with one argument:
  25722. * (value).
  25723. *
  25724. * @static
  25725. * @memberOf _
  25726. * @since 4.0.0
  25727. * @category Array
  25728. * @param {Array} array The array to inspect.
  25729. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25730. * @returns {Array} Returns the new duplicate free array.
  25731. * @example
  25732. *
  25733. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  25734. * // => [2.1, 1.2]
  25735. *
  25736. * // The `_.property` iteratee shorthand.
  25737. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  25738. * // => [{ 'x': 1 }, { 'x': 2 }]
  25739. */
  25740. function uniqBy(array, iteratee) {
  25741. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  25742. }
  25743. /**
  25744. * This method is like `_.uniq` except that it accepts `comparator` which
  25745. * is invoked to compare elements of `array`. The order of result values is
  25746. * determined by the order they occur in the array.The comparator is invoked
  25747. * with two arguments: (arrVal, othVal).
  25748. *
  25749. * @static
  25750. * @memberOf _
  25751. * @since 4.0.0
  25752. * @category Array
  25753. * @param {Array} array The array to inspect.
  25754. * @param {Function} [comparator] The comparator invoked per element.
  25755. * @returns {Array} Returns the new duplicate free array.
  25756. * @example
  25757. *
  25758. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25759. *
  25760. * _.uniqWith(objects, _.isEqual);
  25761. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  25762. */
  25763. function uniqWith(array, comparator) {
  25764. comparator = typeof comparator == 'function' ? comparator : undefined;
  25765. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  25766. }
  25767. /**
  25768. * This method is like `_.zip` except that it accepts an array of grouped
  25769. * elements and creates an array regrouping the elements to their pre-zip
  25770. * configuration.
  25771. *
  25772. * @static
  25773. * @memberOf _
  25774. * @since 1.2.0
  25775. * @category Array
  25776. * @param {Array} array The array of grouped elements to process.
  25777. * @returns {Array} Returns the new array of regrouped elements.
  25778. * @example
  25779. *
  25780. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  25781. * // => [['a', 1, true], ['b', 2, false]]
  25782. *
  25783. * _.unzip(zipped);
  25784. * // => [['a', 'b'], [1, 2], [true, false]]
  25785. */
  25786. function unzip(array) {
  25787. if (!(array && array.length)) {
  25788. return [];
  25789. }
  25790. var length = 0;
  25791. array = arrayFilter(array, function(group) {
  25792. if (isArrayLikeObject(group)) {
  25793. length = nativeMax(group.length, length);
  25794. return true;
  25795. }
  25796. });
  25797. return baseTimes(length, function(index) {
  25798. return arrayMap(array, baseProperty(index));
  25799. });
  25800. }
  25801. /**
  25802. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  25803. * how regrouped values should be combined. The iteratee is invoked with the
  25804. * elements of each group: (...group).
  25805. *
  25806. * @static
  25807. * @memberOf _
  25808. * @since 3.8.0
  25809. * @category Array
  25810. * @param {Array} array The array of grouped elements to process.
  25811. * @param {Function} [iteratee=_.identity] The function to combine
  25812. * regrouped values.
  25813. * @returns {Array} Returns the new array of regrouped elements.
  25814. * @example
  25815. *
  25816. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  25817. * // => [[1, 10, 100], [2, 20, 200]]
  25818. *
  25819. * _.unzipWith(zipped, _.add);
  25820. * // => [3, 30, 300]
  25821. */
  25822. function unzipWith(array, iteratee) {
  25823. if (!(array && array.length)) {
  25824. return [];
  25825. }
  25826. var result = unzip(array);
  25827. if (iteratee == null) {
  25828. return result;
  25829. }
  25830. return arrayMap(result, function(group) {
  25831. return apply(iteratee, undefined, group);
  25832. });
  25833. }
  25834. /**
  25835. * Creates an array excluding all given values using
  25836. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25837. * for equality comparisons.
  25838. *
  25839. * **Note:** Unlike `_.pull`, this method returns a new array.
  25840. *
  25841. * @static
  25842. * @memberOf _
  25843. * @since 0.1.0
  25844. * @category Array
  25845. * @param {Array} array The array to inspect.
  25846. * @param {...*} [values] The values to exclude.
  25847. * @returns {Array} Returns the new array of filtered values.
  25848. * @see _.difference, _.xor
  25849. * @example
  25850. *
  25851. * _.without([2, 1, 2, 3], 1, 2);
  25852. * // => [3]
  25853. */
  25854. var without = baseRest(function(array, values) {
  25855. return isArrayLikeObject(array)
  25856. ? baseDifference(array, values)
  25857. : [];
  25858. });
  25859. /**
  25860. * Creates an array of unique values that is the
  25861. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  25862. * of the given arrays. The order of result values is determined by the order
  25863. * they occur in the arrays.
  25864. *
  25865. * @static
  25866. * @memberOf _
  25867. * @since 2.4.0
  25868. * @category Array
  25869. * @param {...Array} [arrays] The arrays to inspect.
  25870. * @returns {Array} Returns the new array of filtered values.
  25871. * @see _.difference, _.without
  25872. * @example
  25873. *
  25874. * _.xor([2, 1], [2, 3]);
  25875. * // => [1, 3]
  25876. */
  25877. var xor = baseRest(function(arrays) {
  25878. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  25879. });
  25880. /**
  25881. * This method is like `_.xor` except that it accepts `iteratee` which is
  25882. * invoked for each element of each `arrays` to generate the criterion by
  25883. * which by which they're compared. The order of result values is determined
  25884. * by the order they occur in the arrays. The iteratee is invoked with one
  25885. * argument: (value).
  25886. *
  25887. * @static
  25888. * @memberOf _
  25889. * @since 4.0.0
  25890. * @category Array
  25891. * @param {...Array} [arrays] The arrays to inspect.
  25892. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25893. * @returns {Array} Returns the new array of filtered values.
  25894. * @example
  25895. *
  25896. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25897. * // => [1.2, 3.4]
  25898. *
  25899. * // The `_.property` iteratee shorthand.
  25900. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25901. * // => [{ 'x': 2 }]
  25902. */
  25903. var xorBy = baseRest(function(arrays) {
  25904. var iteratee = last(arrays);
  25905. if (isArrayLikeObject(iteratee)) {
  25906. iteratee = undefined;
  25907. }
  25908. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  25909. });
  25910. /**
  25911. * This method is like `_.xor` except that it accepts `comparator` which is
  25912. * invoked to compare elements of `arrays`. The order of result values is
  25913. * determined by the order they occur in the arrays. The comparator is invoked
  25914. * with two arguments: (arrVal, othVal).
  25915. *
  25916. * @static
  25917. * @memberOf _
  25918. * @since 4.0.0
  25919. * @category Array
  25920. * @param {...Array} [arrays] The arrays to inspect.
  25921. * @param {Function} [comparator] The comparator invoked per element.
  25922. * @returns {Array} Returns the new array of filtered values.
  25923. * @example
  25924. *
  25925. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25926. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25927. *
  25928. * _.xorWith(objects, others, _.isEqual);
  25929. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25930. */
  25931. var xorWith = baseRest(function(arrays) {
  25932. var comparator = last(arrays);
  25933. comparator = typeof comparator == 'function' ? comparator : undefined;
  25934. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  25935. });
  25936. /**
  25937. * Creates an array of grouped elements, the first of which contains the
  25938. * first elements of the given arrays, the second of which contains the
  25939. * second elements of the given arrays, and so on.
  25940. *
  25941. * @static
  25942. * @memberOf _
  25943. * @since 0.1.0
  25944. * @category Array
  25945. * @param {...Array} [arrays] The arrays to process.
  25946. * @returns {Array} Returns the new array of grouped elements.
  25947. * @example
  25948. *
  25949. * _.zip(['a', 'b'], [1, 2], [true, false]);
  25950. * // => [['a', 1, true], ['b', 2, false]]
  25951. */
  25952. var zip = baseRest(unzip);
  25953. /**
  25954. * This method is like `_.fromPairs` except that it accepts two arrays,
  25955. * one of property identifiers and one of corresponding values.
  25956. *
  25957. * @static
  25958. * @memberOf _
  25959. * @since 0.4.0
  25960. * @category Array
  25961. * @param {Array} [props=[]] The property identifiers.
  25962. * @param {Array} [values=[]] The property values.
  25963. * @returns {Object} Returns the new object.
  25964. * @example
  25965. *
  25966. * _.zipObject(['a', 'b'], [1, 2]);
  25967. * // => { 'a': 1, 'b': 2 }
  25968. */
  25969. function zipObject(props, values) {
  25970. return baseZipObject(props || [], values || [], assignValue);
  25971. }
  25972. /**
  25973. * This method is like `_.zipObject` except that it supports property paths.
  25974. *
  25975. * @static
  25976. * @memberOf _
  25977. * @since 4.1.0
  25978. * @category Array
  25979. * @param {Array} [props=[]] The property identifiers.
  25980. * @param {Array} [values=[]] The property values.
  25981. * @returns {Object} Returns the new object.
  25982. * @example
  25983. *
  25984. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  25985. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  25986. */
  25987. function zipObjectDeep(props, values) {
  25988. return baseZipObject(props || [], values || [], baseSet);
  25989. }
  25990. /**
  25991. * This method is like `_.zip` except that it accepts `iteratee` to specify
  25992. * how grouped values should be combined. The iteratee is invoked with the
  25993. * elements of each group: (...group).
  25994. *
  25995. * @static
  25996. * @memberOf _
  25997. * @since 3.8.0
  25998. * @category Array
  25999. * @param {...Array} [arrays] The arrays to process.
  26000. * @param {Function} [iteratee=_.identity] The function to combine
  26001. * grouped values.
  26002. * @returns {Array} Returns the new array of grouped elements.
  26003. * @example
  26004. *
  26005. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26006. * return a + b + c;
  26007. * });
  26008. * // => [111, 222]
  26009. */
  26010. var zipWith = baseRest(function(arrays) {
  26011. var length = arrays.length,
  26012. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26013. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26014. return unzipWith(arrays, iteratee);
  26015. });
  26016. /*------------------------------------------------------------------------*/
  26017. /**
  26018. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26019. * chain sequences enabled. The result of such sequences must be unwrapped
  26020. * with `_#value`.
  26021. *
  26022. * @static
  26023. * @memberOf _
  26024. * @since 1.3.0
  26025. * @category Seq
  26026. * @param {*} value The value to wrap.
  26027. * @returns {Object} Returns the new `lodash` wrapper instance.
  26028. * @example
  26029. *
  26030. * var users = [
  26031. * { 'user': 'barney', 'age': 36 },
  26032. * { 'user': 'fred', 'age': 40 },
  26033. * { 'user': 'pebbles', 'age': 1 }
  26034. * ];
  26035. *
  26036. * var youngest = _
  26037. * .chain(users)
  26038. * .sortBy('age')
  26039. * .map(function(o) {
  26040. * return o.user + ' is ' + o.age;
  26041. * })
  26042. * .head()
  26043. * .value();
  26044. * // => 'pebbles is 1'
  26045. */
  26046. function chain(value) {
  26047. var result = lodash(value);
  26048. result.__chain__ = true;
  26049. return result;
  26050. }
  26051. /**
  26052. * This method invokes `interceptor` and returns `value`. The interceptor
  26053. * is invoked with one argument; (value). The purpose of this method is to
  26054. * "tap into" a method chain sequence in order to modify intermediate results.
  26055. *
  26056. * @static
  26057. * @memberOf _
  26058. * @since 0.1.0
  26059. * @category Seq
  26060. * @param {*} value The value to provide to `interceptor`.
  26061. * @param {Function} interceptor The function to invoke.
  26062. * @returns {*} Returns `value`.
  26063. * @example
  26064. *
  26065. * _([1, 2, 3])
  26066. * .tap(function(array) {
  26067. * // Mutate input array.
  26068. * array.pop();
  26069. * })
  26070. * .reverse()
  26071. * .value();
  26072. * // => [2, 1]
  26073. */
  26074. function tap(value, interceptor) {
  26075. interceptor(value);
  26076. return value;
  26077. }
  26078. /**
  26079. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26080. * The purpose of this method is to "pass thru" values replacing intermediate
  26081. * results in a method chain sequence.
  26082. *
  26083. * @static
  26084. * @memberOf _
  26085. * @since 3.0.0
  26086. * @category Seq
  26087. * @param {*} value The value to provide to `interceptor`.
  26088. * @param {Function} interceptor The function to invoke.
  26089. * @returns {*} Returns the result of `interceptor`.
  26090. * @example
  26091. *
  26092. * _(' abc ')
  26093. * .chain()
  26094. * .trim()
  26095. * .thru(function(value) {
  26096. * return [value];
  26097. * })
  26098. * .value();
  26099. * // => ['abc']
  26100. */
  26101. function thru(value, interceptor) {
  26102. return interceptor(value);
  26103. }
  26104. /**
  26105. * This method is the wrapper version of `_.at`.
  26106. *
  26107. * @name at
  26108. * @memberOf _
  26109. * @since 1.0.0
  26110. * @category Seq
  26111. * @param {...(string|string[])} [paths] The property paths to pick.
  26112. * @returns {Object} Returns the new `lodash` wrapper instance.
  26113. * @example
  26114. *
  26115. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26116. *
  26117. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26118. * // => [3, 4]
  26119. */
  26120. var wrapperAt = flatRest(function(paths) {
  26121. var length = paths.length,
  26122. start = length ? paths[0] : 0,
  26123. value = this.__wrapped__,
  26124. interceptor = function(object) { return baseAt(object, paths); };
  26125. if (length > 1 || this.__actions__.length ||
  26126. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26127. return this.thru(interceptor);
  26128. }
  26129. value = value.slice(start, +start + (length ? 1 : 0));
  26130. value.__actions__.push({
  26131. 'func': thru,
  26132. 'args': [interceptor],
  26133. 'thisArg': undefined
  26134. });
  26135. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26136. if (length && !array.length) {
  26137. array.push(undefined);
  26138. }
  26139. return array;
  26140. });
  26141. });
  26142. /**
  26143. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26144. *
  26145. * @name chain
  26146. * @memberOf _
  26147. * @since 0.1.0
  26148. * @category Seq
  26149. * @returns {Object} Returns the new `lodash` wrapper instance.
  26150. * @example
  26151. *
  26152. * var users = [
  26153. * { 'user': 'barney', 'age': 36 },
  26154. * { 'user': 'fred', 'age': 40 }
  26155. * ];
  26156. *
  26157. * // A sequence without explicit chaining.
  26158. * _(users).head();
  26159. * // => { 'user': 'barney', 'age': 36 }
  26160. *
  26161. * // A sequence with explicit chaining.
  26162. * _(users)
  26163. * .chain()
  26164. * .head()
  26165. * .pick('user')
  26166. * .value();
  26167. * // => { 'user': 'barney' }
  26168. */
  26169. function wrapperChain() {
  26170. return chain(this);
  26171. }
  26172. /**
  26173. * Executes the chain sequence and returns the wrapped result.
  26174. *
  26175. * @name commit
  26176. * @memberOf _
  26177. * @since 3.2.0
  26178. * @category Seq
  26179. * @returns {Object} Returns the new `lodash` wrapper instance.
  26180. * @example
  26181. *
  26182. * var array = [1, 2];
  26183. * var wrapped = _(array).push(3);
  26184. *
  26185. * console.log(array);
  26186. * // => [1, 2]
  26187. *
  26188. * wrapped = wrapped.commit();
  26189. * console.log(array);
  26190. * // => [1, 2, 3]
  26191. *
  26192. * wrapped.last();
  26193. * // => 3
  26194. *
  26195. * console.log(array);
  26196. * // => [1, 2, 3]
  26197. */
  26198. function wrapperCommit() {
  26199. return new LodashWrapper(this.value(), this.__chain__);
  26200. }
  26201. /**
  26202. * Gets the next value on a wrapped object following the
  26203. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26204. *
  26205. * @name next
  26206. * @memberOf _
  26207. * @since 4.0.0
  26208. * @category Seq
  26209. * @returns {Object} Returns the next iterator value.
  26210. * @example
  26211. *
  26212. * var wrapped = _([1, 2]);
  26213. *
  26214. * wrapped.next();
  26215. * // => { 'done': false, 'value': 1 }
  26216. *
  26217. * wrapped.next();
  26218. * // => { 'done': false, 'value': 2 }
  26219. *
  26220. * wrapped.next();
  26221. * // => { 'done': true, 'value': undefined }
  26222. */
  26223. function wrapperNext() {
  26224. if (this.__values__ === undefined) {
  26225. this.__values__ = toArray(this.value());
  26226. }
  26227. var done = this.__index__ >= this.__values__.length,
  26228. value = done ? undefined : this.__values__[this.__index__++];
  26229. return { 'done': done, 'value': value };
  26230. }
  26231. /**
  26232. * Enables the wrapper to be iterable.
  26233. *
  26234. * @name Symbol.iterator
  26235. * @memberOf _
  26236. * @since 4.0.0
  26237. * @category Seq
  26238. * @returns {Object} Returns the wrapper object.
  26239. * @example
  26240. *
  26241. * var wrapped = _([1, 2]);
  26242. *
  26243. * wrapped[Symbol.iterator]() === wrapped;
  26244. * // => true
  26245. *
  26246. * Array.from(wrapped);
  26247. * // => [1, 2]
  26248. */
  26249. function wrapperToIterator() {
  26250. return this;
  26251. }
  26252. /**
  26253. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26254. *
  26255. * @name plant
  26256. * @memberOf _
  26257. * @since 3.2.0
  26258. * @category Seq
  26259. * @param {*} value The value to plant.
  26260. * @returns {Object} Returns the new `lodash` wrapper instance.
  26261. * @example
  26262. *
  26263. * function square(n) {
  26264. * return n * n;
  26265. * }
  26266. *
  26267. * var wrapped = _([1, 2]).map(square);
  26268. * var other = wrapped.plant([3, 4]);
  26269. *
  26270. * other.value();
  26271. * // => [9, 16]
  26272. *
  26273. * wrapped.value();
  26274. * // => [1, 4]
  26275. */
  26276. function wrapperPlant(value) {
  26277. var result,
  26278. parent = this;
  26279. while (parent instanceof baseLodash) {
  26280. var clone = wrapperClone(parent);
  26281. clone.__index__ = 0;
  26282. clone.__values__ = undefined;
  26283. if (result) {
  26284. previous.__wrapped__ = clone;
  26285. } else {
  26286. result = clone;
  26287. }
  26288. var previous = clone;
  26289. parent = parent.__wrapped__;
  26290. }
  26291. previous.__wrapped__ = value;
  26292. return result;
  26293. }
  26294. /**
  26295. * This method is the wrapper version of `_.reverse`.
  26296. *
  26297. * **Note:** This method mutates the wrapped array.
  26298. *
  26299. * @name reverse
  26300. * @memberOf _
  26301. * @since 0.1.0
  26302. * @category Seq
  26303. * @returns {Object} Returns the new `lodash` wrapper instance.
  26304. * @example
  26305. *
  26306. * var array = [1, 2, 3];
  26307. *
  26308. * _(array).reverse().value()
  26309. * // => [3, 2, 1]
  26310. *
  26311. * console.log(array);
  26312. * // => [3, 2, 1]
  26313. */
  26314. function wrapperReverse() {
  26315. var value = this.__wrapped__;
  26316. if (value instanceof LazyWrapper) {
  26317. var wrapped = value;
  26318. if (this.__actions__.length) {
  26319. wrapped = new LazyWrapper(this);
  26320. }
  26321. wrapped = wrapped.reverse();
  26322. wrapped.__actions__.push({
  26323. 'func': thru,
  26324. 'args': [reverse],
  26325. 'thisArg': undefined
  26326. });
  26327. return new LodashWrapper(wrapped, this.__chain__);
  26328. }
  26329. return this.thru(reverse);
  26330. }
  26331. /**
  26332. * Executes the chain sequence to resolve the unwrapped value.
  26333. *
  26334. * @name value
  26335. * @memberOf _
  26336. * @since 0.1.0
  26337. * @alias toJSON, valueOf
  26338. * @category Seq
  26339. * @returns {*} Returns the resolved unwrapped value.
  26340. * @example
  26341. *
  26342. * _([1, 2, 3]).value();
  26343. * // => [1, 2, 3]
  26344. */
  26345. function wrapperValue() {
  26346. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26347. }
  26348. /*------------------------------------------------------------------------*/
  26349. /**
  26350. * Creates an object composed of keys generated from the results of running
  26351. * each element of `collection` thru `iteratee`. The corresponding value of
  26352. * each key is the number of times the key was returned by `iteratee`. The
  26353. * iteratee is invoked with one argument: (value).
  26354. *
  26355. * @static
  26356. * @memberOf _
  26357. * @since 0.5.0
  26358. * @category Collection
  26359. * @param {Array|Object} collection The collection to iterate over.
  26360. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26361. * @returns {Object} Returns the composed aggregate object.
  26362. * @example
  26363. *
  26364. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26365. * // => { '4': 1, '6': 2 }
  26366. *
  26367. * // The `_.property` iteratee shorthand.
  26368. * _.countBy(['one', 'two', 'three'], 'length');
  26369. * // => { '3': 2, '5': 1 }
  26370. */
  26371. var countBy = createAggregator(function(result, value, key) {
  26372. if (hasOwnProperty.call(result, key)) {
  26373. ++result[key];
  26374. } else {
  26375. baseAssignValue(result, key, 1);
  26376. }
  26377. });
  26378. /**
  26379. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26380. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26381. * invoked with three arguments: (value, index|key, collection).
  26382. *
  26383. * **Note:** This method returns `true` for
  26384. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26385. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26386. * elements of empty collections.
  26387. *
  26388. * @static
  26389. * @memberOf _
  26390. * @since 0.1.0
  26391. * @category Collection
  26392. * @param {Array|Object} collection The collection to iterate over.
  26393. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26394. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26395. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26396. * else `false`.
  26397. * @example
  26398. *
  26399. * _.every([true, 1, null, 'yes'], Boolean);
  26400. * // => false
  26401. *
  26402. * var users = [
  26403. * { 'user': 'barney', 'age': 36, 'active': false },
  26404. * { 'user': 'fred', 'age': 40, 'active': false }
  26405. * ];
  26406. *
  26407. * // The `_.matches` iteratee shorthand.
  26408. * _.every(users, { 'user': 'barney', 'active': false });
  26409. * // => false
  26410. *
  26411. * // The `_.matchesProperty` iteratee shorthand.
  26412. * _.every(users, ['active', false]);
  26413. * // => true
  26414. *
  26415. * // The `_.property` iteratee shorthand.
  26416. * _.every(users, 'active');
  26417. * // => false
  26418. */
  26419. function every(collection, predicate, guard) {
  26420. var func = isArray(collection) ? arrayEvery : baseEvery;
  26421. if (guard && isIterateeCall(collection, predicate, guard)) {
  26422. predicate = undefined;
  26423. }
  26424. return func(collection, getIteratee(predicate, 3));
  26425. }
  26426. /**
  26427. * Iterates over elements of `collection`, returning an array of all elements
  26428. * `predicate` returns truthy for. The predicate is invoked with three
  26429. * arguments: (value, index|key, collection).
  26430. *
  26431. * **Note:** Unlike `_.remove`, this method returns a new array.
  26432. *
  26433. * @static
  26434. * @memberOf _
  26435. * @since 0.1.0
  26436. * @category Collection
  26437. * @param {Array|Object} collection The collection to iterate over.
  26438. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26439. * @returns {Array} Returns the new filtered array.
  26440. * @see _.reject
  26441. * @example
  26442. *
  26443. * var users = [
  26444. * { 'user': 'barney', 'age': 36, 'active': true },
  26445. * { 'user': 'fred', 'age': 40, 'active': false }
  26446. * ];
  26447. *
  26448. * _.filter(users, function(o) { return !o.active; });
  26449. * // => objects for ['fred']
  26450. *
  26451. * // The `_.matches` iteratee shorthand.
  26452. * _.filter(users, { 'age': 36, 'active': true });
  26453. * // => objects for ['barney']
  26454. *
  26455. * // The `_.matchesProperty` iteratee shorthand.
  26456. * _.filter(users, ['active', false]);
  26457. * // => objects for ['fred']
  26458. *
  26459. * // The `_.property` iteratee shorthand.
  26460. * _.filter(users, 'active');
  26461. * // => objects for ['barney']
  26462. */
  26463. function filter(collection, predicate) {
  26464. var func = isArray(collection) ? arrayFilter : baseFilter;
  26465. return func(collection, getIteratee(predicate, 3));
  26466. }
  26467. /**
  26468. * Iterates over elements of `collection`, returning the first element
  26469. * `predicate` returns truthy for. The predicate is invoked with three
  26470. * arguments: (value, index|key, collection).
  26471. *
  26472. * @static
  26473. * @memberOf _
  26474. * @since 0.1.0
  26475. * @category Collection
  26476. * @param {Array|Object} collection The collection to inspect.
  26477. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26478. * @param {number} [fromIndex=0] The index to search from.
  26479. * @returns {*} Returns the matched element, else `undefined`.
  26480. * @example
  26481. *
  26482. * var users = [
  26483. * { 'user': 'barney', 'age': 36, 'active': true },
  26484. * { 'user': 'fred', 'age': 40, 'active': false },
  26485. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26486. * ];
  26487. *
  26488. * _.find(users, function(o) { return o.age < 40; });
  26489. * // => object for 'barney'
  26490. *
  26491. * // The `_.matches` iteratee shorthand.
  26492. * _.find(users, { 'age': 1, 'active': true });
  26493. * // => object for 'pebbles'
  26494. *
  26495. * // The `_.matchesProperty` iteratee shorthand.
  26496. * _.find(users, ['active', false]);
  26497. * // => object for 'fred'
  26498. *
  26499. * // The `_.property` iteratee shorthand.
  26500. * _.find(users, 'active');
  26501. * // => object for 'barney'
  26502. */
  26503. var find = createFind(findIndex);
  26504. /**
  26505. * This method is like `_.find` except that it iterates over elements of
  26506. * `collection` from right to left.
  26507. *
  26508. * @static
  26509. * @memberOf _
  26510. * @since 2.0.0
  26511. * @category Collection
  26512. * @param {Array|Object} collection The collection to inspect.
  26513. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26514. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26515. * @returns {*} Returns the matched element, else `undefined`.
  26516. * @example
  26517. *
  26518. * _.findLast([1, 2, 3, 4], function(n) {
  26519. * return n % 2 == 1;
  26520. * });
  26521. * // => 3
  26522. */
  26523. var findLast = createFind(findLastIndex);
  26524. /**
  26525. * Creates a flattened array of values by running each element in `collection`
  26526. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26527. * with three arguments: (value, index|key, collection).
  26528. *
  26529. * @static
  26530. * @memberOf _
  26531. * @since 4.0.0
  26532. * @category Collection
  26533. * @param {Array|Object} collection The collection to iterate over.
  26534. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26535. * @returns {Array} Returns the new flattened array.
  26536. * @example
  26537. *
  26538. * function duplicate(n) {
  26539. * return [n, n];
  26540. * }
  26541. *
  26542. * _.flatMap([1, 2], duplicate);
  26543. * // => [1, 1, 2, 2]
  26544. */
  26545. function flatMap(collection, iteratee) {
  26546. return baseFlatten(map(collection, iteratee), 1);
  26547. }
  26548. /**
  26549. * This method is like `_.flatMap` except that it recursively flattens the
  26550. * mapped results.
  26551. *
  26552. * @static
  26553. * @memberOf _
  26554. * @since 4.7.0
  26555. * @category Collection
  26556. * @param {Array|Object} collection The collection to iterate over.
  26557. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26558. * @returns {Array} Returns the new flattened array.
  26559. * @example
  26560. *
  26561. * function duplicate(n) {
  26562. * return [[[n, n]]];
  26563. * }
  26564. *
  26565. * _.flatMapDeep([1, 2], duplicate);
  26566. * // => [1, 1, 2, 2]
  26567. */
  26568. function flatMapDeep(collection, iteratee) {
  26569. return baseFlatten(map(collection, iteratee), INFINITY);
  26570. }
  26571. /**
  26572. * This method is like `_.flatMap` except that it recursively flattens the
  26573. * mapped results up to `depth` times.
  26574. *
  26575. * @static
  26576. * @memberOf _
  26577. * @since 4.7.0
  26578. * @category Collection
  26579. * @param {Array|Object} collection The collection to iterate over.
  26580. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26581. * @param {number} [depth=1] The maximum recursion depth.
  26582. * @returns {Array} Returns the new flattened array.
  26583. * @example
  26584. *
  26585. * function duplicate(n) {
  26586. * return [[[n, n]]];
  26587. * }
  26588. *
  26589. * _.flatMapDepth([1, 2], duplicate, 2);
  26590. * // => [[1, 1], [2, 2]]
  26591. */
  26592. function flatMapDepth(collection, iteratee, depth) {
  26593. depth = depth === undefined ? 1 : toInteger(depth);
  26594. return baseFlatten(map(collection, iteratee), depth);
  26595. }
  26596. /**
  26597. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26598. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26599. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26600. *
  26601. * **Note:** As with other "Collections" methods, objects with a "length"
  26602. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26603. * or `_.forOwn` for object iteration.
  26604. *
  26605. * @static
  26606. * @memberOf _
  26607. * @since 0.1.0
  26608. * @alias each
  26609. * @category Collection
  26610. * @param {Array|Object} collection The collection to iterate over.
  26611. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26612. * @returns {Array|Object} Returns `collection`.
  26613. * @see _.forEachRight
  26614. * @example
  26615. *
  26616. * _.forEach([1, 2], function(value) {
  26617. * console.log(value);
  26618. * });
  26619. * // => Logs `1` then `2`.
  26620. *
  26621. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26622. * console.log(key);
  26623. * });
  26624. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26625. */
  26626. function forEach(collection, iteratee) {
  26627. var func = isArray(collection) ? arrayEach : baseEach;
  26628. return func(collection, getIteratee(iteratee, 3));
  26629. }
  26630. /**
  26631. * This method is like `_.forEach` except that it iterates over elements of
  26632. * `collection` from right to left.
  26633. *
  26634. * @static
  26635. * @memberOf _
  26636. * @since 2.0.0
  26637. * @alias eachRight
  26638. * @category Collection
  26639. * @param {Array|Object} collection The collection to iterate over.
  26640. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26641. * @returns {Array|Object} Returns `collection`.
  26642. * @see _.forEach
  26643. * @example
  26644. *
  26645. * _.forEachRight([1, 2], function(value) {
  26646. * console.log(value);
  26647. * });
  26648. * // => Logs `2` then `1`.
  26649. */
  26650. function forEachRight(collection, iteratee) {
  26651. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26652. return func(collection, getIteratee(iteratee, 3));
  26653. }
  26654. /**
  26655. * Creates an object composed of keys generated from the results of running
  26656. * each element of `collection` thru `iteratee`. The order of grouped values
  26657. * is determined by the order they occur in `collection`. The corresponding
  26658. * value of each key is an array of elements responsible for generating the
  26659. * key. The iteratee is invoked with one argument: (value).
  26660. *
  26661. * @static
  26662. * @memberOf _
  26663. * @since 0.1.0
  26664. * @category Collection
  26665. * @param {Array|Object} collection The collection to iterate over.
  26666. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26667. * @returns {Object} Returns the composed aggregate object.
  26668. * @example
  26669. *
  26670. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26671. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26672. *
  26673. * // The `_.property` iteratee shorthand.
  26674. * _.groupBy(['one', 'two', 'three'], 'length');
  26675. * // => { '3': ['one', 'two'], '5': ['three'] }
  26676. */
  26677. var groupBy = createAggregator(function(result, value, key) {
  26678. if (hasOwnProperty.call(result, key)) {
  26679. result[key].push(value);
  26680. } else {
  26681. baseAssignValue(result, key, [value]);
  26682. }
  26683. });
  26684. /**
  26685. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26686. * checked for a substring of `value`, otherwise
  26687. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26688. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26689. * the offset from the end of `collection`.
  26690. *
  26691. * @static
  26692. * @memberOf _
  26693. * @since 0.1.0
  26694. * @category Collection
  26695. * @param {Array|Object|string} collection The collection to inspect.
  26696. * @param {*} value The value to search for.
  26697. * @param {number} [fromIndex=0] The index to search from.
  26698. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26699. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26700. * @example
  26701. *
  26702. * _.includes([1, 2, 3], 1);
  26703. * // => true
  26704. *
  26705. * _.includes([1, 2, 3], 1, 2);
  26706. * // => false
  26707. *
  26708. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26709. * // => true
  26710. *
  26711. * _.includes('abcd', 'bc');
  26712. * // => true
  26713. */
  26714. function includes(collection, value, fromIndex, guard) {
  26715. collection = isArrayLike(collection) ? collection : values(collection);
  26716. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  26717. var length = collection.length;
  26718. if (fromIndex < 0) {
  26719. fromIndex = nativeMax(length + fromIndex, 0);
  26720. }
  26721. return isString(collection)
  26722. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  26723. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  26724. }
  26725. /**
  26726. * Invokes the method at `path` of each element in `collection`, returning
  26727. * an array of the results of each invoked method. Any additional arguments
  26728. * are provided to each invoked method. If `path` is a function, it's invoked
  26729. * for, and `this` bound to, each element in `collection`.
  26730. *
  26731. * @static
  26732. * @memberOf _
  26733. * @since 4.0.0
  26734. * @category Collection
  26735. * @param {Array|Object} collection The collection to iterate over.
  26736. * @param {Array|Function|string} path The path of the method to invoke or
  26737. * the function invoked per iteration.
  26738. * @param {...*} [args] The arguments to invoke each method with.
  26739. * @returns {Array} Returns the array of results.
  26740. * @example
  26741. *
  26742. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  26743. * // => [[1, 5, 7], [1, 2, 3]]
  26744. *
  26745. * _.invokeMap([123, 456], String.prototype.split, '');
  26746. * // => [['1', '2', '3'], ['4', '5', '6']]
  26747. */
  26748. var invokeMap = baseRest(function(collection, path, args) {
  26749. var index = -1,
  26750. isFunc = typeof path == 'function',
  26751. result = isArrayLike(collection) ? Array(collection.length) : [];
  26752. baseEach(collection, function(value) {
  26753. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  26754. });
  26755. return result;
  26756. });
  26757. /**
  26758. * Creates an object composed of keys generated from the results of running
  26759. * each element of `collection` thru `iteratee`. The corresponding value of
  26760. * each key is the last element responsible for generating the key. The
  26761. * iteratee is invoked with one argument: (value).
  26762. *
  26763. * @static
  26764. * @memberOf _
  26765. * @since 4.0.0
  26766. * @category Collection
  26767. * @param {Array|Object} collection The collection to iterate over.
  26768. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26769. * @returns {Object} Returns the composed aggregate object.
  26770. * @example
  26771. *
  26772. * var array = [
  26773. * { 'dir': 'left', 'code': 97 },
  26774. * { 'dir': 'right', 'code': 100 }
  26775. * ];
  26776. *
  26777. * _.keyBy(array, function(o) {
  26778. * return String.fromCharCode(o.code);
  26779. * });
  26780. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  26781. *
  26782. * _.keyBy(array, 'dir');
  26783. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  26784. */
  26785. var keyBy = createAggregator(function(result, value, key) {
  26786. baseAssignValue(result, key, value);
  26787. });
  26788. /**
  26789. * Creates an array of values by running each element in `collection` thru
  26790. * `iteratee`. The iteratee is invoked with three arguments:
  26791. * (value, index|key, collection).
  26792. *
  26793. * Many lodash methods are guarded to work as iteratees for methods like
  26794. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  26795. *
  26796. * The guarded methods are:
  26797. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  26798. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  26799. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  26800. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  26801. *
  26802. * @static
  26803. * @memberOf _
  26804. * @since 0.1.0
  26805. * @category Collection
  26806. * @param {Array|Object} collection The collection to iterate over.
  26807. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26808. * @returns {Array} Returns the new mapped array.
  26809. * @example
  26810. *
  26811. * function square(n) {
  26812. * return n * n;
  26813. * }
  26814. *
  26815. * _.map([4, 8], square);
  26816. * // => [16, 64]
  26817. *
  26818. * _.map({ 'a': 4, 'b': 8 }, square);
  26819. * // => [16, 64] (iteration order is not guaranteed)
  26820. *
  26821. * var users = [
  26822. * { 'user': 'barney' },
  26823. * { 'user': 'fred' }
  26824. * ];
  26825. *
  26826. * // The `_.property` iteratee shorthand.
  26827. * _.map(users, 'user');
  26828. * // => ['barney', 'fred']
  26829. */
  26830. function map(collection, iteratee) {
  26831. var func = isArray(collection) ? arrayMap : baseMap;
  26832. return func(collection, getIteratee(iteratee, 3));
  26833. }
  26834. /**
  26835. * This method is like `_.sortBy` except that it allows specifying the sort
  26836. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  26837. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  26838. * descending or "asc" for ascending sort order of corresponding values.
  26839. *
  26840. * @static
  26841. * @memberOf _
  26842. * @since 4.0.0
  26843. * @category Collection
  26844. * @param {Array|Object} collection The collection to iterate over.
  26845. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  26846. * The iteratees to sort by.
  26847. * @param {string[]} [orders] The sort orders of `iteratees`.
  26848. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26849. * @returns {Array} Returns the new sorted array.
  26850. * @example
  26851. *
  26852. * var users = [
  26853. * { 'user': 'fred', 'age': 48 },
  26854. * { 'user': 'barney', 'age': 34 },
  26855. * { 'user': 'fred', 'age': 40 },
  26856. * { 'user': 'barney', 'age': 36 }
  26857. * ];
  26858. *
  26859. * // Sort by `user` in ascending order and by `age` in descending order.
  26860. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  26861. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  26862. */
  26863. function orderBy(collection, iteratees, orders, guard) {
  26864. if (collection == null) {
  26865. return [];
  26866. }
  26867. if (!isArray(iteratees)) {
  26868. iteratees = iteratees == null ? [] : [iteratees];
  26869. }
  26870. orders = guard ? undefined : orders;
  26871. if (!isArray(orders)) {
  26872. orders = orders == null ? [] : [orders];
  26873. }
  26874. return baseOrderBy(collection, iteratees, orders);
  26875. }
  26876. /**
  26877. * Creates an array of elements split into two groups, the first of which
  26878. * contains elements `predicate` returns truthy for, the second of which
  26879. * contains elements `predicate` returns falsey for. The predicate is
  26880. * invoked with one argument: (value).
  26881. *
  26882. * @static
  26883. * @memberOf _
  26884. * @since 3.0.0
  26885. * @category Collection
  26886. * @param {Array|Object} collection The collection to iterate over.
  26887. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26888. * @returns {Array} Returns the array of grouped elements.
  26889. * @example
  26890. *
  26891. * var users = [
  26892. * { 'user': 'barney', 'age': 36, 'active': false },
  26893. * { 'user': 'fred', 'age': 40, 'active': true },
  26894. * { 'user': 'pebbles', 'age': 1, 'active': false }
  26895. * ];
  26896. *
  26897. * _.partition(users, function(o) { return o.active; });
  26898. * // => objects for [['fred'], ['barney', 'pebbles']]
  26899. *
  26900. * // The `_.matches` iteratee shorthand.
  26901. * _.partition(users, { 'age': 1, 'active': false });
  26902. * // => objects for [['pebbles'], ['barney', 'fred']]
  26903. *
  26904. * // The `_.matchesProperty` iteratee shorthand.
  26905. * _.partition(users, ['active', false]);
  26906. * // => objects for [['barney', 'pebbles'], ['fred']]
  26907. *
  26908. * // The `_.property` iteratee shorthand.
  26909. * _.partition(users, 'active');
  26910. * // => objects for [['fred'], ['barney', 'pebbles']]
  26911. */
  26912. var partition = createAggregator(function(result, value, key) {
  26913. result[key ? 0 : 1].push(value);
  26914. }, function() { return [[], []]; });
  26915. /**
  26916. * Reduces `collection` to a value which is the accumulated result of running
  26917. * each element in `collection` thru `iteratee`, where each successive
  26918. * invocation is supplied the return value of the previous. If `accumulator`
  26919. * is not given, the first element of `collection` is used as the initial
  26920. * value. The iteratee is invoked with four arguments:
  26921. * (accumulator, value, index|key, collection).
  26922. *
  26923. * Many lodash methods are guarded to work as iteratees for methods like
  26924. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  26925. *
  26926. * The guarded methods are:
  26927. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  26928. * and `sortBy`
  26929. *
  26930. * @static
  26931. * @memberOf _
  26932. * @since 0.1.0
  26933. * @category Collection
  26934. * @param {Array|Object} collection The collection to iterate over.
  26935. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26936. * @param {*} [accumulator] The initial value.
  26937. * @returns {*} Returns the accumulated value.
  26938. * @see _.reduceRight
  26939. * @example
  26940. *
  26941. * _.reduce([1, 2], function(sum, n) {
  26942. * return sum + n;
  26943. * }, 0);
  26944. * // => 3
  26945. *
  26946. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26947. * (result[value] || (result[value] = [])).push(key);
  26948. * return result;
  26949. * }, {});
  26950. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  26951. */
  26952. function reduce(collection, iteratee, accumulator) {
  26953. var func = isArray(collection) ? arrayReduce : baseReduce,
  26954. initAccum = arguments.length < 3;
  26955. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  26956. }
  26957. /**
  26958. * This method is like `_.reduce` except that it iterates over elements of
  26959. * `collection` from right to left.
  26960. *
  26961. * @static
  26962. * @memberOf _
  26963. * @since 0.1.0
  26964. * @category Collection
  26965. * @param {Array|Object} collection The collection to iterate over.
  26966. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26967. * @param {*} [accumulator] The initial value.
  26968. * @returns {*} Returns the accumulated value.
  26969. * @see _.reduce
  26970. * @example
  26971. *
  26972. * var array = [[0, 1], [2, 3], [4, 5]];
  26973. *
  26974. * _.reduceRight(array, function(flattened, other) {
  26975. * return flattened.concat(other);
  26976. * }, []);
  26977. * // => [4, 5, 2, 3, 0, 1]
  26978. */
  26979. function reduceRight(collection, iteratee, accumulator) {
  26980. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  26981. initAccum = arguments.length < 3;
  26982. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  26983. }
  26984. /**
  26985. * The opposite of `_.filter`; this method returns the elements of `collection`
  26986. * that `predicate` does **not** return truthy for.
  26987. *
  26988. * @static
  26989. * @memberOf _
  26990. * @since 0.1.0
  26991. * @category Collection
  26992. * @param {Array|Object} collection The collection to iterate over.
  26993. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26994. * @returns {Array} Returns the new filtered array.
  26995. * @see _.filter
  26996. * @example
  26997. *
  26998. * var users = [
  26999. * { 'user': 'barney', 'age': 36, 'active': false },
  27000. * { 'user': 'fred', 'age': 40, 'active': true }
  27001. * ];
  27002. *
  27003. * _.reject(users, function(o) { return !o.active; });
  27004. * // => objects for ['fred']
  27005. *
  27006. * // The `_.matches` iteratee shorthand.
  27007. * _.reject(users, { 'age': 40, 'active': true });
  27008. * // => objects for ['barney']
  27009. *
  27010. * // The `_.matchesProperty` iteratee shorthand.
  27011. * _.reject(users, ['active', false]);
  27012. * // => objects for ['fred']
  27013. *
  27014. * // The `_.property` iteratee shorthand.
  27015. * _.reject(users, 'active');
  27016. * // => objects for ['barney']
  27017. */
  27018. function reject(collection, predicate) {
  27019. var func = isArray(collection) ? arrayFilter : baseFilter;
  27020. return func(collection, negate(getIteratee(predicate, 3)));
  27021. }
  27022. /**
  27023. * Gets a random element from `collection`.
  27024. *
  27025. * @static
  27026. * @memberOf _
  27027. * @since 2.0.0
  27028. * @category Collection
  27029. * @param {Array|Object} collection The collection to sample.
  27030. * @returns {*} Returns the random element.
  27031. * @example
  27032. *
  27033. * _.sample([1, 2, 3, 4]);
  27034. * // => 2
  27035. */
  27036. function sample(collection) {
  27037. var func = isArray(collection) ? arraySample : baseSample;
  27038. return func(collection);
  27039. }
  27040. /**
  27041. * Gets `n` random elements at unique keys from `collection` up to the
  27042. * size of `collection`.
  27043. *
  27044. * @static
  27045. * @memberOf _
  27046. * @since 4.0.0
  27047. * @category Collection
  27048. * @param {Array|Object} collection The collection to sample.
  27049. * @param {number} [n=1] The number of elements to sample.
  27050. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27051. * @returns {Array} Returns the random elements.
  27052. * @example
  27053. *
  27054. * _.sampleSize([1, 2, 3], 2);
  27055. * // => [3, 1]
  27056. *
  27057. * _.sampleSize([1, 2, 3], 4);
  27058. * // => [2, 3, 1]
  27059. */
  27060. function sampleSize(collection, n, guard) {
  27061. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27062. n = 1;
  27063. } else {
  27064. n = toInteger(n);
  27065. }
  27066. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27067. return func(collection, n);
  27068. }
  27069. /**
  27070. * Creates an array of shuffled values, using a version of the
  27071. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27072. *
  27073. * @static
  27074. * @memberOf _
  27075. * @since 0.1.0
  27076. * @category Collection
  27077. * @param {Array|Object} collection The collection to shuffle.
  27078. * @returns {Array} Returns the new shuffled array.
  27079. * @example
  27080. *
  27081. * _.shuffle([1, 2, 3, 4]);
  27082. * // => [4, 1, 3, 2]
  27083. */
  27084. function shuffle(collection) {
  27085. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27086. return func(collection);
  27087. }
  27088. /**
  27089. * Gets the size of `collection` by returning its length for array-like
  27090. * values or the number of own enumerable string keyed properties for objects.
  27091. *
  27092. * @static
  27093. * @memberOf _
  27094. * @since 0.1.0
  27095. * @category Collection
  27096. * @param {Array|Object|string} collection The collection to inspect.
  27097. * @returns {number} Returns the collection size.
  27098. * @example
  27099. *
  27100. * _.size([1, 2, 3]);
  27101. * // => 3
  27102. *
  27103. * _.size({ 'a': 1, 'b': 2 });
  27104. * // => 2
  27105. *
  27106. * _.size('pebbles');
  27107. * // => 7
  27108. */
  27109. function size(collection) {
  27110. if (collection == null) {
  27111. return 0;
  27112. }
  27113. if (isArrayLike(collection)) {
  27114. return isString(collection) ? stringSize(collection) : collection.length;
  27115. }
  27116. var tag = getTag(collection);
  27117. if (tag == mapTag || tag == setTag) {
  27118. return collection.size;
  27119. }
  27120. return baseKeys(collection).length;
  27121. }
  27122. /**
  27123. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27124. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27125. * invoked with three arguments: (value, index|key, collection).
  27126. *
  27127. * @static
  27128. * @memberOf _
  27129. * @since 0.1.0
  27130. * @category Collection
  27131. * @param {Array|Object} collection The collection to iterate over.
  27132. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27133. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27134. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27135. * else `false`.
  27136. * @example
  27137. *
  27138. * _.some([null, 0, 'yes', false], Boolean);
  27139. * // => true
  27140. *
  27141. * var users = [
  27142. * { 'user': 'barney', 'active': true },
  27143. * { 'user': 'fred', 'active': false }
  27144. * ];
  27145. *
  27146. * // The `_.matches` iteratee shorthand.
  27147. * _.some(users, { 'user': 'barney', 'active': false });
  27148. * // => false
  27149. *
  27150. * // The `_.matchesProperty` iteratee shorthand.
  27151. * _.some(users, ['active', false]);
  27152. * // => true
  27153. *
  27154. * // The `_.property` iteratee shorthand.
  27155. * _.some(users, 'active');
  27156. * // => true
  27157. */
  27158. function some(collection, predicate, guard) {
  27159. var func = isArray(collection) ? arraySome : baseSome;
  27160. if (guard && isIterateeCall(collection, predicate, guard)) {
  27161. predicate = undefined;
  27162. }
  27163. return func(collection, getIteratee(predicate, 3));
  27164. }
  27165. /**
  27166. * Creates an array of elements, sorted in ascending order by the results of
  27167. * running each element in a collection thru each iteratee. This method
  27168. * performs a stable sort, that is, it preserves the original sort order of
  27169. * equal elements. The iteratees are invoked with one argument: (value).
  27170. *
  27171. * @static
  27172. * @memberOf _
  27173. * @since 0.1.0
  27174. * @category Collection
  27175. * @param {Array|Object} collection The collection to iterate over.
  27176. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27177. * The iteratees to sort by.
  27178. * @returns {Array} Returns the new sorted array.
  27179. * @example
  27180. *
  27181. * var users = [
  27182. * { 'user': 'fred', 'age': 48 },
  27183. * { 'user': 'barney', 'age': 36 },
  27184. * { 'user': 'fred', 'age': 40 },
  27185. * { 'user': 'barney', 'age': 34 }
  27186. * ];
  27187. *
  27188. * _.sortBy(users, [function(o) { return o.user; }]);
  27189. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27190. *
  27191. * _.sortBy(users, ['user', 'age']);
  27192. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27193. */
  27194. var sortBy = baseRest(function(collection, iteratees) {
  27195. if (collection == null) {
  27196. return [];
  27197. }
  27198. var length = iteratees.length;
  27199. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27200. iteratees = [];
  27201. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27202. iteratees = [iteratees[0]];
  27203. }
  27204. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27205. });
  27206. /*------------------------------------------------------------------------*/
  27207. /**
  27208. * Gets the timestamp of the number of milliseconds that have elapsed since
  27209. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27210. *
  27211. * @static
  27212. * @memberOf _
  27213. * @since 2.4.0
  27214. * @category Date
  27215. * @returns {number} Returns the timestamp.
  27216. * @example
  27217. *
  27218. * _.defer(function(stamp) {
  27219. * console.log(_.now() - stamp);
  27220. * }, _.now());
  27221. * // => Logs the number of milliseconds it took for the deferred invocation.
  27222. */
  27223. var now = ctxNow || function() {
  27224. return root.Date.now();
  27225. };
  27226. /*------------------------------------------------------------------------*/
  27227. /**
  27228. * The opposite of `_.before`; this method creates a function that invokes
  27229. * `func` once it's called `n` or more times.
  27230. *
  27231. * @static
  27232. * @memberOf _
  27233. * @since 0.1.0
  27234. * @category Function
  27235. * @param {number} n The number of calls before `func` is invoked.
  27236. * @param {Function} func The function to restrict.
  27237. * @returns {Function} Returns the new restricted function.
  27238. * @example
  27239. *
  27240. * var saves = ['profile', 'settings'];
  27241. *
  27242. * var done = _.after(saves.length, function() {
  27243. * console.log('done saving!');
  27244. * });
  27245. *
  27246. * _.forEach(saves, function(type) {
  27247. * asyncSave({ 'type': type, 'complete': done });
  27248. * });
  27249. * // => Logs 'done saving!' after the two async saves have completed.
  27250. */
  27251. function after(n, func) {
  27252. if (typeof func != 'function') {
  27253. throw new TypeError(FUNC_ERROR_TEXT);
  27254. }
  27255. n = toInteger(n);
  27256. return function() {
  27257. if (--n < 1) {
  27258. return func.apply(this, arguments);
  27259. }
  27260. };
  27261. }
  27262. /**
  27263. * Creates a function that invokes `func`, with up to `n` arguments,
  27264. * ignoring any additional arguments.
  27265. *
  27266. * @static
  27267. * @memberOf _
  27268. * @since 3.0.0
  27269. * @category Function
  27270. * @param {Function} func The function to cap arguments for.
  27271. * @param {number} [n=func.length] The arity cap.
  27272. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27273. * @returns {Function} Returns the new capped function.
  27274. * @example
  27275. *
  27276. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27277. * // => [6, 8, 10]
  27278. */
  27279. function ary(func, n, guard) {
  27280. n = guard ? undefined : n;
  27281. n = (func && n == null) ? func.length : n;
  27282. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27283. }
  27284. /**
  27285. * Creates a function that invokes `func`, with the `this` binding and arguments
  27286. * of the created function, while it's called less than `n` times. Subsequent
  27287. * calls to the created function return the result of the last `func` invocation.
  27288. *
  27289. * @static
  27290. * @memberOf _
  27291. * @since 3.0.0
  27292. * @category Function
  27293. * @param {number} n The number of calls at which `func` is no longer invoked.
  27294. * @param {Function} func The function to restrict.
  27295. * @returns {Function} Returns the new restricted function.
  27296. * @example
  27297. *
  27298. * jQuery(element).on('click', _.before(5, addContactToList));
  27299. * // => Allows adding up to 4 contacts to the list.
  27300. */
  27301. function before(n, func) {
  27302. var result;
  27303. if (typeof func != 'function') {
  27304. throw new TypeError(FUNC_ERROR_TEXT);
  27305. }
  27306. n = toInteger(n);
  27307. return function() {
  27308. if (--n > 0) {
  27309. result = func.apply(this, arguments);
  27310. }
  27311. if (n <= 1) {
  27312. func = undefined;
  27313. }
  27314. return result;
  27315. };
  27316. }
  27317. /**
  27318. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27319. * and `partials` prepended to the arguments it receives.
  27320. *
  27321. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27322. * may be used as a placeholder for partially applied arguments.
  27323. *
  27324. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27325. * property of bound functions.
  27326. *
  27327. * @static
  27328. * @memberOf _
  27329. * @since 0.1.0
  27330. * @category Function
  27331. * @param {Function} func The function to bind.
  27332. * @param {*} thisArg The `this` binding of `func`.
  27333. * @param {...*} [partials] The arguments to be partially applied.
  27334. * @returns {Function} Returns the new bound function.
  27335. * @example
  27336. *
  27337. * function greet(greeting, punctuation) {
  27338. * return greeting + ' ' + this.user + punctuation;
  27339. * }
  27340. *
  27341. * var object = { 'user': 'fred' };
  27342. *
  27343. * var bound = _.bind(greet, object, 'hi');
  27344. * bound('!');
  27345. * // => 'hi fred!'
  27346. *
  27347. * // Bound with placeholders.
  27348. * var bound = _.bind(greet, object, _, '!');
  27349. * bound('hi');
  27350. * // => 'hi fred!'
  27351. */
  27352. var bind = baseRest(function(func, thisArg, partials) {
  27353. var bitmask = WRAP_BIND_FLAG;
  27354. if (partials.length) {
  27355. var holders = replaceHolders(partials, getHolder(bind));
  27356. bitmask |= WRAP_PARTIAL_FLAG;
  27357. }
  27358. return createWrap(func, bitmask, thisArg, partials, holders);
  27359. });
  27360. /**
  27361. * Creates a function that invokes the method at `object[key]` with `partials`
  27362. * prepended to the arguments it receives.
  27363. *
  27364. * This method differs from `_.bind` by allowing bound functions to reference
  27365. * methods that may be redefined or don't yet exist. See
  27366. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27367. * for more details.
  27368. *
  27369. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27370. * builds, may be used as a placeholder for partially applied arguments.
  27371. *
  27372. * @static
  27373. * @memberOf _
  27374. * @since 0.10.0
  27375. * @category Function
  27376. * @param {Object} object The object to invoke the method on.
  27377. * @param {string} key The key of the method.
  27378. * @param {...*} [partials] The arguments to be partially applied.
  27379. * @returns {Function} Returns the new bound function.
  27380. * @example
  27381. *
  27382. * var object = {
  27383. * 'user': 'fred',
  27384. * 'greet': function(greeting, punctuation) {
  27385. * return greeting + ' ' + this.user + punctuation;
  27386. * }
  27387. * };
  27388. *
  27389. * var bound = _.bindKey(object, 'greet', 'hi');
  27390. * bound('!');
  27391. * // => 'hi fred!'
  27392. *
  27393. * object.greet = function(greeting, punctuation) {
  27394. * return greeting + 'ya ' + this.user + punctuation;
  27395. * };
  27396. *
  27397. * bound('!');
  27398. * // => 'hiya fred!'
  27399. *
  27400. * // Bound with placeholders.
  27401. * var bound = _.bindKey(object, 'greet', _, '!');
  27402. * bound('hi');
  27403. * // => 'hiya fred!'
  27404. */
  27405. var bindKey = baseRest(function(object, key, partials) {
  27406. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27407. if (partials.length) {
  27408. var holders = replaceHolders(partials, getHolder(bindKey));
  27409. bitmask |= WRAP_PARTIAL_FLAG;
  27410. }
  27411. return createWrap(key, bitmask, object, partials, holders);
  27412. });
  27413. /**
  27414. * Creates a function that accepts arguments of `func` and either invokes
  27415. * `func` returning its result, if at least `arity` number of arguments have
  27416. * been provided, or returns a function that accepts the remaining `func`
  27417. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27418. * is not sufficient.
  27419. *
  27420. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27421. * may be used as a placeholder for provided arguments.
  27422. *
  27423. * **Note:** This method doesn't set the "length" property of curried functions.
  27424. *
  27425. * @static
  27426. * @memberOf _
  27427. * @since 2.0.0
  27428. * @category Function
  27429. * @param {Function} func The function to curry.
  27430. * @param {number} [arity=func.length] The arity of `func`.
  27431. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27432. * @returns {Function} Returns the new curried function.
  27433. * @example
  27434. *
  27435. * var abc = function(a, b, c) {
  27436. * return [a, b, c];
  27437. * };
  27438. *
  27439. * var curried = _.curry(abc);
  27440. *
  27441. * curried(1)(2)(3);
  27442. * // => [1, 2, 3]
  27443. *
  27444. * curried(1, 2)(3);
  27445. * // => [1, 2, 3]
  27446. *
  27447. * curried(1, 2, 3);
  27448. * // => [1, 2, 3]
  27449. *
  27450. * // Curried with placeholders.
  27451. * curried(1)(_, 3)(2);
  27452. * // => [1, 2, 3]
  27453. */
  27454. function curry(func, arity, guard) {
  27455. arity = guard ? undefined : arity;
  27456. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27457. result.placeholder = curry.placeholder;
  27458. return result;
  27459. }
  27460. /**
  27461. * This method is like `_.curry` except that arguments are applied to `func`
  27462. * in the manner of `_.partialRight` instead of `_.partial`.
  27463. *
  27464. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27465. * builds, may be used as a placeholder for provided arguments.
  27466. *
  27467. * **Note:** This method doesn't set the "length" property of curried functions.
  27468. *
  27469. * @static
  27470. * @memberOf _
  27471. * @since 3.0.0
  27472. * @category Function
  27473. * @param {Function} func The function to curry.
  27474. * @param {number} [arity=func.length] The arity of `func`.
  27475. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27476. * @returns {Function} Returns the new curried function.
  27477. * @example
  27478. *
  27479. * var abc = function(a, b, c) {
  27480. * return [a, b, c];
  27481. * };
  27482. *
  27483. * var curried = _.curryRight(abc);
  27484. *
  27485. * curried(3)(2)(1);
  27486. * // => [1, 2, 3]
  27487. *
  27488. * curried(2, 3)(1);
  27489. * // => [1, 2, 3]
  27490. *
  27491. * curried(1, 2, 3);
  27492. * // => [1, 2, 3]
  27493. *
  27494. * // Curried with placeholders.
  27495. * curried(3)(1, _)(2);
  27496. * // => [1, 2, 3]
  27497. */
  27498. function curryRight(func, arity, guard) {
  27499. arity = guard ? undefined : arity;
  27500. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27501. result.placeholder = curryRight.placeholder;
  27502. return result;
  27503. }
  27504. /**
  27505. * Creates a debounced function that delays invoking `func` until after `wait`
  27506. * milliseconds have elapsed since the last time the debounced function was
  27507. * invoked. The debounced function comes with a `cancel` method to cancel
  27508. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27509. * Provide `options` to indicate whether `func` should be invoked on the
  27510. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27511. * with the last arguments provided to the debounced function. Subsequent
  27512. * calls to the debounced function return the result of the last `func`
  27513. * invocation.
  27514. *
  27515. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27516. * invoked on the trailing edge of the timeout only if the debounced function
  27517. * is invoked more than once during the `wait` timeout.
  27518. *
  27519. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27520. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27521. *
  27522. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27523. * for details over the differences between `_.debounce` and `_.throttle`.
  27524. *
  27525. * @static
  27526. * @memberOf _
  27527. * @since 0.1.0
  27528. * @category Function
  27529. * @param {Function} func The function to debounce.
  27530. * @param {number} [wait=0] The number of milliseconds to delay.
  27531. * @param {Object} [options={}] The options object.
  27532. * @param {boolean} [options.leading=false]
  27533. * Specify invoking on the leading edge of the timeout.
  27534. * @param {number} [options.maxWait]
  27535. * The maximum time `func` is allowed to be delayed before it's invoked.
  27536. * @param {boolean} [options.trailing=true]
  27537. * Specify invoking on the trailing edge of the timeout.
  27538. * @returns {Function} Returns the new debounced function.
  27539. * @example
  27540. *
  27541. * // Avoid costly calculations while the window size is in flux.
  27542. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27543. *
  27544. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27545. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27546. * 'leading': true,
  27547. * 'trailing': false
  27548. * }));
  27549. *
  27550. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27551. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27552. * var source = new EventSource('/stream');
  27553. * jQuery(source).on('message', debounced);
  27554. *
  27555. * // Cancel the trailing debounced invocation.
  27556. * jQuery(window).on('popstate', debounced.cancel);
  27557. */
  27558. function debounce(func, wait, options) {
  27559. var lastArgs,
  27560. lastThis,
  27561. maxWait,
  27562. result,
  27563. timerId,
  27564. lastCallTime,
  27565. lastInvokeTime = 0,
  27566. leading = false,
  27567. maxing = false,
  27568. trailing = true;
  27569. if (typeof func != 'function') {
  27570. throw new TypeError(FUNC_ERROR_TEXT);
  27571. }
  27572. wait = toNumber(wait) || 0;
  27573. if (isObject(options)) {
  27574. leading = !!options.leading;
  27575. maxing = 'maxWait' in options;
  27576. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27577. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27578. }
  27579. function invokeFunc(time) {
  27580. var args = lastArgs,
  27581. thisArg = lastThis;
  27582. lastArgs = lastThis = undefined;
  27583. lastInvokeTime = time;
  27584. result = func.apply(thisArg, args);
  27585. return result;
  27586. }
  27587. function leadingEdge(time) {
  27588. // Reset any `maxWait` timer.
  27589. lastInvokeTime = time;
  27590. // Start the timer for the trailing edge.
  27591. timerId = setTimeout(timerExpired, wait);
  27592. // Invoke the leading edge.
  27593. return leading ? invokeFunc(time) : result;
  27594. }
  27595. function remainingWait(time) {
  27596. var timeSinceLastCall = time - lastCallTime,
  27597. timeSinceLastInvoke = time - lastInvokeTime,
  27598. timeWaiting = wait - timeSinceLastCall;
  27599. return maxing
  27600. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27601. : timeWaiting;
  27602. }
  27603. function shouldInvoke(time) {
  27604. var timeSinceLastCall = time - lastCallTime,
  27605. timeSinceLastInvoke = time - lastInvokeTime;
  27606. // Either this is the first call, activity has stopped and we're at the
  27607. // trailing edge, the system time has gone backwards and we're treating
  27608. // it as the trailing edge, or we've hit the `maxWait` limit.
  27609. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27610. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27611. }
  27612. function timerExpired() {
  27613. var time = now();
  27614. if (shouldInvoke(time)) {
  27615. return trailingEdge(time);
  27616. }
  27617. // Restart the timer.
  27618. timerId = setTimeout(timerExpired, remainingWait(time));
  27619. }
  27620. function trailingEdge(time) {
  27621. timerId = undefined;
  27622. // Only invoke if we have `lastArgs` which means `func` has been
  27623. // debounced at least once.
  27624. if (trailing && lastArgs) {
  27625. return invokeFunc(time);
  27626. }
  27627. lastArgs = lastThis = undefined;
  27628. return result;
  27629. }
  27630. function cancel() {
  27631. if (timerId !== undefined) {
  27632. clearTimeout(timerId);
  27633. }
  27634. lastInvokeTime = 0;
  27635. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27636. }
  27637. function flush() {
  27638. return timerId === undefined ? result : trailingEdge(now());
  27639. }
  27640. function debounced() {
  27641. var time = now(),
  27642. isInvoking = shouldInvoke(time);
  27643. lastArgs = arguments;
  27644. lastThis = this;
  27645. lastCallTime = time;
  27646. if (isInvoking) {
  27647. if (timerId === undefined) {
  27648. return leadingEdge(lastCallTime);
  27649. }
  27650. if (maxing) {
  27651. // Handle invocations in a tight loop.
  27652. clearTimeout(timerId);
  27653. timerId = setTimeout(timerExpired, wait);
  27654. return invokeFunc(lastCallTime);
  27655. }
  27656. }
  27657. if (timerId === undefined) {
  27658. timerId = setTimeout(timerExpired, wait);
  27659. }
  27660. return result;
  27661. }
  27662. debounced.cancel = cancel;
  27663. debounced.flush = flush;
  27664. return debounced;
  27665. }
  27666. /**
  27667. * Defers invoking the `func` until the current call stack has cleared. Any
  27668. * additional arguments are provided to `func` when it's invoked.
  27669. *
  27670. * @static
  27671. * @memberOf _
  27672. * @since 0.1.0
  27673. * @category Function
  27674. * @param {Function} func The function to defer.
  27675. * @param {...*} [args] The arguments to invoke `func` with.
  27676. * @returns {number} Returns the timer id.
  27677. * @example
  27678. *
  27679. * _.defer(function(text) {
  27680. * console.log(text);
  27681. * }, 'deferred');
  27682. * // => Logs 'deferred' after one millisecond.
  27683. */
  27684. var defer = baseRest(function(func, args) {
  27685. return baseDelay(func, 1, args);
  27686. });
  27687. /**
  27688. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27689. * provided to `func` when it's invoked.
  27690. *
  27691. * @static
  27692. * @memberOf _
  27693. * @since 0.1.0
  27694. * @category Function
  27695. * @param {Function} func The function to delay.
  27696. * @param {number} wait The number of milliseconds to delay invocation.
  27697. * @param {...*} [args] The arguments to invoke `func` with.
  27698. * @returns {number} Returns the timer id.
  27699. * @example
  27700. *
  27701. * _.delay(function(text) {
  27702. * console.log(text);
  27703. * }, 1000, 'later');
  27704. * // => Logs 'later' after one second.
  27705. */
  27706. var delay = baseRest(function(func, wait, args) {
  27707. return baseDelay(func, toNumber(wait) || 0, args);
  27708. });
  27709. /**
  27710. * Creates a function that invokes `func` with arguments reversed.
  27711. *
  27712. * @static
  27713. * @memberOf _
  27714. * @since 4.0.0
  27715. * @category Function
  27716. * @param {Function} func The function to flip arguments for.
  27717. * @returns {Function} Returns the new flipped function.
  27718. * @example
  27719. *
  27720. * var flipped = _.flip(function() {
  27721. * return _.toArray(arguments);
  27722. * });
  27723. *
  27724. * flipped('a', 'b', 'c', 'd');
  27725. * // => ['d', 'c', 'b', 'a']
  27726. */
  27727. function flip(func) {
  27728. return createWrap(func, WRAP_FLIP_FLAG);
  27729. }
  27730. /**
  27731. * Creates a function that memoizes the result of `func`. If `resolver` is
  27732. * provided, it determines the cache key for storing the result based on the
  27733. * arguments provided to the memoized function. By default, the first argument
  27734. * provided to the memoized function is used as the map cache key. The `func`
  27735. * is invoked with the `this` binding of the memoized function.
  27736. *
  27737. * **Note:** The cache is exposed as the `cache` property on the memoized
  27738. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  27739. * constructor with one whose instances implement the
  27740. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  27741. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  27742. *
  27743. * @static
  27744. * @memberOf _
  27745. * @since 0.1.0
  27746. * @category Function
  27747. * @param {Function} func The function to have its output memoized.
  27748. * @param {Function} [resolver] The function to resolve the cache key.
  27749. * @returns {Function} Returns the new memoized function.
  27750. * @example
  27751. *
  27752. * var object = { 'a': 1, 'b': 2 };
  27753. * var other = { 'c': 3, 'd': 4 };
  27754. *
  27755. * var values = _.memoize(_.values);
  27756. * values(object);
  27757. * // => [1, 2]
  27758. *
  27759. * values(other);
  27760. * // => [3, 4]
  27761. *
  27762. * object.a = 2;
  27763. * values(object);
  27764. * // => [1, 2]
  27765. *
  27766. * // Modify the result cache.
  27767. * values.cache.set(object, ['a', 'b']);
  27768. * values(object);
  27769. * // => ['a', 'b']
  27770. *
  27771. * // Replace `_.memoize.Cache`.
  27772. * _.memoize.Cache = WeakMap;
  27773. */
  27774. function memoize(func, resolver) {
  27775. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  27776. throw new TypeError(FUNC_ERROR_TEXT);
  27777. }
  27778. var memoized = function() {
  27779. var args = arguments,
  27780. key = resolver ? resolver.apply(this, args) : args[0],
  27781. cache = memoized.cache;
  27782. if (cache.has(key)) {
  27783. return cache.get(key);
  27784. }
  27785. var result = func.apply(this, args);
  27786. memoized.cache = cache.set(key, result) || cache;
  27787. return result;
  27788. };
  27789. memoized.cache = new (memoize.Cache || MapCache);
  27790. return memoized;
  27791. }
  27792. // Expose `MapCache`.
  27793. memoize.Cache = MapCache;
  27794. /**
  27795. * Creates a function that negates the result of the predicate `func`. The
  27796. * `func` predicate is invoked with the `this` binding and arguments of the
  27797. * created function.
  27798. *
  27799. * @static
  27800. * @memberOf _
  27801. * @since 3.0.0
  27802. * @category Function
  27803. * @param {Function} predicate The predicate to negate.
  27804. * @returns {Function} Returns the new negated function.
  27805. * @example
  27806. *
  27807. * function isEven(n) {
  27808. * return n % 2 == 0;
  27809. * }
  27810. *
  27811. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  27812. * // => [1, 3, 5]
  27813. */
  27814. function negate(predicate) {
  27815. if (typeof predicate != 'function') {
  27816. throw new TypeError(FUNC_ERROR_TEXT);
  27817. }
  27818. return function() {
  27819. var args = arguments;
  27820. switch (args.length) {
  27821. case 0: return !predicate.call(this);
  27822. case 1: return !predicate.call(this, args[0]);
  27823. case 2: return !predicate.call(this, args[0], args[1]);
  27824. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  27825. }
  27826. return !predicate.apply(this, args);
  27827. };
  27828. }
  27829. /**
  27830. * Creates a function that is restricted to invoking `func` once. Repeat calls
  27831. * to the function return the value of the first invocation. The `func` is
  27832. * invoked with the `this` binding and arguments of the created function.
  27833. *
  27834. * @static
  27835. * @memberOf _
  27836. * @since 0.1.0
  27837. * @category Function
  27838. * @param {Function} func The function to restrict.
  27839. * @returns {Function} Returns the new restricted function.
  27840. * @example
  27841. *
  27842. * var initialize = _.once(createApplication);
  27843. * initialize();
  27844. * initialize();
  27845. * // => `createApplication` is invoked once
  27846. */
  27847. function once(func) {
  27848. return before(2, func);
  27849. }
  27850. /**
  27851. * Creates a function that invokes `func` with its arguments transformed.
  27852. *
  27853. * @static
  27854. * @since 4.0.0
  27855. * @memberOf _
  27856. * @category Function
  27857. * @param {Function} func The function to wrap.
  27858. * @param {...(Function|Function[])} [transforms=[_.identity]]
  27859. * The argument transforms.
  27860. * @returns {Function} Returns the new function.
  27861. * @example
  27862. *
  27863. * function doubled(n) {
  27864. * return n * 2;
  27865. * }
  27866. *
  27867. * function square(n) {
  27868. * return n * n;
  27869. * }
  27870. *
  27871. * var func = _.overArgs(function(x, y) {
  27872. * return [x, y];
  27873. * }, [square, doubled]);
  27874. *
  27875. * func(9, 3);
  27876. * // => [81, 6]
  27877. *
  27878. * func(10, 5);
  27879. * // => [100, 10]
  27880. */
  27881. var overArgs = castRest(function(func, transforms) {
  27882. transforms = (transforms.length == 1 && isArray(transforms[0]))
  27883. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  27884. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  27885. var funcsLength = transforms.length;
  27886. return baseRest(function(args) {
  27887. var index = -1,
  27888. length = nativeMin(args.length, funcsLength);
  27889. while (++index < length) {
  27890. args[index] = transforms[index].call(this, args[index]);
  27891. }
  27892. return apply(func, this, args);
  27893. });
  27894. });
  27895. /**
  27896. * Creates a function that invokes `func` with `partials` prepended to the
  27897. * arguments it receives. This method is like `_.bind` except it does **not**
  27898. * alter the `this` binding.
  27899. *
  27900. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  27901. * builds, may be used as a placeholder for partially applied arguments.
  27902. *
  27903. * **Note:** This method doesn't set the "length" property of partially
  27904. * applied functions.
  27905. *
  27906. * @static
  27907. * @memberOf _
  27908. * @since 0.2.0
  27909. * @category Function
  27910. * @param {Function} func The function to partially apply arguments to.
  27911. * @param {...*} [partials] The arguments to be partially applied.
  27912. * @returns {Function} Returns the new partially applied function.
  27913. * @example
  27914. *
  27915. * function greet(greeting, name) {
  27916. * return greeting + ' ' + name;
  27917. * }
  27918. *
  27919. * var sayHelloTo = _.partial(greet, 'hello');
  27920. * sayHelloTo('fred');
  27921. * // => 'hello fred'
  27922. *
  27923. * // Partially applied with placeholders.
  27924. * var greetFred = _.partial(greet, _, 'fred');
  27925. * greetFred('hi');
  27926. * // => 'hi fred'
  27927. */
  27928. var partial = baseRest(function(func, partials) {
  27929. var holders = replaceHolders(partials, getHolder(partial));
  27930. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  27931. });
  27932. /**
  27933. * This method is like `_.partial` except that partially applied arguments
  27934. * are appended to the arguments it receives.
  27935. *
  27936. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  27937. * builds, may be used as a placeholder for partially applied arguments.
  27938. *
  27939. * **Note:** This method doesn't set the "length" property of partially
  27940. * applied functions.
  27941. *
  27942. * @static
  27943. * @memberOf _
  27944. * @since 1.0.0
  27945. * @category Function
  27946. * @param {Function} func The function to partially apply arguments to.
  27947. * @param {...*} [partials] The arguments to be partially applied.
  27948. * @returns {Function} Returns the new partially applied function.
  27949. * @example
  27950. *
  27951. * function greet(greeting, name) {
  27952. * return greeting + ' ' + name;
  27953. * }
  27954. *
  27955. * var greetFred = _.partialRight(greet, 'fred');
  27956. * greetFred('hi');
  27957. * // => 'hi fred'
  27958. *
  27959. * // Partially applied with placeholders.
  27960. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  27961. * sayHelloTo('fred');
  27962. * // => 'hello fred'
  27963. */
  27964. var partialRight = baseRest(function(func, partials) {
  27965. var holders = replaceHolders(partials, getHolder(partialRight));
  27966. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  27967. });
  27968. /**
  27969. * Creates a function that invokes `func` with arguments arranged according
  27970. * to the specified `indexes` where the argument value at the first index is
  27971. * provided as the first argument, the argument value at the second index is
  27972. * provided as the second argument, and so on.
  27973. *
  27974. * @static
  27975. * @memberOf _
  27976. * @since 3.0.0
  27977. * @category Function
  27978. * @param {Function} func The function to rearrange arguments for.
  27979. * @param {...(number|number[])} indexes The arranged argument indexes.
  27980. * @returns {Function} Returns the new function.
  27981. * @example
  27982. *
  27983. * var rearged = _.rearg(function(a, b, c) {
  27984. * return [a, b, c];
  27985. * }, [2, 0, 1]);
  27986. *
  27987. * rearged('b', 'c', 'a')
  27988. * // => ['a', 'b', 'c']
  27989. */
  27990. var rearg = flatRest(function(func, indexes) {
  27991. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  27992. });
  27993. /**
  27994. * Creates a function that invokes `func` with the `this` binding of the
  27995. * created function and arguments from `start` and beyond provided as
  27996. * an array.
  27997. *
  27998. * **Note:** This method is based on the
  27999. * [rest parameter](https://mdn.io/rest_parameters).
  28000. *
  28001. * @static
  28002. * @memberOf _
  28003. * @since 4.0.0
  28004. * @category Function
  28005. * @param {Function} func The function to apply a rest parameter to.
  28006. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28007. * @returns {Function} Returns the new function.
  28008. * @example
  28009. *
  28010. * var say = _.rest(function(what, names) {
  28011. * return what + ' ' + _.initial(names).join(', ') +
  28012. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28013. * });
  28014. *
  28015. * say('hello', 'fred', 'barney', 'pebbles');
  28016. * // => 'hello fred, barney, & pebbles'
  28017. */
  28018. function rest(func, start) {
  28019. if (typeof func != 'function') {
  28020. throw new TypeError(FUNC_ERROR_TEXT);
  28021. }
  28022. start = start === undefined ? start : toInteger(start);
  28023. return baseRest(func, start);
  28024. }
  28025. /**
  28026. * Creates a function that invokes `func` with the `this` binding of the
  28027. * create function and an array of arguments much like
  28028. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28029. *
  28030. * **Note:** This method is based on the
  28031. * [spread operator](https://mdn.io/spread_operator).
  28032. *
  28033. * @static
  28034. * @memberOf _
  28035. * @since 3.2.0
  28036. * @category Function
  28037. * @param {Function} func The function to spread arguments over.
  28038. * @param {number} [start=0] The start position of the spread.
  28039. * @returns {Function} Returns the new function.
  28040. * @example
  28041. *
  28042. * var say = _.spread(function(who, what) {
  28043. * return who + ' says ' + what;
  28044. * });
  28045. *
  28046. * say(['fred', 'hello']);
  28047. * // => 'fred says hello'
  28048. *
  28049. * var numbers = Promise.all([
  28050. * Promise.resolve(40),
  28051. * Promise.resolve(36)
  28052. * ]);
  28053. *
  28054. * numbers.then(_.spread(function(x, y) {
  28055. * return x + y;
  28056. * }));
  28057. * // => a Promise of 76
  28058. */
  28059. function spread(func, start) {
  28060. if (typeof func != 'function') {
  28061. throw new TypeError(FUNC_ERROR_TEXT);
  28062. }
  28063. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28064. return baseRest(function(args) {
  28065. var array = args[start],
  28066. otherArgs = castSlice(args, 0, start);
  28067. if (array) {
  28068. arrayPush(otherArgs, array);
  28069. }
  28070. return apply(func, this, otherArgs);
  28071. });
  28072. }
  28073. /**
  28074. * Creates a throttled function that only invokes `func` at most once per
  28075. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28076. * method to cancel delayed `func` invocations and a `flush` method to
  28077. * immediately invoke them. Provide `options` to indicate whether `func`
  28078. * should be invoked on the leading and/or trailing edge of the `wait`
  28079. * timeout. The `func` is invoked with the last arguments provided to the
  28080. * throttled function. Subsequent calls to the throttled function return the
  28081. * result of the last `func` invocation.
  28082. *
  28083. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28084. * invoked on the trailing edge of the timeout only if the throttled function
  28085. * is invoked more than once during the `wait` timeout.
  28086. *
  28087. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28088. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28089. *
  28090. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28091. * for details over the differences between `_.throttle` and `_.debounce`.
  28092. *
  28093. * @static
  28094. * @memberOf _
  28095. * @since 0.1.0
  28096. * @category Function
  28097. * @param {Function} func The function to throttle.
  28098. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28099. * @param {Object} [options={}] The options object.
  28100. * @param {boolean} [options.leading=true]
  28101. * Specify invoking on the leading edge of the timeout.
  28102. * @param {boolean} [options.trailing=true]
  28103. * Specify invoking on the trailing edge of the timeout.
  28104. * @returns {Function} Returns the new throttled function.
  28105. * @example
  28106. *
  28107. * // Avoid excessively updating the position while scrolling.
  28108. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28109. *
  28110. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28111. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28112. * jQuery(element).on('click', throttled);
  28113. *
  28114. * // Cancel the trailing throttled invocation.
  28115. * jQuery(window).on('popstate', throttled.cancel);
  28116. */
  28117. function throttle(func, wait, options) {
  28118. var leading = true,
  28119. trailing = true;
  28120. if (typeof func != 'function') {
  28121. throw new TypeError(FUNC_ERROR_TEXT);
  28122. }
  28123. if (isObject(options)) {
  28124. leading = 'leading' in options ? !!options.leading : leading;
  28125. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28126. }
  28127. return debounce(func, wait, {
  28128. 'leading': leading,
  28129. 'maxWait': wait,
  28130. 'trailing': trailing
  28131. });
  28132. }
  28133. /**
  28134. * Creates a function that accepts up to one argument, ignoring any
  28135. * additional arguments.
  28136. *
  28137. * @static
  28138. * @memberOf _
  28139. * @since 4.0.0
  28140. * @category Function
  28141. * @param {Function} func The function to cap arguments for.
  28142. * @returns {Function} Returns the new capped function.
  28143. * @example
  28144. *
  28145. * _.map(['6', '8', '10'], _.unary(parseInt));
  28146. * // => [6, 8, 10]
  28147. */
  28148. function unary(func) {
  28149. return ary(func, 1);
  28150. }
  28151. /**
  28152. * Creates a function that provides `value` to `wrapper` as its first
  28153. * argument. Any additional arguments provided to the function are appended
  28154. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28155. * binding of the created function.
  28156. *
  28157. * @static
  28158. * @memberOf _
  28159. * @since 0.1.0
  28160. * @category Function
  28161. * @param {*} value The value to wrap.
  28162. * @param {Function} [wrapper=identity] The wrapper function.
  28163. * @returns {Function} Returns the new function.
  28164. * @example
  28165. *
  28166. * var p = _.wrap(_.escape, function(func, text) {
  28167. * return '<p>' + func(text) + '</p>';
  28168. * });
  28169. *
  28170. * p('fred, barney, & pebbles');
  28171. * // => '<p>fred, barney, &amp; pebbles</p>'
  28172. */
  28173. function wrap(value, wrapper) {
  28174. return partial(castFunction(wrapper), value);
  28175. }
  28176. /*------------------------------------------------------------------------*/
  28177. /**
  28178. * Casts `value` as an array if it's not one.
  28179. *
  28180. * @static
  28181. * @memberOf _
  28182. * @since 4.4.0
  28183. * @category Lang
  28184. * @param {*} value The value to inspect.
  28185. * @returns {Array} Returns the cast array.
  28186. * @example
  28187. *
  28188. * _.castArray(1);
  28189. * // => [1]
  28190. *
  28191. * _.castArray({ 'a': 1 });
  28192. * // => [{ 'a': 1 }]
  28193. *
  28194. * _.castArray('abc');
  28195. * // => ['abc']
  28196. *
  28197. * _.castArray(null);
  28198. * // => [null]
  28199. *
  28200. * _.castArray(undefined);
  28201. * // => [undefined]
  28202. *
  28203. * _.castArray();
  28204. * // => []
  28205. *
  28206. * var array = [1, 2, 3];
  28207. * console.log(_.castArray(array) === array);
  28208. * // => true
  28209. */
  28210. function castArray() {
  28211. if (!arguments.length) {
  28212. return [];
  28213. }
  28214. var value = arguments[0];
  28215. return isArray(value) ? value : [value];
  28216. }
  28217. /**
  28218. * Creates a shallow clone of `value`.
  28219. *
  28220. * **Note:** This method is loosely based on the
  28221. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28222. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28223. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28224. * arrays. The own enumerable properties of `arguments` objects are cloned
  28225. * as plain objects. An empty object is returned for uncloneable values such
  28226. * as error objects, functions, DOM nodes, and WeakMaps.
  28227. *
  28228. * @static
  28229. * @memberOf _
  28230. * @since 0.1.0
  28231. * @category Lang
  28232. * @param {*} value The value to clone.
  28233. * @returns {*} Returns the cloned value.
  28234. * @see _.cloneDeep
  28235. * @example
  28236. *
  28237. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28238. *
  28239. * var shallow = _.clone(objects);
  28240. * console.log(shallow[0] === objects[0]);
  28241. * // => true
  28242. */
  28243. function clone(value) {
  28244. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28245. }
  28246. /**
  28247. * This method is like `_.clone` except that it accepts `customizer` which
  28248. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28249. * cloning is handled by the method instead. The `customizer` is invoked with
  28250. * up to four arguments; (value [, index|key, object, stack]).
  28251. *
  28252. * @static
  28253. * @memberOf _
  28254. * @since 4.0.0
  28255. * @category Lang
  28256. * @param {*} value The value to clone.
  28257. * @param {Function} [customizer] The function to customize cloning.
  28258. * @returns {*} Returns the cloned value.
  28259. * @see _.cloneDeepWith
  28260. * @example
  28261. *
  28262. * function customizer(value) {
  28263. * if (_.isElement(value)) {
  28264. * return value.cloneNode(false);
  28265. * }
  28266. * }
  28267. *
  28268. * var el = _.cloneWith(document.body, customizer);
  28269. *
  28270. * console.log(el === document.body);
  28271. * // => false
  28272. * console.log(el.nodeName);
  28273. * // => 'BODY'
  28274. * console.log(el.childNodes.length);
  28275. * // => 0
  28276. */
  28277. function cloneWith(value, customizer) {
  28278. customizer = typeof customizer == 'function' ? customizer : undefined;
  28279. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28280. }
  28281. /**
  28282. * This method is like `_.clone` except that it recursively clones `value`.
  28283. *
  28284. * @static
  28285. * @memberOf _
  28286. * @since 1.0.0
  28287. * @category Lang
  28288. * @param {*} value The value to recursively clone.
  28289. * @returns {*} Returns the deep cloned value.
  28290. * @see _.clone
  28291. * @example
  28292. *
  28293. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28294. *
  28295. * var deep = _.cloneDeep(objects);
  28296. * console.log(deep[0] === objects[0]);
  28297. * // => false
  28298. */
  28299. function cloneDeep(value) {
  28300. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28301. }
  28302. /**
  28303. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28304. *
  28305. * @static
  28306. * @memberOf _
  28307. * @since 4.0.0
  28308. * @category Lang
  28309. * @param {*} value The value to recursively clone.
  28310. * @param {Function} [customizer] The function to customize cloning.
  28311. * @returns {*} Returns the deep cloned value.
  28312. * @see _.cloneWith
  28313. * @example
  28314. *
  28315. * function customizer(value) {
  28316. * if (_.isElement(value)) {
  28317. * return value.cloneNode(true);
  28318. * }
  28319. * }
  28320. *
  28321. * var el = _.cloneDeepWith(document.body, customizer);
  28322. *
  28323. * console.log(el === document.body);
  28324. * // => false
  28325. * console.log(el.nodeName);
  28326. * // => 'BODY'
  28327. * console.log(el.childNodes.length);
  28328. * // => 20
  28329. */
  28330. function cloneDeepWith(value, customizer) {
  28331. customizer = typeof customizer == 'function' ? customizer : undefined;
  28332. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28333. }
  28334. /**
  28335. * Checks if `object` conforms to `source` by invoking the predicate
  28336. * properties of `source` with the corresponding property values of `object`.
  28337. *
  28338. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28339. * partially applied.
  28340. *
  28341. * @static
  28342. * @memberOf _
  28343. * @since 4.14.0
  28344. * @category Lang
  28345. * @param {Object} object The object to inspect.
  28346. * @param {Object} source The object of property predicates to conform to.
  28347. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28348. * @example
  28349. *
  28350. * var object = { 'a': 1, 'b': 2 };
  28351. *
  28352. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28353. * // => true
  28354. *
  28355. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28356. * // => false
  28357. */
  28358. function conformsTo(object, source) {
  28359. return source == null || baseConformsTo(object, source, keys(source));
  28360. }
  28361. /**
  28362. * Performs a
  28363. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28364. * comparison between two values to determine if they are equivalent.
  28365. *
  28366. * @static
  28367. * @memberOf _
  28368. * @since 4.0.0
  28369. * @category Lang
  28370. * @param {*} value The value to compare.
  28371. * @param {*} other The other value to compare.
  28372. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28373. * @example
  28374. *
  28375. * var object = { 'a': 1 };
  28376. * var other = { 'a': 1 };
  28377. *
  28378. * _.eq(object, object);
  28379. * // => true
  28380. *
  28381. * _.eq(object, other);
  28382. * // => false
  28383. *
  28384. * _.eq('a', 'a');
  28385. * // => true
  28386. *
  28387. * _.eq('a', Object('a'));
  28388. * // => false
  28389. *
  28390. * _.eq(NaN, NaN);
  28391. * // => true
  28392. */
  28393. function eq(value, other) {
  28394. return value === other || (value !== value && other !== other);
  28395. }
  28396. /**
  28397. * Checks if `value` is greater than `other`.
  28398. *
  28399. * @static
  28400. * @memberOf _
  28401. * @since 3.9.0
  28402. * @category Lang
  28403. * @param {*} value The value to compare.
  28404. * @param {*} other The other value to compare.
  28405. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28406. * else `false`.
  28407. * @see _.lt
  28408. * @example
  28409. *
  28410. * _.gt(3, 1);
  28411. * // => true
  28412. *
  28413. * _.gt(3, 3);
  28414. * // => false
  28415. *
  28416. * _.gt(1, 3);
  28417. * // => false
  28418. */
  28419. var gt = createRelationalOperation(baseGt);
  28420. /**
  28421. * Checks if `value` is greater than or equal to `other`.
  28422. *
  28423. * @static
  28424. * @memberOf _
  28425. * @since 3.9.0
  28426. * @category Lang
  28427. * @param {*} value The value to compare.
  28428. * @param {*} other The other value to compare.
  28429. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28430. * `other`, else `false`.
  28431. * @see _.lte
  28432. * @example
  28433. *
  28434. * _.gte(3, 1);
  28435. * // => true
  28436. *
  28437. * _.gte(3, 3);
  28438. * // => true
  28439. *
  28440. * _.gte(1, 3);
  28441. * // => false
  28442. */
  28443. var gte = createRelationalOperation(function(value, other) {
  28444. return value >= other;
  28445. });
  28446. /**
  28447. * Checks if `value` is likely an `arguments` object.
  28448. *
  28449. * @static
  28450. * @memberOf _
  28451. * @since 0.1.0
  28452. * @category Lang
  28453. * @param {*} value The value to check.
  28454. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28455. * else `false`.
  28456. * @example
  28457. *
  28458. * _.isArguments(function() { return arguments; }());
  28459. * // => true
  28460. *
  28461. * _.isArguments([1, 2, 3]);
  28462. * // => false
  28463. */
  28464. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28465. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28466. !propertyIsEnumerable.call(value, 'callee');
  28467. };
  28468. /**
  28469. * Checks if `value` is classified as an `Array` object.
  28470. *
  28471. * @static
  28472. * @memberOf _
  28473. * @since 0.1.0
  28474. * @category Lang
  28475. * @param {*} value The value to check.
  28476. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28477. * @example
  28478. *
  28479. * _.isArray([1, 2, 3]);
  28480. * // => true
  28481. *
  28482. * _.isArray(document.body.children);
  28483. * // => false
  28484. *
  28485. * _.isArray('abc');
  28486. * // => false
  28487. *
  28488. * _.isArray(_.noop);
  28489. * // => false
  28490. */
  28491. var isArray = Array.isArray;
  28492. /**
  28493. * Checks if `value` is classified as an `ArrayBuffer` object.
  28494. *
  28495. * @static
  28496. * @memberOf _
  28497. * @since 4.3.0
  28498. * @category Lang
  28499. * @param {*} value The value to check.
  28500. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28501. * @example
  28502. *
  28503. * _.isArrayBuffer(new ArrayBuffer(2));
  28504. * // => true
  28505. *
  28506. * _.isArrayBuffer(new Array(2));
  28507. * // => false
  28508. */
  28509. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28510. /**
  28511. * Checks if `value` is array-like. A value is considered array-like if it's
  28512. * not a function and has a `value.length` that's an integer greater than or
  28513. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28514. *
  28515. * @static
  28516. * @memberOf _
  28517. * @since 4.0.0
  28518. * @category Lang
  28519. * @param {*} value The value to check.
  28520. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28521. * @example
  28522. *
  28523. * _.isArrayLike([1, 2, 3]);
  28524. * // => true
  28525. *
  28526. * _.isArrayLike(document.body.children);
  28527. * // => true
  28528. *
  28529. * _.isArrayLike('abc');
  28530. * // => true
  28531. *
  28532. * _.isArrayLike(_.noop);
  28533. * // => false
  28534. */
  28535. function isArrayLike(value) {
  28536. return value != null && isLength(value.length) && !isFunction(value);
  28537. }
  28538. /**
  28539. * This method is like `_.isArrayLike` except that it also checks if `value`
  28540. * is an object.
  28541. *
  28542. * @static
  28543. * @memberOf _
  28544. * @since 4.0.0
  28545. * @category Lang
  28546. * @param {*} value The value to check.
  28547. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28548. * else `false`.
  28549. * @example
  28550. *
  28551. * _.isArrayLikeObject([1, 2, 3]);
  28552. * // => true
  28553. *
  28554. * _.isArrayLikeObject(document.body.children);
  28555. * // => true
  28556. *
  28557. * _.isArrayLikeObject('abc');
  28558. * // => false
  28559. *
  28560. * _.isArrayLikeObject(_.noop);
  28561. * // => false
  28562. */
  28563. function isArrayLikeObject(value) {
  28564. return isObjectLike(value) && isArrayLike(value);
  28565. }
  28566. /**
  28567. * Checks if `value` is classified as a boolean primitive or object.
  28568. *
  28569. * @static
  28570. * @memberOf _
  28571. * @since 0.1.0
  28572. * @category Lang
  28573. * @param {*} value The value to check.
  28574. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28575. * @example
  28576. *
  28577. * _.isBoolean(false);
  28578. * // => true
  28579. *
  28580. * _.isBoolean(null);
  28581. * // => false
  28582. */
  28583. function isBoolean(value) {
  28584. return value === true || value === false ||
  28585. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28586. }
  28587. /**
  28588. * Checks if `value` is a buffer.
  28589. *
  28590. * @static
  28591. * @memberOf _
  28592. * @since 4.3.0
  28593. * @category Lang
  28594. * @param {*} value The value to check.
  28595. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28596. * @example
  28597. *
  28598. * _.isBuffer(new Buffer(2));
  28599. * // => true
  28600. *
  28601. * _.isBuffer(new Uint8Array(2));
  28602. * // => false
  28603. */
  28604. var isBuffer = nativeIsBuffer || stubFalse;
  28605. /**
  28606. * Checks if `value` is classified as a `Date` object.
  28607. *
  28608. * @static
  28609. * @memberOf _
  28610. * @since 0.1.0
  28611. * @category Lang
  28612. * @param {*} value The value to check.
  28613. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28614. * @example
  28615. *
  28616. * _.isDate(new Date);
  28617. * // => true
  28618. *
  28619. * _.isDate('Mon April 23 2012');
  28620. * // => false
  28621. */
  28622. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28623. /**
  28624. * Checks if `value` is likely a DOM element.
  28625. *
  28626. * @static
  28627. * @memberOf _
  28628. * @since 0.1.0
  28629. * @category Lang
  28630. * @param {*} value The value to check.
  28631. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28632. * @example
  28633. *
  28634. * _.isElement(document.body);
  28635. * // => true
  28636. *
  28637. * _.isElement('<body>');
  28638. * // => false
  28639. */
  28640. function isElement(value) {
  28641. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28642. }
  28643. /**
  28644. * Checks if `value` is an empty object, collection, map, or set.
  28645. *
  28646. * Objects are considered empty if they have no own enumerable string keyed
  28647. * properties.
  28648. *
  28649. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28650. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28651. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28652. *
  28653. * @static
  28654. * @memberOf _
  28655. * @since 0.1.0
  28656. * @category Lang
  28657. * @param {*} value The value to check.
  28658. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28659. * @example
  28660. *
  28661. * _.isEmpty(null);
  28662. * // => true
  28663. *
  28664. * _.isEmpty(true);
  28665. * // => true
  28666. *
  28667. * _.isEmpty(1);
  28668. * // => true
  28669. *
  28670. * _.isEmpty([1, 2, 3]);
  28671. * // => false
  28672. *
  28673. * _.isEmpty({ 'a': 1 });
  28674. * // => false
  28675. */
  28676. function isEmpty(value) {
  28677. if (value == null) {
  28678. return true;
  28679. }
  28680. if (isArrayLike(value) &&
  28681. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28682. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28683. return !value.length;
  28684. }
  28685. var tag = getTag(value);
  28686. if (tag == mapTag || tag == setTag) {
  28687. return !value.size;
  28688. }
  28689. if (isPrototype(value)) {
  28690. return !baseKeys(value).length;
  28691. }
  28692. for (var key in value) {
  28693. if (hasOwnProperty.call(value, key)) {
  28694. return false;
  28695. }
  28696. }
  28697. return true;
  28698. }
  28699. /**
  28700. * Performs a deep comparison between two values to determine if they are
  28701. * equivalent.
  28702. *
  28703. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28704. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28705. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28706. * by their own, not inherited, enumerable properties. Functions and DOM
  28707. * nodes are compared by strict equality, i.e. `===`.
  28708. *
  28709. * @static
  28710. * @memberOf _
  28711. * @since 0.1.0
  28712. * @category Lang
  28713. * @param {*} value The value to compare.
  28714. * @param {*} other The other value to compare.
  28715. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28716. * @example
  28717. *
  28718. * var object = { 'a': 1 };
  28719. * var other = { 'a': 1 };
  28720. *
  28721. * _.isEqual(object, other);
  28722. * // => true
  28723. *
  28724. * object === other;
  28725. * // => false
  28726. */
  28727. function isEqual(value, other) {
  28728. return baseIsEqual(value, other);
  28729. }
  28730. /**
  28731. * This method is like `_.isEqual` except that it accepts `customizer` which
  28732. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28733. * are handled by the method instead. The `customizer` is invoked with up to
  28734. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  28735. *
  28736. * @static
  28737. * @memberOf _
  28738. * @since 4.0.0
  28739. * @category Lang
  28740. * @param {*} value The value to compare.
  28741. * @param {*} other The other value to compare.
  28742. * @param {Function} [customizer] The function to customize comparisons.
  28743. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28744. * @example
  28745. *
  28746. * function isGreeting(value) {
  28747. * return /^h(?:i|ello)$/.test(value);
  28748. * }
  28749. *
  28750. * function customizer(objValue, othValue) {
  28751. * if (isGreeting(objValue) && isGreeting(othValue)) {
  28752. * return true;
  28753. * }
  28754. * }
  28755. *
  28756. * var array = ['hello', 'goodbye'];
  28757. * var other = ['hi', 'goodbye'];
  28758. *
  28759. * _.isEqualWith(array, other, customizer);
  28760. * // => true
  28761. */
  28762. function isEqualWith(value, other, customizer) {
  28763. customizer = typeof customizer == 'function' ? customizer : undefined;
  28764. var result = customizer ? customizer(value, other) : undefined;
  28765. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  28766. }
  28767. /**
  28768. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  28769. * `SyntaxError`, `TypeError`, or `URIError` object.
  28770. *
  28771. * @static
  28772. * @memberOf _
  28773. * @since 3.0.0
  28774. * @category Lang
  28775. * @param {*} value The value to check.
  28776. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  28777. * @example
  28778. *
  28779. * _.isError(new Error);
  28780. * // => true
  28781. *
  28782. * _.isError(Error);
  28783. * // => false
  28784. */
  28785. function isError(value) {
  28786. if (!isObjectLike(value)) {
  28787. return false;
  28788. }
  28789. var tag = baseGetTag(value);
  28790. return tag == errorTag || tag == domExcTag ||
  28791. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  28792. }
  28793. /**
  28794. * Checks if `value` is a finite primitive number.
  28795. *
  28796. * **Note:** This method is based on
  28797. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  28798. *
  28799. * @static
  28800. * @memberOf _
  28801. * @since 0.1.0
  28802. * @category Lang
  28803. * @param {*} value The value to check.
  28804. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  28805. * @example
  28806. *
  28807. * _.isFinite(3);
  28808. * // => true
  28809. *
  28810. * _.isFinite(Number.MIN_VALUE);
  28811. * // => true
  28812. *
  28813. * _.isFinite(Infinity);
  28814. * // => false
  28815. *
  28816. * _.isFinite('3');
  28817. * // => false
  28818. */
  28819. function isFinite(value) {
  28820. return typeof value == 'number' && nativeIsFinite(value);
  28821. }
  28822. /**
  28823. * Checks if `value` is classified as a `Function` object.
  28824. *
  28825. * @static
  28826. * @memberOf _
  28827. * @since 0.1.0
  28828. * @category Lang
  28829. * @param {*} value The value to check.
  28830. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  28831. * @example
  28832. *
  28833. * _.isFunction(_);
  28834. * // => true
  28835. *
  28836. * _.isFunction(/abc/);
  28837. * // => false
  28838. */
  28839. function isFunction(value) {
  28840. if (!isObject(value)) {
  28841. return false;
  28842. }
  28843. // The use of `Object#toString` avoids issues with the `typeof` operator
  28844. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  28845. var tag = baseGetTag(value);
  28846. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  28847. }
  28848. /**
  28849. * Checks if `value` is an integer.
  28850. *
  28851. * **Note:** This method is based on
  28852. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  28853. *
  28854. * @static
  28855. * @memberOf _
  28856. * @since 4.0.0
  28857. * @category Lang
  28858. * @param {*} value The value to check.
  28859. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  28860. * @example
  28861. *
  28862. * _.isInteger(3);
  28863. * // => true
  28864. *
  28865. * _.isInteger(Number.MIN_VALUE);
  28866. * // => false
  28867. *
  28868. * _.isInteger(Infinity);
  28869. * // => false
  28870. *
  28871. * _.isInteger('3');
  28872. * // => false
  28873. */
  28874. function isInteger(value) {
  28875. return typeof value == 'number' && value == toInteger(value);
  28876. }
  28877. /**
  28878. * Checks if `value` is a valid array-like length.
  28879. *
  28880. * **Note:** This method is loosely based on
  28881. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  28882. *
  28883. * @static
  28884. * @memberOf _
  28885. * @since 4.0.0
  28886. * @category Lang
  28887. * @param {*} value The value to check.
  28888. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  28889. * @example
  28890. *
  28891. * _.isLength(3);
  28892. * // => true
  28893. *
  28894. * _.isLength(Number.MIN_VALUE);
  28895. * // => false
  28896. *
  28897. * _.isLength(Infinity);
  28898. * // => false
  28899. *
  28900. * _.isLength('3');
  28901. * // => false
  28902. */
  28903. function isLength(value) {
  28904. return typeof value == 'number' &&
  28905. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  28906. }
  28907. /**
  28908. * Checks if `value` is the
  28909. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  28910. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  28911. *
  28912. * @static
  28913. * @memberOf _
  28914. * @since 0.1.0
  28915. * @category Lang
  28916. * @param {*} value The value to check.
  28917. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  28918. * @example
  28919. *
  28920. * _.isObject({});
  28921. * // => true
  28922. *
  28923. * _.isObject([1, 2, 3]);
  28924. * // => true
  28925. *
  28926. * _.isObject(_.noop);
  28927. * // => true
  28928. *
  28929. * _.isObject(null);
  28930. * // => false
  28931. */
  28932. function isObject(value) {
  28933. var type = typeof value;
  28934. return value != null && (type == 'object' || type == 'function');
  28935. }
  28936. /**
  28937. * Checks if `value` is object-like. A value is object-like if it's not `null`
  28938. * and has a `typeof` result of "object".
  28939. *
  28940. * @static
  28941. * @memberOf _
  28942. * @since 4.0.0
  28943. * @category Lang
  28944. * @param {*} value The value to check.
  28945. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  28946. * @example
  28947. *
  28948. * _.isObjectLike({});
  28949. * // => true
  28950. *
  28951. * _.isObjectLike([1, 2, 3]);
  28952. * // => true
  28953. *
  28954. * _.isObjectLike(_.noop);
  28955. * // => false
  28956. *
  28957. * _.isObjectLike(null);
  28958. * // => false
  28959. */
  28960. function isObjectLike(value) {
  28961. return value != null && typeof value == 'object';
  28962. }
  28963. /**
  28964. * Checks if `value` is classified as a `Map` object.
  28965. *
  28966. * @static
  28967. * @memberOf _
  28968. * @since 4.3.0
  28969. * @category Lang
  28970. * @param {*} value The value to check.
  28971. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  28972. * @example
  28973. *
  28974. * _.isMap(new Map);
  28975. * // => true
  28976. *
  28977. * _.isMap(new WeakMap);
  28978. * // => false
  28979. */
  28980. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  28981. /**
  28982. * Performs a partial deep comparison between `object` and `source` to
  28983. * determine if `object` contains equivalent property values.
  28984. *
  28985. * **Note:** This method is equivalent to `_.matches` when `source` is
  28986. * partially applied.
  28987. *
  28988. * Partial comparisons will match empty array and empty object `source`
  28989. * values against any array or object value, respectively. See `_.isEqual`
  28990. * for a list of supported value comparisons.
  28991. *
  28992. * @static
  28993. * @memberOf _
  28994. * @since 3.0.0
  28995. * @category Lang
  28996. * @param {Object} object The object to inspect.
  28997. * @param {Object} source The object of property values to match.
  28998. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28999. * @example
  29000. *
  29001. * var object = { 'a': 1, 'b': 2 };
  29002. *
  29003. * _.isMatch(object, { 'b': 2 });
  29004. * // => true
  29005. *
  29006. * _.isMatch(object, { 'b': 1 });
  29007. * // => false
  29008. */
  29009. function isMatch(object, source) {
  29010. return object === source || baseIsMatch(object, source, getMatchData(source));
  29011. }
  29012. /**
  29013. * This method is like `_.isMatch` except that it accepts `customizer` which
  29014. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29015. * are handled by the method instead. The `customizer` is invoked with five
  29016. * arguments: (objValue, srcValue, index|key, object, source).
  29017. *
  29018. * @static
  29019. * @memberOf _
  29020. * @since 4.0.0
  29021. * @category Lang
  29022. * @param {Object} object The object to inspect.
  29023. * @param {Object} source The object of property values to match.
  29024. * @param {Function} [customizer] The function to customize comparisons.
  29025. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29026. * @example
  29027. *
  29028. * function isGreeting(value) {
  29029. * return /^h(?:i|ello)$/.test(value);
  29030. * }
  29031. *
  29032. * function customizer(objValue, srcValue) {
  29033. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29034. * return true;
  29035. * }
  29036. * }
  29037. *
  29038. * var object = { 'greeting': 'hello' };
  29039. * var source = { 'greeting': 'hi' };
  29040. *
  29041. * _.isMatchWith(object, source, customizer);
  29042. * // => true
  29043. */
  29044. function isMatchWith(object, source, customizer) {
  29045. customizer = typeof customizer == 'function' ? customizer : undefined;
  29046. return baseIsMatch(object, source, getMatchData(source), customizer);
  29047. }
  29048. /**
  29049. * Checks if `value` is `NaN`.
  29050. *
  29051. * **Note:** This method is based on
  29052. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29053. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29054. * `undefined` and other non-number values.
  29055. *
  29056. * @static
  29057. * @memberOf _
  29058. * @since 0.1.0
  29059. * @category Lang
  29060. * @param {*} value The value to check.
  29061. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29062. * @example
  29063. *
  29064. * _.isNaN(NaN);
  29065. * // => true
  29066. *
  29067. * _.isNaN(new Number(NaN));
  29068. * // => true
  29069. *
  29070. * isNaN(undefined);
  29071. * // => true
  29072. *
  29073. * _.isNaN(undefined);
  29074. * // => false
  29075. */
  29076. function isNaN(value) {
  29077. // An `NaN` primitive is the only value that is not equal to itself.
  29078. // Perform the `toStringTag` check first to avoid errors with some
  29079. // ActiveX objects in IE.
  29080. return isNumber(value) && value != +value;
  29081. }
  29082. /**
  29083. * Checks if `value` is a pristine native function.
  29084. *
  29085. * **Note:** This method can't reliably detect native functions in the presence
  29086. * of the core-js package because core-js circumvents this kind of detection.
  29087. * Despite multiple requests, the core-js maintainer has made it clear: any
  29088. * attempt to fix the detection will be obstructed. As a result, we're left
  29089. * with little choice but to throw an error. Unfortunately, this also affects
  29090. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29091. * which rely on core-js.
  29092. *
  29093. * @static
  29094. * @memberOf _
  29095. * @since 3.0.0
  29096. * @category Lang
  29097. * @param {*} value The value to check.
  29098. * @returns {boolean} Returns `true` if `value` is a native function,
  29099. * else `false`.
  29100. * @example
  29101. *
  29102. * _.isNative(Array.prototype.push);
  29103. * // => true
  29104. *
  29105. * _.isNative(_);
  29106. * // => false
  29107. */
  29108. function isNative(value) {
  29109. if (isMaskable(value)) {
  29110. throw new Error(CORE_ERROR_TEXT);
  29111. }
  29112. return baseIsNative(value);
  29113. }
  29114. /**
  29115. * Checks if `value` is `null`.
  29116. *
  29117. * @static
  29118. * @memberOf _
  29119. * @since 0.1.0
  29120. * @category Lang
  29121. * @param {*} value The value to check.
  29122. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29123. * @example
  29124. *
  29125. * _.isNull(null);
  29126. * // => true
  29127. *
  29128. * _.isNull(void 0);
  29129. * // => false
  29130. */
  29131. function isNull(value) {
  29132. return value === null;
  29133. }
  29134. /**
  29135. * Checks if `value` is `null` or `undefined`.
  29136. *
  29137. * @static
  29138. * @memberOf _
  29139. * @since 4.0.0
  29140. * @category Lang
  29141. * @param {*} value The value to check.
  29142. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29143. * @example
  29144. *
  29145. * _.isNil(null);
  29146. * // => true
  29147. *
  29148. * _.isNil(void 0);
  29149. * // => true
  29150. *
  29151. * _.isNil(NaN);
  29152. * // => false
  29153. */
  29154. function isNil(value) {
  29155. return value == null;
  29156. }
  29157. /**
  29158. * Checks if `value` is classified as a `Number` primitive or object.
  29159. *
  29160. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29161. * classified as numbers, use the `_.isFinite` method.
  29162. *
  29163. * @static
  29164. * @memberOf _
  29165. * @since 0.1.0
  29166. * @category Lang
  29167. * @param {*} value The value to check.
  29168. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29169. * @example
  29170. *
  29171. * _.isNumber(3);
  29172. * // => true
  29173. *
  29174. * _.isNumber(Number.MIN_VALUE);
  29175. * // => true
  29176. *
  29177. * _.isNumber(Infinity);
  29178. * // => true
  29179. *
  29180. * _.isNumber('3');
  29181. * // => false
  29182. */
  29183. function isNumber(value) {
  29184. return typeof value == 'number' ||
  29185. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29186. }
  29187. /**
  29188. * Checks if `value` is a plain object, that is, an object created by the
  29189. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29190. *
  29191. * @static
  29192. * @memberOf _
  29193. * @since 0.8.0
  29194. * @category Lang
  29195. * @param {*} value The value to check.
  29196. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29197. * @example
  29198. *
  29199. * function Foo() {
  29200. * this.a = 1;
  29201. * }
  29202. *
  29203. * _.isPlainObject(new Foo);
  29204. * // => false
  29205. *
  29206. * _.isPlainObject([1, 2, 3]);
  29207. * // => false
  29208. *
  29209. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29210. * // => true
  29211. *
  29212. * _.isPlainObject(Object.create(null));
  29213. * // => true
  29214. */
  29215. function isPlainObject(value) {
  29216. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29217. return false;
  29218. }
  29219. var proto = getPrototype(value);
  29220. if (proto === null) {
  29221. return true;
  29222. }
  29223. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29224. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29225. funcToString.call(Ctor) == objectCtorString;
  29226. }
  29227. /**
  29228. * Checks if `value` is classified as a `RegExp` object.
  29229. *
  29230. * @static
  29231. * @memberOf _
  29232. * @since 0.1.0
  29233. * @category Lang
  29234. * @param {*} value The value to check.
  29235. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29236. * @example
  29237. *
  29238. * _.isRegExp(/abc/);
  29239. * // => true
  29240. *
  29241. * _.isRegExp('/abc/');
  29242. * // => false
  29243. */
  29244. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29245. /**
  29246. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29247. * double precision number which isn't the result of a rounded unsafe integer.
  29248. *
  29249. * **Note:** This method is based on
  29250. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29251. *
  29252. * @static
  29253. * @memberOf _
  29254. * @since 4.0.0
  29255. * @category Lang
  29256. * @param {*} value The value to check.
  29257. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29258. * @example
  29259. *
  29260. * _.isSafeInteger(3);
  29261. * // => true
  29262. *
  29263. * _.isSafeInteger(Number.MIN_VALUE);
  29264. * // => false
  29265. *
  29266. * _.isSafeInteger(Infinity);
  29267. * // => false
  29268. *
  29269. * _.isSafeInteger('3');
  29270. * // => false
  29271. */
  29272. function isSafeInteger(value) {
  29273. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29274. }
  29275. /**
  29276. * Checks if `value` is classified as a `Set` object.
  29277. *
  29278. * @static
  29279. * @memberOf _
  29280. * @since 4.3.0
  29281. * @category Lang
  29282. * @param {*} value The value to check.
  29283. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29284. * @example
  29285. *
  29286. * _.isSet(new Set);
  29287. * // => true
  29288. *
  29289. * _.isSet(new WeakSet);
  29290. * // => false
  29291. */
  29292. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29293. /**
  29294. * Checks if `value` is classified as a `String` primitive or object.
  29295. *
  29296. * @static
  29297. * @since 0.1.0
  29298. * @memberOf _
  29299. * @category Lang
  29300. * @param {*} value The value to check.
  29301. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29302. * @example
  29303. *
  29304. * _.isString('abc');
  29305. * // => true
  29306. *
  29307. * _.isString(1);
  29308. * // => false
  29309. */
  29310. function isString(value) {
  29311. return typeof value == 'string' ||
  29312. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29313. }
  29314. /**
  29315. * Checks if `value` is classified as a `Symbol` primitive or object.
  29316. *
  29317. * @static
  29318. * @memberOf _
  29319. * @since 4.0.0
  29320. * @category Lang
  29321. * @param {*} value The value to check.
  29322. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29323. * @example
  29324. *
  29325. * _.isSymbol(Symbol.iterator);
  29326. * // => true
  29327. *
  29328. * _.isSymbol('abc');
  29329. * // => false
  29330. */
  29331. function isSymbol(value) {
  29332. return typeof value == 'symbol' ||
  29333. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29334. }
  29335. /**
  29336. * Checks if `value` is classified as a typed array.
  29337. *
  29338. * @static
  29339. * @memberOf _
  29340. * @since 3.0.0
  29341. * @category Lang
  29342. * @param {*} value The value to check.
  29343. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29344. * @example
  29345. *
  29346. * _.isTypedArray(new Uint8Array);
  29347. * // => true
  29348. *
  29349. * _.isTypedArray([]);
  29350. * // => false
  29351. */
  29352. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29353. /**
  29354. * Checks if `value` is `undefined`.
  29355. *
  29356. * @static
  29357. * @since 0.1.0
  29358. * @memberOf _
  29359. * @category Lang
  29360. * @param {*} value The value to check.
  29361. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29362. * @example
  29363. *
  29364. * _.isUndefined(void 0);
  29365. * // => true
  29366. *
  29367. * _.isUndefined(null);
  29368. * // => false
  29369. */
  29370. function isUndefined(value) {
  29371. return value === undefined;
  29372. }
  29373. /**
  29374. * Checks if `value` is classified as a `WeakMap` object.
  29375. *
  29376. * @static
  29377. * @memberOf _
  29378. * @since 4.3.0
  29379. * @category Lang
  29380. * @param {*} value The value to check.
  29381. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29382. * @example
  29383. *
  29384. * _.isWeakMap(new WeakMap);
  29385. * // => true
  29386. *
  29387. * _.isWeakMap(new Map);
  29388. * // => false
  29389. */
  29390. function isWeakMap(value) {
  29391. return isObjectLike(value) && getTag(value) == weakMapTag;
  29392. }
  29393. /**
  29394. * Checks if `value` is classified as a `WeakSet` 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 set, else `false`.
  29402. * @example
  29403. *
  29404. * _.isWeakSet(new WeakSet);
  29405. * // => true
  29406. *
  29407. * _.isWeakSet(new Set);
  29408. * // => false
  29409. */
  29410. function isWeakSet(value) {
  29411. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29412. }
  29413. /**
  29414. * Checks if `value` is less than `other`.
  29415. *
  29416. * @static
  29417. * @memberOf _
  29418. * @since 3.9.0
  29419. * @category Lang
  29420. * @param {*} value The value to compare.
  29421. * @param {*} other The other value to compare.
  29422. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29423. * else `false`.
  29424. * @see _.gt
  29425. * @example
  29426. *
  29427. * _.lt(1, 3);
  29428. * // => true
  29429. *
  29430. * _.lt(3, 3);
  29431. * // => false
  29432. *
  29433. * _.lt(3, 1);
  29434. * // => false
  29435. */
  29436. var lt = createRelationalOperation(baseLt);
  29437. /**
  29438. * Checks if `value` is less than or equal to `other`.
  29439. *
  29440. * @static
  29441. * @memberOf _
  29442. * @since 3.9.0
  29443. * @category Lang
  29444. * @param {*} value The value to compare.
  29445. * @param {*} other The other value to compare.
  29446. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29447. * `other`, else `false`.
  29448. * @see _.gte
  29449. * @example
  29450. *
  29451. * _.lte(1, 3);
  29452. * // => true
  29453. *
  29454. * _.lte(3, 3);
  29455. * // => true
  29456. *
  29457. * _.lte(3, 1);
  29458. * // => false
  29459. */
  29460. var lte = createRelationalOperation(function(value, other) {
  29461. return value <= other;
  29462. });
  29463. /**
  29464. * Converts `value` to an array.
  29465. *
  29466. * @static
  29467. * @since 0.1.0
  29468. * @memberOf _
  29469. * @category Lang
  29470. * @param {*} value The value to convert.
  29471. * @returns {Array} Returns the converted array.
  29472. * @example
  29473. *
  29474. * _.toArray({ 'a': 1, 'b': 2 });
  29475. * // => [1, 2]
  29476. *
  29477. * _.toArray('abc');
  29478. * // => ['a', 'b', 'c']
  29479. *
  29480. * _.toArray(1);
  29481. * // => []
  29482. *
  29483. * _.toArray(null);
  29484. * // => []
  29485. */
  29486. function toArray(value) {
  29487. if (!value) {
  29488. return [];
  29489. }
  29490. if (isArrayLike(value)) {
  29491. return isString(value) ? stringToArray(value) : copyArray(value);
  29492. }
  29493. if (symIterator && value[symIterator]) {
  29494. return iteratorToArray(value[symIterator]());
  29495. }
  29496. var tag = getTag(value),
  29497. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29498. return func(value);
  29499. }
  29500. /**
  29501. * Converts `value` to a finite number.
  29502. *
  29503. * @static
  29504. * @memberOf _
  29505. * @since 4.12.0
  29506. * @category Lang
  29507. * @param {*} value The value to convert.
  29508. * @returns {number} Returns the converted number.
  29509. * @example
  29510. *
  29511. * _.toFinite(3.2);
  29512. * // => 3.2
  29513. *
  29514. * _.toFinite(Number.MIN_VALUE);
  29515. * // => 5e-324
  29516. *
  29517. * _.toFinite(Infinity);
  29518. * // => 1.7976931348623157e+308
  29519. *
  29520. * _.toFinite('3.2');
  29521. * // => 3.2
  29522. */
  29523. function toFinite(value) {
  29524. if (!value) {
  29525. return value === 0 ? value : 0;
  29526. }
  29527. value = toNumber(value);
  29528. if (value === INFINITY || value === -INFINITY) {
  29529. var sign = (value < 0 ? -1 : 1);
  29530. return sign * MAX_INTEGER;
  29531. }
  29532. return value === value ? value : 0;
  29533. }
  29534. /**
  29535. * Converts `value` to an integer.
  29536. *
  29537. * **Note:** This method is loosely based on
  29538. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29539. *
  29540. * @static
  29541. * @memberOf _
  29542. * @since 4.0.0
  29543. * @category Lang
  29544. * @param {*} value The value to convert.
  29545. * @returns {number} Returns the converted integer.
  29546. * @example
  29547. *
  29548. * _.toInteger(3.2);
  29549. * // => 3
  29550. *
  29551. * _.toInteger(Number.MIN_VALUE);
  29552. * // => 0
  29553. *
  29554. * _.toInteger(Infinity);
  29555. * // => 1.7976931348623157e+308
  29556. *
  29557. * _.toInteger('3.2');
  29558. * // => 3
  29559. */
  29560. function toInteger(value) {
  29561. var result = toFinite(value),
  29562. remainder = result % 1;
  29563. return result === result ? (remainder ? result - remainder : result) : 0;
  29564. }
  29565. /**
  29566. * Converts `value` to an integer suitable for use as the length of an
  29567. * array-like object.
  29568. *
  29569. * **Note:** This method is based on
  29570. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29571. *
  29572. * @static
  29573. * @memberOf _
  29574. * @since 4.0.0
  29575. * @category Lang
  29576. * @param {*} value The value to convert.
  29577. * @returns {number} Returns the converted integer.
  29578. * @example
  29579. *
  29580. * _.toLength(3.2);
  29581. * // => 3
  29582. *
  29583. * _.toLength(Number.MIN_VALUE);
  29584. * // => 0
  29585. *
  29586. * _.toLength(Infinity);
  29587. * // => 4294967295
  29588. *
  29589. * _.toLength('3.2');
  29590. * // => 3
  29591. */
  29592. function toLength(value) {
  29593. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29594. }
  29595. /**
  29596. * Converts `value` to a number.
  29597. *
  29598. * @static
  29599. * @memberOf _
  29600. * @since 4.0.0
  29601. * @category Lang
  29602. * @param {*} value The value to process.
  29603. * @returns {number} Returns the number.
  29604. * @example
  29605. *
  29606. * _.toNumber(3.2);
  29607. * // => 3.2
  29608. *
  29609. * _.toNumber(Number.MIN_VALUE);
  29610. * // => 5e-324
  29611. *
  29612. * _.toNumber(Infinity);
  29613. * // => Infinity
  29614. *
  29615. * _.toNumber('3.2');
  29616. * // => 3.2
  29617. */
  29618. function toNumber(value) {
  29619. if (typeof value == 'number') {
  29620. return value;
  29621. }
  29622. if (isSymbol(value)) {
  29623. return NAN;
  29624. }
  29625. if (isObject(value)) {
  29626. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29627. value = isObject(other) ? (other + '') : other;
  29628. }
  29629. if (typeof value != 'string') {
  29630. return value === 0 ? value : +value;
  29631. }
  29632. value = value.replace(reTrim, '');
  29633. var isBinary = reIsBinary.test(value);
  29634. return (isBinary || reIsOctal.test(value))
  29635. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29636. : (reIsBadHex.test(value) ? NAN : +value);
  29637. }
  29638. /**
  29639. * Converts `value` to a plain object flattening inherited enumerable string
  29640. * keyed properties of `value` to own properties of the plain object.
  29641. *
  29642. * @static
  29643. * @memberOf _
  29644. * @since 3.0.0
  29645. * @category Lang
  29646. * @param {*} value The value to convert.
  29647. * @returns {Object} Returns the converted plain object.
  29648. * @example
  29649. *
  29650. * function Foo() {
  29651. * this.b = 2;
  29652. * }
  29653. *
  29654. * Foo.prototype.c = 3;
  29655. *
  29656. * _.assign({ 'a': 1 }, new Foo);
  29657. * // => { 'a': 1, 'b': 2 }
  29658. *
  29659. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29660. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29661. */
  29662. function toPlainObject(value) {
  29663. return copyObject(value, keysIn(value));
  29664. }
  29665. /**
  29666. * Converts `value` to a safe integer. A safe integer can be compared and
  29667. * represented correctly.
  29668. *
  29669. * @static
  29670. * @memberOf _
  29671. * @since 4.0.0
  29672. * @category Lang
  29673. * @param {*} value The value to convert.
  29674. * @returns {number} Returns the converted integer.
  29675. * @example
  29676. *
  29677. * _.toSafeInteger(3.2);
  29678. * // => 3
  29679. *
  29680. * _.toSafeInteger(Number.MIN_VALUE);
  29681. * // => 0
  29682. *
  29683. * _.toSafeInteger(Infinity);
  29684. * // => 9007199254740991
  29685. *
  29686. * _.toSafeInteger('3.2');
  29687. * // => 3
  29688. */
  29689. function toSafeInteger(value) {
  29690. return value
  29691. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29692. : (value === 0 ? value : 0);
  29693. }
  29694. /**
  29695. * Converts `value` to a string. An empty string is returned for `null`
  29696. * and `undefined` values. The sign of `-0` is preserved.
  29697. *
  29698. * @static
  29699. * @memberOf _
  29700. * @since 4.0.0
  29701. * @category Lang
  29702. * @param {*} value The value to convert.
  29703. * @returns {string} Returns the converted string.
  29704. * @example
  29705. *
  29706. * _.toString(null);
  29707. * // => ''
  29708. *
  29709. * _.toString(-0);
  29710. * // => '-0'
  29711. *
  29712. * _.toString([1, 2, 3]);
  29713. * // => '1,2,3'
  29714. */
  29715. function toString(value) {
  29716. return value == null ? '' : baseToString(value);
  29717. }
  29718. /*------------------------------------------------------------------------*/
  29719. /**
  29720. * Assigns own enumerable string keyed properties of source objects to the
  29721. * destination object. Source objects are applied from left to right.
  29722. * Subsequent sources overwrite property assignments of previous sources.
  29723. *
  29724. * **Note:** This method mutates `object` and is loosely based on
  29725. * [`Object.assign`](https://mdn.io/Object/assign).
  29726. *
  29727. * @static
  29728. * @memberOf _
  29729. * @since 0.10.0
  29730. * @category Object
  29731. * @param {Object} object The destination object.
  29732. * @param {...Object} [sources] The source objects.
  29733. * @returns {Object} Returns `object`.
  29734. * @see _.assignIn
  29735. * @example
  29736. *
  29737. * function Foo() {
  29738. * this.a = 1;
  29739. * }
  29740. *
  29741. * function Bar() {
  29742. * this.c = 3;
  29743. * }
  29744. *
  29745. * Foo.prototype.b = 2;
  29746. * Bar.prototype.d = 4;
  29747. *
  29748. * _.assign({ 'a': 0 }, new Foo, new Bar);
  29749. * // => { 'a': 1, 'c': 3 }
  29750. */
  29751. var assign = createAssigner(function(object, source) {
  29752. if (isPrototype(source) || isArrayLike(source)) {
  29753. copyObject(source, keys(source), object);
  29754. return;
  29755. }
  29756. for (var key in source) {
  29757. if (hasOwnProperty.call(source, key)) {
  29758. assignValue(object, key, source[key]);
  29759. }
  29760. }
  29761. });
  29762. /**
  29763. * This method is like `_.assign` except that it iterates over own and
  29764. * inherited source properties.
  29765. *
  29766. * **Note:** This method mutates `object`.
  29767. *
  29768. * @static
  29769. * @memberOf _
  29770. * @since 4.0.0
  29771. * @alias extend
  29772. * @category Object
  29773. * @param {Object} object The destination object.
  29774. * @param {...Object} [sources] The source objects.
  29775. * @returns {Object} Returns `object`.
  29776. * @see _.assign
  29777. * @example
  29778. *
  29779. * function Foo() {
  29780. * this.a = 1;
  29781. * }
  29782. *
  29783. * function Bar() {
  29784. * this.c = 3;
  29785. * }
  29786. *
  29787. * Foo.prototype.b = 2;
  29788. * Bar.prototype.d = 4;
  29789. *
  29790. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  29791. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  29792. */
  29793. var assignIn = createAssigner(function(object, source) {
  29794. copyObject(source, keysIn(source), object);
  29795. });
  29796. /**
  29797. * This method is like `_.assignIn` except that it accepts `customizer`
  29798. * which is invoked to produce the assigned values. If `customizer` returns
  29799. * `undefined`, assignment is handled by the method instead. The `customizer`
  29800. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29801. *
  29802. * **Note:** This method mutates `object`.
  29803. *
  29804. * @static
  29805. * @memberOf _
  29806. * @since 4.0.0
  29807. * @alias extendWith
  29808. * @category Object
  29809. * @param {Object} object The destination object.
  29810. * @param {...Object} sources The source objects.
  29811. * @param {Function} [customizer] The function to customize assigned values.
  29812. * @returns {Object} Returns `object`.
  29813. * @see _.assignWith
  29814. * @example
  29815. *
  29816. * function customizer(objValue, srcValue) {
  29817. * return _.isUndefined(objValue) ? srcValue : objValue;
  29818. * }
  29819. *
  29820. * var defaults = _.partialRight(_.assignInWith, customizer);
  29821. *
  29822. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29823. * // => { 'a': 1, 'b': 2 }
  29824. */
  29825. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  29826. copyObject(source, keysIn(source), object, customizer);
  29827. });
  29828. /**
  29829. * This method is like `_.assign` except that it accepts `customizer`
  29830. * which is invoked to produce the assigned values. If `customizer` returns
  29831. * `undefined`, assignment is handled by the method instead. The `customizer`
  29832. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29833. *
  29834. * **Note:** This method mutates `object`.
  29835. *
  29836. * @static
  29837. * @memberOf _
  29838. * @since 4.0.0
  29839. * @category Object
  29840. * @param {Object} object The destination object.
  29841. * @param {...Object} sources The source objects.
  29842. * @param {Function} [customizer] The function to customize assigned values.
  29843. * @returns {Object} Returns `object`.
  29844. * @see _.assignInWith
  29845. * @example
  29846. *
  29847. * function customizer(objValue, srcValue) {
  29848. * return _.isUndefined(objValue) ? srcValue : objValue;
  29849. * }
  29850. *
  29851. * var defaults = _.partialRight(_.assignWith, customizer);
  29852. *
  29853. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29854. * // => { 'a': 1, 'b': 2 }
  29855. */
  29856. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  29857. copyObject(source, keys(source), object, customizer);
  29858. });
  29859. /**
  29860. * Creates an array of values corresponding to `paths` of `object`.
  29861. *
  29862. * @static
  29863. * @memberOf _
  29864. * @since 1.0.0
  29865. * @category Object
  29866. * @param {Object} object The object to iterate over.
  29867. * @param {...(string|string[])} [paths] The property paths to pick.
  29868. * @returns {Array} Returns the picked values.
  29869. * @example
  29870. *
  29871. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  29872. *
  29873. * _.at(object, ['a[0].b.c', 'a[1]']);
  29874. * // => [3, 4]
  29875. */
  29876. var at = flatRest(baseAt);
  29877. /**
  29878. * Creates an object that inherits from the `prototype` object. If a
  29879. * `properties` object is given, its own enumerable string keyed properties
  29880. * are assigned to the created object.
  29881. *
  29882. * @static
  29883. * @memberOf _
  29884. * @since 2.3.0
  29885. * @category Object
  29886. * @param {Object} prototype The object to inherit from.
  29887. * @param {Object} [properties] The properties to assign to the object.
  29888. * @returns {Object} Returns the new object.
  29889. * @example
  29890. *
  29891. * function Shape() {
  29892. * this.x = 0;
  29893. * this.y = 0;
  29894. * }
  29895. *
  29896. * function Circle() {
  29897. * Shape.call(this);
  29898. * }
  29899. *
  29900. * Circle.prototype = _.create(Shape.prototype, {
  29901. * 'constructor': Circle
  29902. * });
  29903. *
  29904. * var circle = new Circle;
  29905. * circle instanceof Circle;
  29906. * // => true
  29907. *
  29908. * circle instanceof Shape;
  29909. * // => true
  29910. */
  29911. function create(prototype, properties) {
  29912. var result = baseCreate(prototype);
  29913. return properties == null ? result : baseAssign(result, properties);
  29914. }
  29915. /**
  29916. * Assigns own and inherited enumerable string keyed properties of source
  29917. * objects to the destination object for all destination properties that
  29918. * resolve to `undefined`. Source objects are applied from left to right.
  29919. * Once a property is set, additional values of the same property are ignored.
  29920. *
  29921. * **Note:** This method mutates `object`.
  29922. *
  29923. * @static
  29924. * @since 0.1.0
  29925. * @memberOf _
  29926. * @category Object
  29927. * @param {Object} object The destination object.
  29928. * @param {...Object} [sources] The source objects.
  29929. * @returns {Object} Returns `object`.
  29930. * @see _.defaultsDeep
  29931. * @example
  29932. *
  29933. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29934. * // => { 'a': 1, 'b': 2 }
  29935. */
  29936. var defaults = baseRest(function(object, sources) {
  29937. object = Object(object);
  29938. var index = -1;
  29939. var length = sources.length;
  29940. var guard = length > 2 ? sources[2] : undefined;
  29941. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  29942. length = 1;
  29943. }
  29944. while (++index < length) {
  29945. var source = sources[index];
  29946. var props = keysIn(source);
  29947. var propsIndex = -1;
  29948. var propsLength = props.length;
  29949. while (++propsIndex < propsLength) {
  29950. var key = props[propsIndex];
  29951. var value = object[key];
  29952. if (value === undefined ||
  29953. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  29954. object[key] = source[key];
  29955. }
  29956. }
  29957. }
  29958. return object;
  29959. });
  29960. /**
  29961. * This method is like `_.defaults` except that it recursively assigns
  29962. * default properties.
  29963. *
  29964. * **Note:** This method mutates `object`.
  29965. *
  29966. * @static
  29967. * @memberOf _
  29968. * @since 3.10.0
  29969. * @category Object
  29970. * @param {Object} object The destination object.
  29971. * @param {...Object} [sources] The source objects.
  29972. * @returns {Object} Returns `object`.
  29973. * @see _.defaults
  29974. * @example
  29975. *
  29976. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  29977. * // => { 'a': { 'b': 2, 'c': 3 } }
  29978. */
  29979. var defaultsDeep = baseRest(function(args) {
  29980. args.push(undefined, customDefaultsMerge);
  29981. return apply(mergeWith, undefined, args);
  29982. });
  29983. /**
  29984. * This method is like `_.find` except that it returns the key of the first
  29985. * element `predicate` returns truthy for instead of the element itself.
  29986. *
  29987. * @static
  29988. * @memberOf _
  29989. * @since 1.1.0
  29990. * @category Object
  29991. * @param {Object} object The object to inspect.
  29992. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29993. * @returns {string|undefined} Returns the key of the matched element,
  29994. * else `undefined`.
  29995. * @example
  29996. *
  29997. * var users = {
  29998. * 'barney': { 'age': 36, 'active': true },
  29999. * 'fred': { 'age': 40, 'active': false },
  30000. * 'pebbles': { 'age': 1, 'active': true }
  30001. * };
  30002. *
  30003. * _.findKey(users, function(o) { return o.age < 40; });
  30004. * // => 'barney' (iteration order is not guaranteed)
  30005. *
  30006. * // The `_.matches` iteratee shorthand.
  30007. * _.findKey(users, { 'age': 1, 'active': true });
  30008. * // => 'pebbles'
  30009. *
  30010. * // The `_.matchesProperty` iteratee shorthand.
  30011. * _.findKey(users, ['active', false]);
  30012. * // => 'fred'
  30013. *
  30014. * // The `_.property` iteratee shorthand.
  30015. * _.findKey(users, 'active');
  30016. * // => 'barney'
  30017. */
  30018. function findKey(object, predicate) {
  30019. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30020. }
  30021. /**
  30022. * This method is like `_.findKey` except that it iterates over elements of
  30023. * a collection in the opposite order.
  30024. *
  30025. * @static
  30026. * @memberOf _
  30027. * @since 2.0.0
  30028. * @category Object
  30029. * @param {Object} object The object to inspect.
  30030. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30031. * @returns {string|undefined} Returns the key of the matched element,
  30032. * else `undefined`.
  30033. * @example
  30034. *
  30035. * var users = {
  30036. * 'barney': { 'age': 36, 'active': true },
  30037. * 'fred': { 'age': 40, 'active': false },
  30038. * 'pebbles': { 'age': 1, 'active': true }
  30039. * };
  30040. *
  30041. * _.findLastKey(users, function(o) { return o.age < 40; });
  30042. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30043. *
  30044. * // The `_.matches` iteratee shorthand.
  30045. * _.findLastKey(users, { 'age': 36, 'active': true });
  30046. * // => 'barney'
  30047. *
  30048. * // The `_.matchesProperty` iteratee shorthand.
  30049. * _.findLastKey(users, ['active', false]);
  30050. * // => 'fred'
  30051. *
  30052. * // The `_.property` iteratee shorthand.
  30053. * _.findLastKey(users, 'active');
  30054. * // => 'pebbles'
  30055. */
  30056. function findLastKey(object, predicate) {
  30057. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30058. }
  30059. /**
  30060. * Iterates over own and inherited enumerable string keyed properties of an
  30061. * object and invokes `iteratee` for each property. The iteratee is invoked
  30062. * with three arguments: (value, key, object). Iteratee functions may exit
  30063. * iteration early by explicitly returning `false`.
  30064. *
  30065. * @static
  30066. * @memberOf _
  30067. * @since 0.3.0
  30068. * @category Object
  30069. * @param {Object} object The object to iterate over.
  30070. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30071. * @returns {Object} Returns `object`.
  30072. * @see _.forInRight
  30073. * @example
  30074. *
  30075. * function Foo() {
  30076. * this.a = 1;
  30077. * this.b = 2;
  30078. * }
  30079. *
  30080. * Foo.prototype.c = 3;
  30081. *
  30082. * _.forIn(new Foo, function(value, key) {
  30083. * console.log(key);
  30084. * });
  30085. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30086. */
  30087. function forIn(object, iteratee) {
  30088. return object == null
  30089. ? object
  30090. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30091. }
  30092. /**
  30093. * This method is like `_.forIn` except that it iterates over properties of
  30094. * `object` in the opposite order.
  30095. *
  30096. * @static
  30097. * @memberOf _
  30098. * @since 2.0.0
  30099. * @category Object
  30100. * @param {Object} object The object to iterate over.
  30101. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30102. * @returns {Object} Returns `object`.
  30103. * @see _.forIn
  30104. * @example
  30105. *
  30106. * function Foo() {
  30107. * this.a = 1;
  30108. * this.b = 2;
  30109. * }
  30110. *
  30111. * Foo.prototype.c = 3;
  30112. *
  30113. * _.forInRight(new Foo, function(value, key) {
  30114. * console.log(key);
  30115. * });
  30116. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30117. */
  30118. function forInRight(object, iteratee) {
  30119. return object == null
  30120. ? object
  30121. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30122. }
  30123. /**
  30124. * Iterates over own enumerable string keyed properties of an object and
  30125. * invokes `iteratee` for each property. The iteratee is invoked with three
  30126. * arguments: (value, key, object). Iteratee functions may exit iteration
  30127. * early by explicitly returning `false`.
  30128. *
  30129. * @static
  30130. * @memberOf _
  30131. * @since 0.3.0
  30132. * @category Object
  30133. * @param {Object} object The object to iterate over.
  30134. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30135. * @returns {Object} Returns `object`.
  30136. * @see _.forOwnRight
  30137. * @example
  30138. *
  30139. * function Foo() {
  30140. * this.a = 1;
  30141. * this.b = 2;
  30142. * }
  30143. *
  30144. * Foo.prototype.c = 3;
  30145. *
  30146. * _.forOwn(new Foo, function(value, key) {
  30147. * console.log(key);
  30148. * });
  30149. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30150. */
  30151. function forOwn(object, iteratee) {
  30152. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30153. }
  30154. /**
  30155. * This method is like `_.forOwn` except that it iterates over properties of
  30156. * `object` in the opposite order.
  30157. *
  30158. * @static
  30159. * @memberOf _
  30160. * @since 2.0.0
  30161. * @category Object
  30162. * @param {Object} object The object to iterate over.
  30163. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30164. * @returns {Object} Returns `object`.
  30165. * @see _.forOwn
  30166. * @example
  30167. *
  30168. * function Foo() {
  30169. * this.a = 1;
  30170. * this.b = 2;
  30171. * }
  30172. *
  30173. * Foo.prototype.c = 3;
  30174. *
  30175. * _.forOwnRight(new Foo, function(value, key) {
  30176. * console.log(key);
  30177. * });
  30178. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30179. */
  30180. function forOwnRight(object, iteratee) {
  30181. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30182. }
  30183. /**
  30184. * Creates an array of function property names from own enumerable properties
  30185. * of `object`.
  30186. *
  30187. * @static
  30188. * @since 0.1.0
  30189. * @memberOf _
  30190. * @category Object
  30191. * @param {Object} object The object to inspect.
  30192. * @returns {Array} Returns the function names.
  30193. * @see _.functionsIn
  30194. * @example
  30195. *
  30196. * function Foo() {
  30197. * this.a = _.constant('a');
  30198. * this.b = _.constant('b');
  30199. * }
  30200. *
  30201. * Foo.prototype.c = _.constant('c');
  30202. *
  30203. * _.functions(new Foo);
  30204. * // => ['a', 'b']
  30205. */
  30206. function functions(object) {
  30207. return object == null ? [] : baseFunctions(object, keys(object));
  30208. }
  30209. /**
  30210. * Creates an array of function property names from own and inherited
  30211. * enumerable properties of `object`.
  30212. *
  30213. * @static
  30214. * @memberOf _
  30215. * @since 4.0.0
  30216. * @category Object
  30217. * @param {Object} object The object to inspect.
  30218. * @returns {Array} Returns the function names.
  30219. * @see _.functions
  30220. * @example
  30221. *
  30222. * function Foo() {
  30223. * this.a = _.constant('a');
  30224. * this.b = _.constant('b');
  30225. * }
  30226. *
  30227. * Foo.prototype.c = _.constant('c');
  30228. *
  30229. * _.functionsIn(new Foo);
  30230. * // => ['a', 'b', 'c']
  30231. */
  30232. function functionsIn(object) {
  30233. return object == null ? [] : baseFunctions(object, keysIn(object));
  30234. }
  30235. /**
  30236. * Gets the value at `path` of `object`. If the resolved value is
  30237. * `undefined`, the `defaultValue` is returned in its place.
  30238. *
  30239. * @static
  30240. * @memberOf _
  30241. * @since 3.7.0
  30242. * @category Object
  30243. * @param {Object} object The object to query.
  30244. * @param {Array|string} path The path of the property to get.
  30245. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30246. * @returns {*} Returns the resolved value.
  30247. * @example
  30248. *
  30249. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30250. *
  30251. * _.get(object, 'a[0].b.c');
  30252. * // => 3
  30253. *
  30254. * _.get(object, ['a', '0', 'b', 'c']);
  30255. * // => 3
  30256. *
  30257. * _.get(object, 'a.b.c', 'default');
  30258. * // => 'default'
  30259. */
  30260. function get(object, path, defaultValue) {
  30261. var result = object == null ? undefined : baseGet(object, path);
  30262. return result === undefined ? defaultValue : result;
  30263. }
  30264. /**
  30265. * Checks if `path` is a direct property of `object`.
  30266. *
  30267. * @static
  30268. * @since 0.1.0
  30269. * @memberOf _
  30270. * @category Object
  30271. * @param {Object} object The object to query.
  30272. * @param {Array|string} path The path to check.
  30273. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30274. * @example
  30275. *
  30276. * var object = { 'a': { 'b': 2 } };
  30277. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30278. *
  30279. * _.has(object, 'a');
  30280. * // => true
  30281. *
  30282. * _.has(object, 'a.b');
  30283. * // => true
  30284. *
  30285. * _.has(object, ['a', 'b']);
  30286. * // => true
  30287. *
  30288. * _.has(other, 'a');
  30289. * // => false
  30290. */
  30291. function has(object, path) {
  30292. return object != null && hasPath(object, path, baseHas);
  30293. }
  30294. /**
  30295. * Checks if `path` is a direct or inherited property of `object`.
  30296. *
  30297. * @static
  30298. * @memberOf _
  30299. * @since 4.0.0
  30300. * @category Object
  30301. * @param {Object} object The object to query.
  30302. * @param {Array|string} path The path to check.
  30303. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30304. * @example
  30305. *
  30306. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30307. *
  30308. * _.hasIn(object, 'a');
  30309. * // => true
  30310. *
  30311. * _.hasIn(object, 'a.b');
  30312. * // => true
  30313. *
  30314. * _.hasIn(object, ['a', 'b']);
  30315. * // => true
  30316. *
  30317. * _.hasIn(object, 'b');
  30318. * // => false
  30319. */
  30320. function hasIn(object, path) {
  30321. return object != null && hasPath(object, path, baseHasIn);
  30322. }
  30323. /**
  30324. * Creates an object composed of the inverted keys and values of `object`.
  30325. * If `object` contains duplicate values, subsequent values overwrite
  30326. * property assignments of previous values.
  30327. *
  30328. * @static
  30329. * @memberOf _
  30330. * @since 0.7.0
  30331. * @category Object
  30332. * @param {Object} object The object to invert.
  30333. * @returns {Object} Returns the new inverted object.
  30334. * @example
  30335. *
  30336. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30337. *
  30338. * _.invert(object);
  30339. * // => { '1': 'c', '2': 'b' }
  30340. */
  30341. var invert = createInverter(function(result, value, key) {
  30342. if (value != null &&
  30343. typeof value.toString != 'function') {
  30344. value = nativeObjectToString.call(value);
  30345. }
  30346. result[value] = key;
  30347. }, constant(identity));
  30348. /**
  30349. * This method is like `_.invert` except that the inverted object is generated
  30350. * from the results of running each element of `object` thru `iteratee`. The
  30351. * corresponding inverted value of each inverted key is an array of keys
  30352. * responsible for generating the inverted value. The iteratee is invoked
  30353. * with one argument: (value).
  30354. *
  30355. * @static
  30356. * @memberOf _
  30357. * @since 4.1.0
  30358. * @category Object
  30359. * @param {Object} object The object to invert.
  30360. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30361. * @returns {Object} Returns the new inverted object.
  30362. * @example
  30363. *
  30364. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30365. *
  30366. * _.invertBy(object);
  30367. * // => { '1': ['a', 'c'], '2': ['b'] }
  30368. *
  30369. * _.invertBy(object, function(value) {
  30370. * return 'group' + value;
  30371. * });
  30372. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30373. */
  30374. var invertBy = createInverter(function(result, value, key) {
  30375. if (value != null &&
  30376. typeof value.toString != 'function') {
  30377. value = nativeObjectToString.call(value);
  30378. }
  30379. if (hasOwnProperty.call(result, value)) {
  30380. result[value].push(key);
  30381. } else {
  30382. result[value] = [key];
  30383. }
  30384. }, getIteratee);
  30385. /**
  30386. * Invokes the method at `path` of `object`.
  30387. *
  30388. * @static
  30389. * @memberOf _
  30390. * @since 4.0.0
  30391. * @category Object
  30392. * @param {Object} object The object to query.
  30393. * @param {Array|string} path The path of the method to invoke.
  30394. * @param {...*} [args] The arguments to invoke the method with.
  30395. * @returns {*} Returns the result of the invoked method.
  30396. * @example
  30397. *
  30398. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30399. *
  30400. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30401. * // => [2, 3]
  30402. */
  30403. var invoke = baseRest(baseInvoke);
  30404. /**
  30405. * Creates an array of the own enumerable property names of `object`.
  30406. *
  30407. * **Note:** Non-object values are coerced to objects. See the
  30408. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30409. * for more details.
  30410. *
  30411. * @static
  30412. * @since 0.1.0
  30413. * @memberOf _
  30414. * @category Object
  30415. * @param {Object} object The object to query.
  30416. * @returns {Array} Returns the array of property names.
  30417. * @example
  30418. *
  30419. * function Foo() {
  30420. * this.a = 1;
  30421. * this.b = 2;
  30422. * }
  30423. *
  30424. * Foo.prototype.c = 3;
  30425. *
  30426. * _.keys(new Foo);
  30427. * // => ['a', 'b'] (iteration order is not guaranteed)
  30428. *
  30429. * _.keys('hi');
  30430. * // => ['0', '1']
  30431. */
  30432. function keys(object) {
  30433. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30434. }
  30435. /**
  30436. * Creates an array of the own and inherited enumerable property names of `object`.
  30437. *
  30438. * **Note:** Non-object values are coerced to objects.
  30439. *
  30440. * @static
  30441. * @memberOf _
  30442. * @since 3.0.0
  30443. * @category Object
  30444. * @param {Object} object The object to query.
  30445. * @returns {Array} Returns the array of property names.
  30446. * @example
  30447. *
  30448. * function Foo() {
  30449. * this.a = 1;
  30450. * this.b = 2;
  30451. * }
  30452. *
  30453. * Foo.prototype.c = 3;
  30454. *
  30455. * _.keysIn(new Foo);
  30456. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30457. */
  30458. function keysIn(object) {
  30459. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30460. }
  30461. /**
  30462. * The opposite of `_.mapValues`; this method creates an object with the
  30463. * same values as `object` and keys generated by running each own enumerable
  30464. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30465. * with three arguments: (value, key, object).
  30466. *
  30467. * @static
  30468. * @memberOf _
  30469. * @since 3.8.0
  30470. * @category Object
  30471. * @param {Object} object The object to iterate over.
  30472. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30473. * @returns {Object} Returns the new mapped object.
  30474. * @see _.mapValues
  30475. * @example
  30476. *
  30477. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30478. * return key + value;
  30479. * });
  30480. * // => { 'a1': 1, 'b2': 2 }
  30481. */
  30482. function mapKeys(object, iteratee) {
  30483. var result = {};
  30484. iteratee = getIteratee(iteratee, 3);
  30485. baseForOwn(object, function(value, key, object) {
  30486. baseAssignValue(result, iteratee(value, key, object), value);
  30487. });
  30488. return result;
  30489. }
  30490. /**
  30491. * Creates an object with the same keys as `object` and values generated
  30492. * by running each own enumerable string keyed property of `object` thru
  30493. * `iteratee`. The iteratee is invoked with three arguments:
  30494. * (value, key, object).
  30495. *
  30496. * @static
  30497. * @memberOf _
  30498. * @since 2.4.0
  30499. * @category Object
  30500. * @param {Object} object The object to iterate over.
  30501. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30502. * @returns {Object} Returns the new mapped object.
  30503. * @see _.mapKeys
  30504. * @example
  30505. *
  30506. * var users = {
  30507. * 'fred': { 'user': 'fred', 'age': 40 },
  30508. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30509. * };
  30510. *
  30511. * _.mapValues(users, function(o) { return o.age; });
  30512. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30513. *
  30514. * // The `_.property` iteratee shorthand.
  30515. * _.mapValues(users, 'age');
  30516. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30517. */
  30518. function mapValues(object, iteratee) {
  30519. var result = {};
  30520. iteratee = getIteratee(iteratee, 3);
  30521. baseForOwn(object, function(value, key, object) {
  30522. baseAssignValue(result, key, iteratee(value, key, object));
  30523. });
  30524. return result;
  30525. }
  30526. /**
  30527. * This method is like `_.assign` except that it recursively merges own and
  30528. * inherited enumerable string keyed properties of source objects into the
  30529. * destination object. Source properties that resolve to `undefined` are
  30530. * skipped if a destination value exists. Array and plain object properties
  30531. * are merged recursively. Other objects and value types are overridden by
  30532. * assignment. Source objects are applied from left to right. Subsequent
  30533. * sources overwrite property assignments of previous sources.
  30534. *
  30535. * **Note:** This method mutates `object`.
  30536. *
  30537. * @static
  30538. * @memberOf _
  30539. * @since 0.5.0
  30540. * @category Object
  30541. * @param {Object} object The destination object.
  30542. * @param {...Object} [sources] The source objects.
  30543. * @returns {Object} Returns `object`.
  30544. * @example
  30545. *
  30546. * var object = {
  30547. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30548. * };
  30549. *
  30550. * var other = {
  30551. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30552. * };
  30553. *
  30554. * _.merge(object, other);
  30555. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30556. */
  30557. var merge = createAssigner(function(object, source, srcIndex) {
  30558. baseMerge(object, source, srcIndex);
  30559. });
  30560. /**
  30561. * This method is like `_.merge` except that it accepts `customizer` which
  30562. * is invoked to produce the merged values of the destination and source
  30563. * properties. If `customizer` returns `undefined`, merging is handled by the
  30564. * method instead. The `customizer` is invoked with six arguments:
  30565. * (objValue, srcValue, key, object, source, stack).
  30566. *
  30567. * **Note:** This method mutates `object`.
  30568. *
  30569. * @static
  30570. * @memberOf _
  30571. * @since 4.0.0
  30572. * @category Object
  30573. * @param {Object} object The destination object.
  30574. * @param {...Object} sources The source objects.
  30575. * @param {Function} customizer The function to customize assigned values.
  30576. * @returns {Object} Returns `object`.
  30577. * @example
  30578. *
  30579. * function customizer(objValue, srcValue) {
  30580. * if (_.isArray(objValue)) {
  30581. * return objValue.concat(srcValue);
  30582. * }
  30583. * }
  30584. *
  30585. * var object = { 'a': [1], 'b': [2] };
  30586. * var other = { 'a': [3], 'b': [4] };
  30587. *
  30588. * _.mergeWith(object, other, customizer);
  30589. * // => { 'a': [1, 3], 'b': [2, 4] }
  30590. */
  30591. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30592. baseMerge(object, source, srcIndex, customizer);
  30593. });
  30594. /**
  30595. * The opposite of `_.pick`; this method creates an object composed of the
  30596. * own and inherited enumerable property paths of `object` that are not omitted.
  30597. *
  30598. * **Note:** This method is considerably slower than `_.pick`.
  30599. *
  30600. * @static
  30601. * @since 0.1.0
  30602. * @memberOf _
  30603. * @category Object
  30604. * @param {Object} object The source object.
  30605. * @param {...(string|string[])} [paths] The property paths to omit.
  30606. * @returns {Object} Returns the new object.
  30607. * @example
  30608. *
  30609. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30610. *
  30611. * _.omit(object, ['a', 'c']);
  30612. * // => { 'b': '2' }
  30613. */
  30614. var omit = flatRest(function(object, paths) {
  30615. var result = {};
  30616. if (object == null) {
  30617. return result;
  30618. }
  30619. var isDeep = false;
  30620. paths = arrayMap(paths, function(path) {
  30621. path = castPath(path, object);
  30622. isDeep || (isDeep = path.length > 1);
  30623. return path;
  30624. });
  30625. copyObject(object, getAllKeysIn(object), result);
  30626. if (isDeep) {
  30627. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30628. }
  30629. var length = paths.length;
  30630. while (length--) {
  30631. baseUnset(result, paths[length]);
  30632. }
  30633. return result;
  30634. });
  30635. /**
  30636. * The opposite of `_.pickBy`; this method creates an object composed of
  30637. * the own and inherited enumerable string keyed properties of `object` that
  30638. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30639. * arguments: (value, key).
  30640. *
  30641. * @static
  30642. * @memberOf _
  30643. * @since 4.0.0
  30644. * @category Object
  30645. * @param {Object} object The source object.
  30646. * @param {Function} [predicate=_.identity] The function invoked per property.
  30647. * @returns {Object} Returns the new object.
  30648. * @example
  30649. *
  30650. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30651. *
  30652. * _.omitBy(object, _.isNumber);
  30653. * // => { 'b': '2' }
  30654. */
  30655. function omitBy(object, predicate) {
  30656. return pickBy(object, negate(getIteratee(predicate)));
  30657. }
  30658. /**
  30659. * Creates an object composed of the picked `object` properties.
  30660. *
  30661. * @static
  30662. * @since 0.1.0
  30663. * @memberOf _
  30664. * @category Object
  30665. * @param {Object} object The source object.
  30666. * @param {...(string|string[])} [paths] The property paths to pick.
  30667. * @returns {Object} Returns the new object.
  30668. * @example
  30669. *
  30670. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30671. *
  30672. * _.pick(object, ['a', 'c']);
  30673. * // => { 'a': 1, 'c': 3 }
  30674. */
  30675. var pick = flatRest(function(object, paths) {
  30676. return object == null ? {} : basePick(object, paths);
  30677. });
  30678. /**
  30679. * Creates an object composed of the `object` properties `predicate` returns
  30680. * truthy for. The predicate is invoked with two arguments: (value, key).
  30681. *
  30682. * @static
  30683. * @memberOf _
  30684. * @since 4.0.0
  30685. * @category Object
  30686. * @param {Object} object The source object.
  30687. * @param {Function} [predicate=_.identity] The function invoked per property.
  30688. * @returns {Object} Returns the new object.
  30689. * @example
  30690. *
  30691. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30692. *
  30693. * _.pickBy(object, _.isNumber);
  30694. * // => { 'a': 1, 'c': 3 }
  30695. */
  30696. function pickBy(object, predicate) {
  30697. if (object == null) {
  30698. return {};
  30699. }
  30700. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30701. return [prop];
  30702. });
  30703. predicate = getIteratee(predicate);
  30704. return basePickBy(object, props, function(value, path) {
  30705. return predicate(value, path[0]);
  30706. });
  30707. }
  30708. /**
  30709. * This method is like `_.get` except that if the resolved value is a
  30710. * function it's invoked with the `this` binding of its parent object and
  30711. * its result is returned.
  30712. *
  30713. * @static
  30714. * @since 0.1.0
  30715. * @memberOf _
  30716. * @category Object
  30717. * @param {Object} object The object to query.
  30718. * @param {Array|string} path The path of the property to resolve.
  30719. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30720. * @returns {*} Returns the resolved value.
  30721. * @example
  30722. *
  30723. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  30724. *
  30725. * _.result(object, 'a[0].b.c1');
  30726. * // => 3
  30727. *
  30728. * _.result(object, 'a[0].b.c2');
  30729. * // => 4
  30730. *
  30731. * _.result(object, 'a[0].b.c3', 'default');
  30732. * // => 'default'
  30733. *
  30734. * _.result(object, 'a[0].b.c3', _.constant('default'));
  30735. * // => 'default'
  30736. */
  30737. function result(object, path, defaultValue) {
  30738. path = castPath(path, object);
  30739. var index = -1,
  30740. length = path.length;
  30741. // Ensure the loop is entered when path is empty.
  30742. if (!length) {
  30743. length = 1;
  30744. object = undefined;
  30745. }
  30746. while (++index < length) {
  30747. var value = object == null ? undefined : object[toKey(path[index])];
  30748. if (value === undefined) {
  30749. index = length;
  30750. value = defaultValue;
  30751. }
  30752. object = isFunction(value) ? value.call(object) : value;
  30753. }
  30754. return object;
  30755. }
  30756. /**
  30757. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  30758. * it's created. Arrays are created for missing index properties while objects
  30759. * are created for all other missing properties. Use `_.setWith` to customize
  30760. * `path` creation.
  30761. *
  30762. * **Note:** This method mutates `object`.
  30763. *
  30764. * @static
  30765. * @memberOf _
  30766. * @since 3.7.0
  30767. * @category Object
  30768. * @param {Object} object The object to modify.
  30769. * @param {Array|string} path The path of the property to set.
  30770. * @param {*} value The value to set.
  30771. * @returns {Object} Returns `object`.
  30772. * @example
  30773. *
  30774. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30775. *
  30776. * _.set(object, 'a[0].b.c', 4);
  30777. * console.log(object.a[0].b.c);
  30778. * // => 4
  30779. *
  30780. * _.set(object, ['x', '0', 'y', 'z'], 5);
  30781. * console.log(object.x[0].y.z);
  30782. * // => 5
  30783. */
  30784. function set(object, path, value) {
  30785. return object == null ? object : baseSet(object, path, value);
  30786. }
  30787. /**
  30788. * This method is like `_.set` except that it accepts `customizer` which is
  30789. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30790. * path creation is handled by the method instead. The `customizer` is invoked
  30791. * with three arguments: (nsValue, key, nsObject).
  30792. *
  30793. * **Note:** This method mutates `object`.
  30794. *
  30795. * @static
  30796. * @memberOf _
  30797. * @since 4.0.0
  30798. * @category Object
  30799. * @param {Object} object The object to modify.
  30800. * @param {Array|string} path The path of the property to set.
  30801. * @param {*} value The value to set.
  30802. * @param {Function} [customizer] The function to customize assigned values.
  30803. * @returns {Object} Returns `object`.
  30804. * @example
  30805. *
  30806. * var object = {};
  30807. *
  30808. * _.setWith(object, '[0][1]', 'a', Object);
  30809. * // => { '0': { '1': 'a' } }
  30810. */
  30811. function setWith(object, path, value, customizer) {
  30812. customizer = typeof customizer == 'function' ? customizer : undefined;
  30813. return object == null ? object : baseSet(object, path, value, customizer);
  30814. }
  30815. /**
  30816. * Creates an array of own enumerable string keyed-value pairs for `object`
  30817. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  30818. * entries are returned.
  30819. *
  30820. * @static
  30821. * @memberOf _
  30822. * @since 4.0.0
  30823. * @alias entries
  30824. * @category Object
  30825. * @param {Object} object The object to query.
  30826. * @returns {Array} Returns the key-value pairs.
  30827. * @example
  30828. *
  30829. * function Foo() {
  30830. * this.a = 1;
  30831. * this.b = 2;
  30832. * }
  30833. *
  30834. * Foo.prototype.c = 3;
  30835. *
  30836. * _.toPairs(new Foo);
  30837. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  30838. */
  30839. var toPairs = createToPairs(keys);
  30840. /**
  30841. * Creates an array of own and inherited enumerable string keyed-value pairs
  30842. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  30843. * or set, its entries are returned.
  30844. *
  30845. * @static
  30846. * @memberOf _
  30847. * @since 4.0.0
  30848. * @alias entriesIn
  30849. * @category Object
  30850. * @param {Object} object The object to query.
  30851. * @returns {Array} Returns the key-value pairs.
  30852. * @example
  30853. *
  30854. * function Foo() {
  30855. * this.a = 1;
  30856. * this.b = 2;
  30857. * }
  30858. *
  30859. * Foo.prototype.c = 3;
  30860. *
  30861. * _.toPairsIn(new Foo);
  30862. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  30863. */
  30864. var toPairsIn = createToPairs(keysIn);
  30865. /**
  30866. * An alternative to `_.reduce`; this method transforms `object` to a new
  30867. * `accumulator` object which is the result of running each of its own
  30868. * enumerable string keyed properties thru `iteratee`, with each invocation
  30869. * potentially mutating the `accumulator` object. If `accumulator` is not
  30870. * provided, a new object with the same `[[Prototype]]` will be used. The
  30871. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  30872. * Iteratee functions may exit iteration early by explicitly returning `false`.
  30873. *
  30874. * @static
  30875. * @memberOf _
  30876. * @since 1.3.0
  30877. * @category Object
  30878. * @param {Object} object The object to iterate over.
  30879. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30880. * @param {*} [accumulator] The custom accumulator value.
  30881. * @returns {*} Returns the accumulated value.
  30882. * @example
  30883. *
  30884. * _.transform([2, 3, 4], function(result, n) {
  30885. * result.push(n *= n);
  30886. * return n % 2 == 0;
  30887. * }, []);
  30888. * // => [4, 9]
  30889. *
  30890. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  30891. * (result[value] || (result[value] = [])).push(key);
  30892. * }, {});
  30893. * // => { '1': ['a', 'c'], '2': ['b'] }
  30894. */
  30895. function transform(object, iteratee, accumulator) {
  30896. var isArr = isArray(object),
  30897. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  30898. iteratee = getIteratee(iteratee, 4);
  30899. if (accumulator == null) {
  30900. var Ctor = object && object.constructor;
  30901. if (isArrLike) {
  30902. accumulator = isArr ? new Ctor : [];
  30903. }
  30904. else if (isObject(object)) {
  30905. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  30906. }
  30907. else {
  30908. accumulator = {};
  30909. }
  30910. }
  30911. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  30912. return iteratee(accumulator, value, index, object);
  30913. });
  30914. return accumulator;
  30915. }
  30916. /**
  30917. * Removes the property at `path` of `object`.
  30918. *
  30919. * **Note:** This method mutates `object`.
  30920. *
  30921. * @static
  30922. * @memberOf _
  30923. * @since 4.0.0
  30924. * @category Object
  30925. * @param {Object} object The object to modify.
  30926. * @param {Array|string} path The path of the property to unset.
  30927. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  30928. * @example
  30929. *
  30930. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  30931. * _.unset(object, 'a[0].b.c');
  30932. * // => true
  30933. *
  30934. * console.log(object);
  30935. * // => { 'a': [{ 'b': {} }] };
  30936. *
  30937. * _.unset(object, ['a', '0', 'b', 'c']);
  30938. * // => true
  30939. *
  30940. * console.log(object);
  30941. * // => { 'a': [{ 'b': {} }] };
  30942. */
  30943. function unset(object, path) {
  30944. return object == null ? true : baseUnset(object, path);
  30945. }
  30946. /**
  30947. * This method is like `_.set` except that accepts `updater` to produce the
  30948. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  30949. * is invoked with one argument: (value).
  30950. *
  30951. * **Note:** This method mutates `object`.
  30952. *
  30953. * @static
  30954. * @memberOf _
  30955. * @since 4.6.0
  30956. * @category Object
  30957. * @param {Object} object The object to modify.
  30958. * @param {Array|string} path The path of the property to set.
  30959. * @param {Function} updater The function to produce the updated value.
  30960. * @returns {Object} Returns `object`.
  30961. * @example
  30962. *
  30963. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30964. *
  30965. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  30966. * console.log(object.a[0].b.c);
  30967. * // => 9
  30968. *
  30969. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  30970. * console.log(object.x[0].y.z);
  30971. * // => 0
  30972. */
  30973. function update(object, path, updater) {
  30974. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  30975. }
  30976. /**
  30977. * This method is like `_.update` except that it accepts `customizer` which is
  30978. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30979. * path creation is handled by the method instead. The `customizer` is invoked
  30980. * with three arguments: (nsValue, key, nsObject).
  30981. *
  30982. * **Note:** This method mutates `object`.
  30983. *
  30984. * @static
  30985. * @memberOf _
  30986. * @since 4.6.0
  30987. * @category Object
  30988. * @param {Object} object The object to modify.
  30989. * @param {Array|string} path The path of the property to set.
  30990. * @param {Function} updater The function to produce the updated value.
  30991. * @param {Function} [customizer] The function to customize assigned values.
  30992. * @returns {Object} Returns `object`.
  30993. * @example
  30994. *
  30995. * var object = {};
  30996. *
  30997. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  30998. * // => { '0': { '1': 'a' } }
  30999. */
  31000. function updateWith(object, path, updater, customizer) {
  31001. customizer = typeof customizer == 'function' ? customizer : undefined;
  31002. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31003. }
  31004. /**
  31005. * Creates an array of the own enumerable string keyed property values of `object`.
  31006. *
  31007. * **Note:** Non-object values are coerced to objects.
  31008. *
  31009. * @static
  31010. * @since 0.1.0
  31011. * @memberOf _
  31012. * @category Object
  31013. * @param {Object} object The object to query.
  31014. * @returns {Array} Returns the array of property values.
  31015. * @example
  31016. *
  31017. * function Foo() {
  31018. * this.a = 1;
  31019. * this.b = 2;
  31020. * }
  31021. *
  31022. * Foo.prototype.c = 3;
  31023. *
  31024. * _.values(new Foo);
  31025. * // => [1, 2] (iteration order is not guaranteed)
  31026. *
  31027. * _.values('hi');
  31028. * // => ['h', 'i']
  31029. */
  31030. function values(object) {
  31031. return object == null ? [] : baseValues(object, keys(object));
  31032. }
  31033. /**
  31034. * Creates an array of the own and inherited enumerable string keyed property
  31035. * values of `object`.
  31036. *
  31037. * **Note:** Non-object values are coerced to objects.
  31038. *
  31039. * @static
  31040. * @memberOf _
  31041. * @since 3.0.0
  31042. * @category Object
  31043. * @param {Object} object The object to query.
  31044. * @returns {Array} Returns the array of property values.
  31045. * @example
  31046. *
  31047. * function Foo() {
  31048. * this.a = 1;
  31049. * this.b = 2;
  31050. * }
  31051. *
  31052. * Foo.prototype.c = 3;
  31053. *
  31054. * _.valuesIn(new Foo);
  31055. * // => [1, 2, 3] (iteration order is not guaranteed)
  31056. */
  31057. function valuesIn(object) {
  31058. return object == null ? [] : baseValues(object, keysIn(object));
  31059. }
  31060. /*------------------------------------------------------------------------*/
  31061. /**
  31062. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31063. *
  31064. * @static
  31065. * @memberOf _
  31066. * @since 4.0.0
  31067. * @category Number
  31068. * @param {number} number The number to clamp.
  31069. * @param {number} [lower] The lower bound.
  31070. * @param {number} upper The upper bound.
  31071. * @returns {number} Returns the clamped number.
  31072. * @example
  31073. *
  31074. * _.clamp(-10, -5, 5);
  31075. * // => -5
  31076. *
  31077. * _.clamp(10, -5, 5);
  31078. * // => 5
  31079. */
  31080. function clamp(number, lower, upper) {
  31081. if (upper === undefined) {
  31082. upper = lower;
  31083. lower = undefined;
  31084. }
  31085. if (upper !== undefined) {
  31086. upper = toNumber(upper);
  31087. upper = upper === upper ? upper : 0;
  31088. }
  31089. if (lower !== undefined) {
  31090. lower = toNumber(lower);
  31091. lower = lower === lower ? lower : 0;
  31092. }
  31093. return baseClamp(toNumber(number), lower, upper);
  31094. }
  31095. /**
  31096. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31097. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31098. * If `start` is greater than `end` the params are swapped to support
  31099. * negative ranges.
  31100. *
  31101. * @static
  31102. * @memberOf _
  31103. * @since 3.3.0
  31104. * @category Number
  31105. * @param {number} number The number to check.
  31106. * @param {number} [start=0] The start of the range.
  31107. * @param {number} end The end of the range.
  31108. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31109. * @see _.range, _.rangeRight
  31110. * @example
  31111. *
  31112. * _.inRange(3, 2, 4);
  31113. * // => true
  31114. *
  31115. * _.inRange(4, 8);
  31116. * // => true
  31117. *
  31118. * _.inRange(4, 2);
  31119. * // => false
  31120. *
  31121. * _.inRange(2, 2);
  31122. * // => false
  31123. *
  31124. * _.inRange(1.2, 2);
  31125. * // => true
  31126. *
  31127. * _.inRange(5.2, 4);
  31128. * // => false
  31129. *
  31130. * _.inRange(-3, -2, -6);
  31131. * // => true
  31132. */
  31133. function inRange(number, start, end) {
  31134. start = toFinite(start);
  31135. if (end === undefined) {
  31136. end = start;
  31137. start = 0;
  31138. } else {
  31139. end = toFinite(end);
  31140. }
  31141. number = toNumber(number);
  31142. return baseInRange(number, start, end);
  31143. }
  31144. /**
  31145. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31146. * If only one argument is provided a number between `0` and the given number
  31147. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31148. * floats, a floating-point number is returned instead of an integer.
  31149. *
  31150. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31151. * floating-point values which can produce unexpected results.
  31152. *
  31153. * @static
  31154. * @memberOf _
  31155. * @since 0.7.0
  31156. * @category Number
  31157. * @param {number} [lower=0] The lower bound.
  31158. * @param {number} [upper=1] The upper bound.
  31159. * @param {boolean} [floating] Specify returning a floating-point number.
  31160. * @returns {number} Returns the random number.
  31161. * @example
  31162. *
  31163. * _.random(0, 5);
  31164. * // => an integer between 0 and 5
  31165. *
  31166. * _.random(5);
  31167. * // => also an integer between 0 and 5
  31168. *
  31169. * _.random(5, true);
  31170. * // => a floating-point number between 0 and 5
  31171. *
  31172. * _.random(1.2, 5.2);
  31173. * // => a floating-point number between 1.2 and 5.2
  31174. */
  31175. function random(lower, upper, floating) {
  31176. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31177. upper = floating = undefined;
  31178. }
  31179. if (floating === undefined) {
  31180. if (typeof upper == 'boolean') {
  31181. floating = upper;
  31182. upper = undefined;
  31183. }
  31184. else if (typeof lower == 'boolean') {
  31185. floating = lower;
  31186. lower = undefined;
  31187. }
  31188. }
  31189. if (lower === undefined && upper === undefined) {
  31190. lower = 0;
  31191. upper = 1;
  31192. }
  31193. else {
  31194. lower = toFinite(lower);
  31195. if (upper === undefined) {
  31196. upper = lower;
  31197. lower = 0;
  31198. } else {
  31199. upper = toFinite(upper);
  31200. }
  31201. }
  31202. if (lower > upper) {
  31203. var temp = lower;
  31204. lower = upper;
  31205. upper = temp;
  31206. }
  31207. if (floating || lower % 1 || upper % 1) {
  31208. var rand = nativeRandom();
  31209. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31210. }
  31211. return baseRandom(lower, upper);
  31212. }
  31213. /*------------------------------------------------------------------------*/
  31214. /**
  31215. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31216. *
  31217. * @static
  31218. * @memberOf _
  31219. * @since 3.0.0
  31220. * @category String
  31221. * @param {string} [string=''] The string to convert.
  31222. * @returns {string} Returns the camel cased string.
  31223. * @example
  31224. *
  31225. * _.camelCase('Foo Bar');
  31226. * // => 'fooBar'
  31227. *
  31228. * _.camelCase('--foo-bar--');
  31229. * // => 'fooBar'
  31230. *
  31231. * _.camelCase('__FOO_BAR__');
  31232. * // => 'fooBar'
  31233. */
  31234. var camelCase = createCompounder(function(result, word, index) {
  31235. word = word.toLowerCase();
  31236. return result + (index ? capitalize(word) : word);
  31237. });
  31238. /**
  31239. * Converts the first character of `string` to upper case and the remaining
  31240. * to lower case.
  31241. *
  31242. * @static
  31243. * @memberOf _
  31244. * @since 3.0.0
  31245. * @category String
  31246. * @param {string} [string=''] The string to capitalize.
  31247. * @returns {string} Returns the capitalized string.
  31248. * @example
  31249. *
  31250. * _.capitalize('FRED');
  31251. * // => 'Fred'
  31252. */
  31253. function capitalize(string) {
  31254. return upperFirst(toString(string).toLowerCase());
  31255. }
  31256. /**
  31257. * Deburrs `string` by converting
  31258. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31259. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31260. * letters to basic Latin letters and removing
  31261. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31262. *
  31263. * @static
  31264. * @memberOf _
  31265. * @since 3.0.0
  31266. * @category String
  31267. * @param {string} [string=''] The string to deburr.
  31268. * @returns {string} Returns the deburred string.
  31269. * @example
  31270. *
  31271. * _.deburr('déjà vu');
  31272. * // => 'deja vu'
  31273. */
  31274. function deburr(string) {
  31275. string = toString(string);
  31276. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31277. }
  31278. /**
  31279. * Checks if `string` ends with the given target string.
  31280. *
  31281. * @static
  31282. * @memberOf _
  31283. * @since 3.0.0
  31284. * @category String
  31285. * @param {string} [string=''] The string to inspect.
  31286. * @param {string} [target] The string to search for.
  31287. * @param {number} [position=string.length] The position to search up to.
  31288. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31289. * else `false`.
  31290. * @example
  31291. *
  31292. * _.endsWith('abc', 'c');
  31293. * // => true
  31294. *
  31295. * _.endsWith('abc', 'b');
  31296. * // => false
  31297. *
  31298. * _.endsWith('abc', 'b', 2);
  31299. * // => true
  31300. */
  31301. function endsWith(string, target, position) {
  31302. string = toString(string);
  31303. target = baseToString(target);
  31304. var length = string.length;
  31305. position = position === undefined
  31306. ? length
  31307. : baseClamp(toInteger(position), 0, length);
  31308. var end = position;
  31309. position -= target.length;
  31310. return position >= 0 && string.slice(position, end) == target;
  31311. }
  31312. /**
  31313. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31314. * corresponding HTML entities.
  31315. *
  31316. * **Note:** No other characters are escaped. To escape additional
  31317. * characters use a third-party library like [_he_](https://mths.be/he).
  31318. *
  31319. * Though the ">" character is escaped for symmetry, characters like
  31320. * ">" and "/" don't need escaping in HTML and have no special meaning
  31321. * unless they're part of a tag or unquoted attribute value. See
  31322. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31323. * (under "semi-related fun fact") for more details.
  31324. *
  31325. * When working with HTML you should always
  31326. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31327. * XSS vectors.
  31328. *
  31329. * @static
  31330. * @since 0.1.0
  31331. * @memberOf _
  31332. * @category String
  31333. * @param {string} [string=''] The string to escape.
  31334. * @returns {string} Returns the escaped string.
  31335. * @example
  31336. *
  31337. * _.escape('fred, barney, & pebbles');
  31338. * // => 'fred, barney, &amp; pebbles'
  31339. */
  31340. function escape(string) {
  31341. string = toString(string);
  31342. return (string && reHasUnescapedHtml.test(string))
  31343. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31344. : string;
  31345. }
  31346. /**
  31347. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31348. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31349. *
  31350. * @static
  31351. * @memberOf _
  31352. * @since 3.0.0
  31353. * @category String
  31354. * @param {string} [string=''] The string to escape.
  31355. * @returns {string} Returns the escaped string.
  31356. * @example
  31357. *
  31358. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31359. * // => '\[lodash\]\(https://lodash\.com/\)'
  31360. */
  31361. function escapeRegExp(string) {
  31362. string = toString(string);
  31363. return (string && reHasRegExpChar.test(string))
  31364. ? string.replace(reRegExpChar, '\\$&')
  31365. : string;
  31366. }
  31367. /**
  31368. * Converts `string` to
  31369. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31370. *
  31371. * @static
  31372. * @memberOf _
  31373. * @since 3.0.0
  31374. * @category String
  31375. * @param {string} [string=''] The string to convert.
  31376. * @returns {string} Returns the kebab cased string.
  31377. * @example
  31378. *
  31379. * _.kebabCase('Foo Bar');
  31380. * // => 'foo-bar'
  31381. *
  31382. * _.kebabCase('fooBar');
  31383. * // => 'foo-bar'
  31384. *
  31385. * _.kebabCase('__FOO_BAR__');
  31386. * // => 'foo-bar'
  31387. */
  31388. var kebabCase = createCompounder(function(result, word, index) {
  31389. return result + (index ? '-' : '') + word.toLowerCase();
  31390. });
  31391. /**
  31392. * Converts `string`, as space separated words, to lower case.
  31393. *
  31394. * @static
  31395. * @memberOf _
  31396. * @since 4.0.0
  31397. * @category String
  31398. * @param {string} [string=''] The string to convert.
  31399. * @returns {string} Returns the lower cased string.
  31400. * @example
  31401. *
  31402. * _.lowerCase('--Foo-Bar--');
  31403. * // => 'foo bar'
  31404. *
  31405. * _.lowerCase('fooBar');
  31406. * // => 'foo bar'
  31407. *
  31408. * _.lowerCase('__FOO_BAR__');
  31409. * // => 'foo bar'
  31410. */
  31411. var lowerCase = createCompounder(function(result, word, index) {
  31412. return result + (index ? ' ' : '') + word.toLowerCase();
  31413. });
  31414. /**
  31415. * Converts the first character of `string` to lower case.
  31416. *
  31417. * @static
  31418. * @memberOf _
  31419. * @since 4.0.0
  31420. * @category String
  31421. * @param {string} [string=''] The string to convert.
  31422. * @returns {string} Returns the converted string.
  31423. * @example
  31424. *
  31425. * _.lowerFirst('Fred');
  31426. * // => 'fred'
  31427. *
  31428. * _.lowerFirst('FRED');
  31429. * // => 'fRED'
  31430. */
  31431. var lowerFirst = createCaseFirst('toLowerCase');
  31432. /**
  31433. * Pads `string` on the left and right sides if it's shorter than `length`.
  31434. * Padding characters are truncated if they can't be evenly divided by `length`.
  31435. *
  31436. * @static
  31437. * @memberOf _
  31438. * @since 3.0.0
  31439. * @category String
  31440. * @param {string} [string=''] The string to pad.
  31441. * @param {number} [length=0] The padding length.
  31442. * @param {string} [chars=' '] The string used as padding.
  31443. * @returns {string} Returns the padded string.
  31444. * @example
  31445. *
  31446. * _.pad('abc', 8);
  31447. * // => ' abc '
  31448. *
  31449. * _.pad('abc', 8, '_-');
  31450. * // => '_-abc_-_'
  31451. *
  31452. * _.pad('abc', 3);
  31453. * // => 'abc'
  31454. */
  31455. function pad(string, length, chars) {
  31456. string = toString(string);
  31457. length = toInteger(length);
  31458. var strLength = length ? stringSize(string) : 0;
  31459. if (!length || strLength >= length) {
  31460. return string;
  31461. }
  31462. var mid = (length - strLength) / 2;
  31463. return (
  31464. createPadding(nativeFloor(mid), chars) +
  31465. string +
  31466. createPadding(nativeCeil(mid), chars)
  31467. );
  31468. }
  31469. /**
  31470. * Pads `string` on the right side if it's shorter than `length`. Padding
  31471. * characters are truncated if they exceed `length`.
  31472. *
  31473. * @static
  31474. * @memberOf _
  31475. * @since 4.0.0
  31476. * @category String
  31477. * @param {string} [string=''] The string to pad.
  31478. * @param {number} [length=0] The padding length.
  31479. * @param {string} [chars=' '] The string used as padding.
  31480. * @returns {string} Returns the padded string.
  31481. * @example
  31482. *
  31483. * _.padEnd('abc', 6);
  31484. * // => 'abc '
  31485. *
  31486. * _.padEnd('abc', 6, '_-');
  31487. * // => 'abc_-_'
  31488. *
  31489. * _.padEnd('abc', 3);
  31490. * // => 'abc'
  31491. */
  31492. function padEnd(string, length, chars) {
  31493. string = toString(string);
  31494. length = toInteger(length);
  31495. var strLength = length ? stringSize(string) : 0;
  31496. return (length && strLength < length)
  31497. ? (string + createPadding(length - strLength, chars))
  31498. : string;
  31499. }
  31500. /**
  31501. * Pads `string` on the left side if it's shorter than `length`. Padding
  31502. * characters are truncated if they exceed `length`.
  31503. *
  31504. * @static
  31505. * @memberOf _
  31506. * @since 4.0.0
  31507. * @category String
  31508. * @param {string} [string=''] The string to pad.
  31509. * @param {number} [length=0] The padding length.
  31510. * @param {string} [chars=' '] The string used as padding.
  31511. * @returns {string} Returns the padded string.
  31512. * @example
  31513. *
  31514. * _.padStart('abc', 6);
  31515. * // => ' abc'
  31516. *
  31517. * _.padStart('abc', 6, '_-');
  31518. * // => '_-_abc'
  31519. *
  31520. * _.padStart('abc', 3);
  31521. * // => 'abc'
  31522. */
  31523. function padStart(string, length, chars) {
  31524. string = toString(string);
  31525. length = toInteger(length);
  31526. var strLength = length ? stringSize(string) : 0;
  31527. return (length && strLength < length)
  31528. ? (createPadding(length - strLength, chars) + string)
  31529. : string;
  31530. }
  31531. /**
  31532. * Converts `string` to an integer of the specified radix. If `radix` is
  31533. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31534. * hexadecimal, in which case a `radix` of `16` is used.
  31535. *
  31536. * **Note:** This method aligns with the
  31537. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31538. *
  31539. * @static
  31540. * @memberOf _
  31541. * @since 1.1.0
  31542. * @category String
  31543. * @param {string} string The string to convert.
  31544. * @param {number} [radix=10] The radix to interpret `value` by.
  31545. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31546. * @returns {number} Returns the converted integer.
  31547. * @example
  31548. *
  31549. * _.parseInt('08');
  31550. * // => 8
  31551. *
  31552. * _.map(['6', '08', '10'], _.parseInt);
  31553. * // => [6, 8, 10]
  31554. */
  31555. function parseInt(string, radix, guard) {
  31556. if (guard || radix == null) {
  31557. radix = 0;
  31558. } else if (radix) {
  31559. radix = +radix;
  31560. }
  31561. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31562. }
  31563. /**
  31564. * Repeats the given string `n` times.
  31565. *
  31566. * @static
  31567. * @memberOf _
  31568. * @since 3.0.0
  31569. * @category String
  31570. * @param {string} [string=''] The string to repeat.
  31571. * @param {number} [n=1] The number of times to repeat the string.
  31572. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31573. * @returns {string} Returns the repeated string.
  31574. * @example
  31575. *
  31576. * _.repeat('*', 3);
  31577. * // => '***'
  31578. *
  31579. * _.repeat('abc', 2);
  31580. * // => 'abcabc'
  31581. *
  31582. * _.repeat('abc', 0);
  31583. * // => ''
  31584. */
  31585. function repeat(string, n, guard) {
  31586. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31587. n = 1;
  31588. } else {
  31589. n = toInteger(n);
  31590. }
  31591. return baseRepeat(toString(string), n);
  31592. }
  31593. /**
  31594. * Replaces matches for `pattern` in `string` with `replacement`.
  31595. *
  31596. * **Note:** This method is based on
  31597. * [`String#replace`](https://mdn.io/String/replace).
  31598. *
  31599. * @static
  31600. * @memberOf _
  31601. * @since 4.0.0
  31602. * @category String
  31603. * @param {string} [string=''] The string to modify.
  31604. * @param {RegExp|string} pattern The pattern to replace.
  31605. * @param {Function|string} replacement The match replacement.
  31606. * @returns {string} Returns the modified string.
  31607. * @example
  31608. *
  31609. * _.replace('Hi Fred', 'Fred', 'Barney');
  31610. * // => 'Hi Barney'
  31611. */
  31612. function replace() {
  31613. var args = arguments,
  31614. string = toString(args[0]);
  31615. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31616. }
  31617. /**
  31618. * Converts `string` to
  31619. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31620. *
  31621. * @static
  31622. * @memberOf _
  31623. * @since 3.0.0
  31624. * @category String
  31625. * @param {string} [string=''] The string to convert.
  31626. * @returns {string} Returns the snake cased string.
  31627. * @example
  31628. *
  31629. * _.snakeCase('Foo Bar');
  31630. * // => 'foo_bar'
  31631. *
  31632. * _.snakeCase('fooBar');
  31633. * // => 'foo_bar'
  31634. *
  31635. * _.snakeCase('--FOO-BAR--');
  31636. * // => 'foo_bar'
  31637. */
  31638. var snakeCase = createCompounder(function(result, word, index) {
  31639. return result + (index ? '_' : '') + word.toLowerCase();
  31640. });
  31641. /**
  31642. * Splits `string` by `separator`.
  31643. *
  31644. * **Note:** This method is based on
  31645. * [`String#split`](https://mdn.io/String/split).
  31646. *
  31647. * @static
  31648. * @memberOf _
  31649. * @since 4.0.0
  31650. * @category String
  31651. * @param {string} [string=''] The string to split.
  31652. * @param {RegExp|string} separator The separator pattern to split by.
  31653. * @param {number} [limit] The length to truncate results to.
  31654. * @returns {Array} Returns the string segments.
  31655. * @example
  31656. *
  31657. * _.split('a-b-c', '-', 2);
  31658. * // => ['a', 'b']
  31659. */
  31660. function split(string, separator, limit) {
  31661. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31662. separator = limit = undefined;
  31663. }
  31664. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31665. if (!limit) {
  31666. return [];
  31667. }
  31668. string = toString(string);
  31669. if (string && (
  31670. typeof separator == 'string' ||
  31671. (separator != null && !isRegExp(separator))
  31672. )) {
  31673. separator = baseToString(separator);
  31674. if (!separator && hasUnicode(string)) {
  31675. return castSlice(stringToArray(string), 0, limit);
  31676. }
  31677. }
  31678. return string.split(separator, limit);
  31679. }
  31680. /**
  31681. * Converts `string` to
  31682. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31683. *
  31684. * @static
  31685. * @memberOf _
  31686. * @since 3.1.0
  31687. * @category String
  31688. * @param {string} [string=''] The string to convert.
  31689. * @returns {string} Returns the start cased string.
  31690. * @example
  31691. *
  31692. * _.startCase('--foo-bar--');
  31693. * // => 'Foo Bar'
  31694. *
  31695. * _.startCase('fooBar');
  31696. * // => 'Foo Bar'
  31697. *
  31698. * _.startCase('__FOO_BAR__');
  31699. * // => 'FOO BAR'
  31700. */
  31701. var startCase = createCompounder(function(result, word, index) {
  31702. return result + (index ? ' ' : '') + upperFirst(word);
  31703. });
  31704. /**
  31705. * Checks if `string` starts with the given target string.
  31706. *
  31707. * @static
  31708. * @memberOf _
  31709. * @since 3.0.0
  31710. * @category String
  31711. * @param {string} [string=''] The string to inspect.
  31712. * @param {string} [target] The string to search for.
  31713. * @param {number} [position=0] The position to search from.
  31714. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31715. * else `false`.
  31716. * @example
  31717. *
  31718. * _.startsWith('abc', 'a');
  31719. * // => true
  31720. *
  31721. * _.startsWith('abc', 'b');
  31722. * // => false
  31723. *
  31724. * _.startsWith('abc', 'b', 1);
  31725. * // => true
  31726. */
  31727. function startsWith(string, target, position) {
  31728. string = toString(string);
  31729. position = position == null
  31730. ? 0
  31731. : baseClamp(toInteger(position), 0, string.length);
  31732. target = baseToString(target);
  31733. return string.slice(position, position + target.length) == target;
  31734. }
  31735. /**
  31736. * Creates a compiled template function that can interpolate data properties
  31737. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  31738. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  31739. * properties may be accessed as free variables in the template. If a setting
  31740. * object is given, it takes precedence over `_.templateSettings` values.
  31741. *
  31742. * **Note:** In the development build `_.template` utilizes
  31743. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  31744. * for easier debugging.
  31745. *
  31746. * For more information on precompiling templates see
  31747. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  31748. *
  31749. * For more information on Chrome extension sandboxes see
  31750. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  31751. *
  31752. * @static
  31753. * @since 0.1.0
  31754. * @memberOf _
  31755. * @category String
  31756. * @param {string} [string=''] The template string.
  31757. * @param {Object} [options={}] The options object.
  31758. * @param {RegExp} [options.escape=_.templateSettings.escape]
  31759. * The HTML "escape" delimiter.
  31760. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  31761. * The "evaluate" delimiter.
  31762. * @param {Object} [options.imports=_.templateSettings.imports]
  31763. * An object to import into the template as free variables.
  31764. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  31765. * The "interpolate" delimiter.
  31766. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  31767. * The sourceURL of the compiled template.
  31768. * @param {string} [options.variable='obj']
  31769. * The data object variable name.
  31770. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31771. * @returns {Function} Returns the compiled template function.
  31772. * @example
  31773. *
  31774. * // Use the "interpolate" delimiter to create a compiled template.
  31775. * var compiled = _.template('hello <%= user %>!');
  31776. * compiled({ 'user': 'fred' });
  31777. * // => 'hello fred!'
  31778. *
  31779. * // Use the HTML "escape" delimiter to escape data property values.
  31780. * var compiled = _.template('<b><%- value %></b>');
  31781. * compiled({ 'value': '<script>' });
  31782. * // => '<b>&lt;script&gt;</b>'
  31783. *
  31784. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  31785. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  31786. * compiled({ 'users': ['fred', 'barney'] });
  31787. * // => '<li>fred</li><li>barney</li>'
  31788. *
  31789. * // Use the internal `print` function in "evaluate" delimiters.
  31790. * var compiled = _.template('<% print("hello " + user); %>!');
  31791. * compiled({ 'user': 'barney' });
  31792. * // => 'hello barney!'
  31793. *
  31794. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  31795. * // Disable support by replacing the "interpolate" delimiter.
  31796. * var compiled = _.template('hello ${ user }!');
  31797. * compiled({ 'user': 'pebbles' });
  31798. * // => 'hello pebbles!'
  31799. *
  31800. * // Use backslashes to treat delimiters as plain text.
  31801. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  31802. * compiled({ 'value': 'ignored' });
  31803. * // => '<%- value %>'
  31804. *
  31805. * // Use the `imports` option to import `jQuery` as `jq`.
  31806. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  31807. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  31808. * compiled({ 'users': ['fred', 'barney'] });
  31809. * // => '<li>fred</li><li>barney</li>'
  31810. *
  31811. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  31812. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  31813. * compiled(data);
  31814. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  31815. *
  31816. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  31817. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  31818. * compiled.source;
  31819. * // => function(data) {
  31820. * // var __t, __p = '';
  31821. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  31822. * // return __p;
  31823. * // }
  31824. *
  31825. * // Use custom template delimiters.
  31826. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  31827. * var compiled = _.template('hello {{ user }}!');
  31828. * compiled({ 'user': 'mustache' });
  31829. * // => 'hello mustache!'
  31830. *
  31831. * // Use the `source` property to inline compiled templates for meaningful
  31832. * // line numbers in error messages and stack traces.
  31833. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  31834. * var JST = {\
  31835. * "main": ' + _.template(mainText).source + '\
  31836. * };\
  31837. * ');
  31838. */
  31839. function template(string, options, guard) {
  31840. // Based on John Resig's `tmpl` implementation
  31841. // (http://ejohn.org/blog/javascript-micro-templating/)
  31842. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  31843. var settings = lodash.templateSettings;
  31844. if (guard && isIterateeCall(string, options, guard)) {
  31845. options = undefined;
  31846. }
  31847. string = toString(string);
  31848. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  31849. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  31850. importsKeys = keys(imports),
  31851. importsValues = baseValues(imports, importsKeys);
  31852. var isEscaping,
  31853. isEvaluating,
  31854. index = 0,
  31855. interpolate = options.interpolate || reNoMatch,
  31856. source = "__p += '";
  31857. // Compile the regexp to match each delimiter.
  31858. var reDelimiters = RegExp(
  31859. (options.escape || reNoMatch).source + '|' +
  31860. interpolate.source + '|' +
  31861. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  31862. (options.evaluate || reNoMatch).source + '|$'
  31863. , 'g');
  31864. // Use a sourceURL for easier debugging.
  31865. // The sourceURL gets injected into the source that's eval-ed, so be careful
  31866. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  31867. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  31868. var sourceURL = '//# sourceURL=' +
  31869. (hasOwnProperty.call(options, 'sourceURL')
  31870. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  31871. : ('lodash.templateSources[' + (++templateCounter) + ']')
  31872. ) + '\n';
  31873. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  31874. interpolateValue || (interpolateValue = esTemplateValue);
  31875. // Escape characters that can't be included in string literals.
  31876. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  31877. // Replace delimiters with snippets.
  31878. if (escapeValue) {
  31879. isEscaping = true;
  31880. source += "' +\n__e(" + escapeValue + ") +\n'";
  31881. }
  31882. if (evaluateValue) {
  31883. isEvaluating = true;
  31884. source += "';\n" + evaluateValue + ";\n__p += '";
  31885. }
  31886. if (interpolateValue) {
  31887. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  31888. }
  31889. index = offset + match.length;
  31890. // The JS engine embedded in Adobe products needs `match` returned in
  31891. // order to produce the correct `offset` value.
  31892. return match;
  31893. });
  31894. source += "';\n";
  31895. // If `variable` is not specified wrap a with-statement around the generated
  31896. // code to add the data object to the top of the scope chain.
  31897. // Like with sourceURL, we take care to not check the option's prototype,
  31898. // as this configuration is a code injection vector.
  31899. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  31900. if (!variable) {
  31901. source = 'with (obj) {\n' + source + '\n}\n';
  31902. }
  31903. // Cleanup code by stripping empty strings.
  31904. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  31905. .replace(reEmptyStringMiddle, '$1')
  31906. .replace(reEmptyStringTrailing, '$1;');
  31907. // Frame code as the function body.
  31908. source = 'function(' + (variable || 'obj') + ') {\n' +
  31909. (variable
  31910. ? ''
  31911. : 'obj || (obj = {});\n'
  31912. ) +
  31913. "var __t, __p = ''" +
  31914. (isEscaping
  31915. ? ', __e = _.escape'
  31916. : ''
  31917. ) +
  31918. (isEvaluating
  31919. ? ', __j = Array.prototype.join;\n' +
  31920. "function print() { __p += __j.call(arguments, '') }\n"
  31921. : ';\n'
  31922. ) +
  31923. source +
  31924. 'return __p\n}';
  31925. var result = attempt(function() {
  31926. return Function(importsKeys, sourceURL + 'return ' + source)
  31927. .apply(undefined, importsValues);
  31928. });
  31929. // Provide the compiled function's source by its `toString` method or
  31930. // the `source` property as a convenience for inlining compiled templates.
  31931. result.source = source;
  31932. if (isError(result)) {
  31933. throw result;
  31934. }
  31935. return result;
  31936. }
  31937. /**
  31938. * Converts `string`, as a whole, to lower case just like
  31939. * [String#toLowerCase](https://mdn.io/toLowerCase).
  31940. *
  31941. * @static
  31942. * @memberOf _
  31943. * @since 4.0.0
  31944. * @category String
  31945. * @param {string} [string=''] The string to convert.
  31946. * @returns {string} Returns the lower cased string.
  31947. * @example
  31948. *
  31949. * _.toLower('--Foo-Bar--');
  31950. * // => '--foo-bar--'
  31951. *
  31952. * _.toLower('fooBar');
  31953. * // => 'foobar'
  31954. *
  31955. * _.toLower('__FOO_BAR__');
  31956. * // => '__foo_bar__'
  31957. */
  31958. function toLower(value) {
  31959. return toString(value).toLowerCase();
  31960. }
  31961. /**
  31962. * Converts `string`, as a whole, to upper case just like
  31963. * [String#toUpperCase](https://mdn.io/toUpperCase).
  31964. *
  31965. * @static
  31966. * @memberOf _
  31967. * @since 4.0.0
  31968. * @category String
  31969. * @param {string} [string=''] The string to convert.
  31970. * @returns {string} Returns the upper cased string.
  31971. * @example
  31972. *
  31973. * _.toUpper('--foo-bar--');
  31974. * // => '--FOO-BAR--'
  31975. *
  31976. * _.toUpper('fooBar');
  31977. * // => 'FOOBAR'
  31978. *
  31979. * _.toUpper('__foo_bar__');
  31980. * // => '__FOO_BAR__'
  31981. */
  31982. function toUpper(value) {
  31983. return toString(value).toUpperCase();
  31984. }
  31985. /**
  31986. * Removes leading and trailing whitespace or specified characters from `string`.
  31987. *
  31988. * @static
  31989. * @memberOf _
  31990. * @since 3.0.0
  31991. * @category String
  31992. * @param {string} [string=''] The string to trim.
  31993. * @param {string} [chars=whitespace] The characters to trim.
  31994. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31995. * @returns {string} Returns the trimmed string.
  31996. * @example
  31997. *
  31998. * _.trim(' abc ');
  31999. * // => 'abc'
  32000. *
  32001. * _.trim('-_-abc-_-', '_-');
  32002. * // => 'abc'
  32003. *
  32004. * _.map([' foo ', ' bar '], _.trim);
  32005. * // => ['foo', 'bar']
  32006. */
  32007. function trim(string, chars, guard) {
  32008. string = toString(string);
  32009. if (string && (guard || chars === undefined)) {
  32010. return string.replace(reTrim, '');
  32011. }
  32012. if (!string || !(chars = baseToString(chars))) {
  32013. return string;
  32014. }
  32015. var strSymbols = stringToArray(string),
  32016. chrSymbols = stringToArray(chars),
  32017. start = charsStartIndex(strSymbols, chrSymbols),
  32018. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32019. return castSlice(strSymbols, start, end).join('');
  32020. }
  32021. /**
  32022. * Removes trailing whitespace or specified characters from `string`.
  32023. *
  32024. * @static
  32025. * @memberOf _
  32026. * @since 4.0.0
  32027. * @category String
  32028. * @param {string} [string=''] The string to trim.
  32029. * @param {string} [chars=whitespace] The characters to trim.
  32030. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32031. * @returns {string} Returns the trimmed string.
  32032. * @example
  32033. *
  32034. * _.trimEnd(' abc ');
  32035. * // => ' abc'
  32036. *
  32037. * _.trimEnd('-_-abc-_-', '_-');
  32038. * // => '-_-abc'
  32039. */
  32040. function trimEnd(string, chars, guard) {
  32041. string = toString(string);
  32042. if (string && (guard || chars === undefined)) {
  32043. return string.replace(reTrimEnd, '');
  32044. }
  32045. if (!string || !(chars = baseToString(chars))) {
  32046. return string;
  32047. }
  32048. var strSymbols = stringToArray(string),
  32049. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32050. return castSlice(strSymbols, 0, end).join('');
  32051. }
  32052. /**
  32053. * Removes leading whitespace or specified characters from `string`.
  32054. *
  32055. * @static
  32056. * @memberOf _
  32057. * @since 4.0.0
  32058. * @category String
  32059. * @param {string} [string=''] The string to trim.
  32060. * @param {string} [chars=whitespace] The characters to trim.
  32061. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32062. * @returns {string} Returns the trimmed string.
  32063. * @example
  32064. *
  32065. * _.trimStart(' abc ');
  32066. * // => 'abc '
  32067. *
  32068. * _.trimStart('-_-abc-_-', '_-');
  32069. * // => 'abc-_-'
  32070. */
  32071. function trimStart(string, chars, guard) {
  32072. string = toString(string);
  32073. if (string && (guard || chars === undefined)) {
  32074. return string.replace(reTrimStart, '');
  32075. }
  32076. if (!string || !(chars = baseToString(chars))) {
  32077. return string;
  32078. }
  32079. var strSymbols = stringToArray(string),
  32080. start = charsStartIndex(strSymbols, stringToArray(chars));
  32081. return castSlice(strSymbols, start).join('');
  32082. }
  32083. /**
  32084. * Truncates `string` if it's longer than the given maximum string length.
  32085. * The last characters of the truncated string are replaced with the omission
  32086. * string which defaults to "...".
  32087. *
  32088. * @static
  32089. * @memberOf _
  32090. * @since 4.0.0
  32091. * @category String
  32092. * @param {string} [string=''] The string to truncate.
  32093. * @param {Object} [options={}] The options object.
  32094. * @param {number} [options.length=30] The maximum string length.
  32095. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32096. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32097. * @returns {string} Returns the truncated string.
  32098. * @example
  32099. *
  32100. * _.truncate('hi-diddly-ho there, neighborino');
  32101. * // => 'hi-diddly-ho there, neighbo...'
  32102. *
  32103. * _.truncate('hi-diddly-ho there, neighborino', {
  32104. * 'length': 24,
  32105. * 'separator': ' '
  32106. * });
  32107. * // => 'hi-diddly-ho there,...'
  32108. *
  32109. * _.truncate('hi-diddly-ho there, neighborino', {
  32110. * 'length': 24,
  32111. * 'separator': /,? +/
  32112. * });
  32113. * // => 'hi-diddly-ho there...'
  32114. *
  32115. * _.truncate('hi-diddly-ho there, neighborino', {
  32116. * 'omission': ' [...]'
  32117. * });
  32118. * // => 'hi-diddly-ho there, neig [...]'
  32119. */
  32120. function truncate(string, options) {
  32121. var length = DEFAULT_TRUNC_LENGTH,
  32122. omission = DEFAULT_TRUNC_OMISSION;
  32123. if (isObject(options)) {
  32124. var separator = 'separator' in options ? options.separator : separator;
  32125. length = 'length' in options ? toInteger(options.length) : length;
  32126. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32127. }
  32128. string = toString(string);
  32129. var strLength = string.length;
  32130. if (hasUnicode(string)) {
  32131. var strSymbols = stringToArray(string);
  32132. strLength = strSymbols.length;
  32133. }
  32134. if (length >= strLength) {
  32135. return string;
  32136. }
  32137. var end = length - stringSize(omission);
  32138. if (end < 1) {
  32139. return omission;
  32140. }
  32141. var result = strSymbols
  32142. ? castSlice(strSymbols, 0, end).join('')
  32143. : string.slice(0, end);
  32144. if (separator === undefined) {
  32145. return result + omission;
  32146. }
  32147. if (strSymbols) {
  32148. end += (result.length - end);
  32149. }
  32150. if (isRegExp(separator)) {
  32151. if (string.slice(end).search(separator)) {
  32152. var match,
  32153. substring = result;
  32154. if (!separator.global) {
  32155. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32156. }
  32157. separator.lastIndex = 0;
  32158. while ((match = separator.exec(substring))) {
  32159. var newEnd = match.index;
  32160. }
  32161. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32162. }
  32163. } else if (string.indexOf(baseToString(separator), end) != end) {
  32164. var index = result.lastIndexOf(separator);
  32165. if (index > -1) {
  32166. result = result.slice(0, index);
  32167. }
  32168. }
  32169. return result + omission;
  32170. }
  32171. /**
  32172. * The inverse of `_.escape`; this method converts the HTML entities
  32173. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32174. * their corresponding characters.
  32175. *
  32176. * **Note:** No other HTML entities are unescaped. To unescape additional
  32177. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32178. *
  32179. * @static
  32180. * @memberOf _
  32181. * @since 0.6.0
  32182. * @category String
  32183. * @param {string} [string=''] The string to unescape.
  32184. * @returns {string} Returns the unescaped string.
  32185. * @example
  32186. *
  32187. * _.unescape('fred, barney, &amp; pebbles');
  32188. * // => 'fred, barney, & pebbles'
  32189. */
  32190. function unescape(string) {
  32191. string = toString(string);
  32192. return (string && reHasEscapedHtml.test(string))
  32193. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32194. : string;
  32195. }
  32196. /**
  32197. * Converts `string`, as space separated words, to upper case.
  32198. *
  32199. * @static
  32200. * @memberOf _
  32201. * @since 4.0.0
  32202. * @category String
  32203. * @param {string} [string=''] The string to convert.
  32204. * @returns {string} Returns the upper cased string.
  32205. * @example
  32206. *
  32207. * _.upperCase('--foo-bar');
  32208. * // => 'FOO BAR'
  32209. *
  32210. * _.upperCase('fooBar');
  32211. * // => 'FOO BAR'
  32212. *
  32213. * _.upperCase('__foo_bar__');
  32214. * // => 'FOO BAR'
  32215. */
  32216. var upperCase = createCompounder(function(result, word, index) {
  32217. return result + (index ? ' ' : '') + word.toUpperCase();
  32218. });
  32219. /**
  32220. * Converts the first character of `string` to upper case.
  32221. *
  32222. * @static
  32223. * @memberOf _
  32224. * @since 4.0.0
  32225. * @category String
  32226. * @param {string} [string=''] The string to convert.
  32227. * @returns {string} Returns the converted string.
  32228. * @example
  32229. *
  32230. * _.upperFirst('fred');
  32231. * // => 'Fred'
  32232. *
  32233. * _.upperFirst('FRED');
  32234. * // => 'FRED'
  32235. */
  32236. var upperFirst = createCaseFirst('toUpperCase');
  32237. /**
  32238. * Splits `string` into an array of its words.
  32239. *
  32240. * @static
  32241. * @memberOf _
  32242. * @since 3.0.0
  32243. * @category String
  32244. * @param {string} [string=''] The string to inspect.
  32245. * @param {RegExp|string} [pattern] The pattern to match words.
  32246. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32247. * @returns {Array} Returns the words of `string`.
  32248. * @example
  32249. *
  32250. * _.words('fred, barney, & pebbles');
  32251. * // => ['fred', 'barney', 'pebbles']
  32252. *
  32253. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32254. * // => ['fred', 'barney', '&', 'pebbles']
  32255. */
  32256. function words(string, pattern, guard) {
  32257. string = toString(string);
  32258. pattern = guard ? undefined : pattern;
  32259. if (pattern === undefined) {
  32260. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32261. }
  32262. return string.match(pattern) || [];
  32263. }
  32264. /*------------------------------------------------------------------------*/
  32265. /**
  32266. * Attempts to invoke `func`, returning either the result or the caught error
  32267. * object. Any additional arguments are provided to `func` when it's invoked.
  32268. *
  32269. * @static
  32270. * @memberOf _
  32271. * @since 3.0.0
  32272. * @category Util
  32273. * @param {Function} func The function to attempt.
  32274. * @param {...*} [args] The arguments to invoke `func` with.
  32275. * @returns {*} Returns the `func` result or error object.
  32276. * @example
  32277. *
  32278. * // Avoid throwing errors for invalid selectors.
  32279. * var elements = _.attempt(function(selector) {
  32280. * return document.querySelectorAll(selector);
  32281. * }, '>_>');
  32282. *
  32283. * if (_.isError(elements)) {
  32284. * elements = [];
  32285. * }
  32286. */
  32287. var attempt = baseRest(function(func, args) {
  32288. try {
  32289. return apply(func, undefined, args);
  32290. } catch (e) {
  32291. return isError(e) ? e : new Error(e);
  32292. }
  32293. });
  32294. /**
  32295. * Binds methods of an object to the object itself, overwriting the existing
  32296. * method.
  32297. *
  32298. * **Note:** This method doesn't set the "length" property of bound functions.
  32299. *
  32300. * @static
  32301. * @since 0.1.0
  32302. * @memberOf _
  32303. * @category Util
  32304. * @param {Object} object The object to bind and assign the bound methods to.
  32305. * @param {...(string|string[])} methodNames The object method names to bind.
  32306. * @returns {Object} Returns `object`.
  32307. * @example
  32308. *
  32309. * var view = {
  32310. * 'label': 'docs',
  32311. * 'click': function() {
  32312. * console.log('clicked ' + this.label);
  32313. * }
  32314. * };
  32315. *
  32316. * _.bindAll(view, ['click']);
  32317. * jQuery(element).on('click', view.click);
  32318. * // => Logs 'clicked docs' when clicked.
  32319. */
  32320. var bindAll = flatRest(function(object, methodNames) {
  32321. arrayEach(methodNames, function(key) {
  32322. key = toKey(key);
  32323. baseAssignValue(object, key, bind(object[key], object));
  32324. });
  32325. return object;
  32326. });
  32327. /**
  32328. * Creates a function that iterates over `pairs` and invokes the corresponding
  32329. * function of the first predicate to return truthy. The predicate-function
  32330. * pairs are invoked with the `this` binding and arguments of the created
  32331. * function.
  32332. *
  32333. * @static
  32334. * @memberOf _
  32335. * @since 4.0.0
  32336. * @category Util
  32337. * @param {Array} pairs The predicate-function pairs.
  32338. * @returns {Function} Returns the new composite function.
  32339. * @example
  32340. *
  32341. * var func = _.cond([
  32342. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32343. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32344. * [_.stubTrue, _.constant('no match')]
  32345. * ]);
  32346. *
  32347. * func({ 'a': 1, 'b': 2 });
  32348. * // => 'matches A'
  32349. *
  32350. * func({ 'a': 0, 'b': 1 });
  32351. * // => 'matches B'
  32352. *
  32353. * func({ 'a': '1', 'b': '2' });
  32354. * // => 'no match'
  32355. */
  32356. function cond(pairs) {
  32357. var length = pairs == null ? 0 : pairs.length,
  32358. toIteratee = getIteratee();
  32359. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32360. if (typeof pair[1] != 'function') {
  32361. throw new TypeError(FUNC_ERROR_TEXT);
  32362. }
  32363. return [toIteratee(pair[0]), pair[1]];
  32364. });
  32365. return baseRest(function(args) {
  32366. var index = -1;
  32367. while (++index < length) {
  32368. var pair = pairs[index];
  32369. if (apply(pair[0], this, args)) {
  32370. return apply(pair[1], this, args);
  32371. }
  32372. }
  32373. });
  32374. }
  32375. /**
  32376. * Creates a function that invokes the predicate properties of `source` with
  32377. * the corresponding property values of a given object, returning `true` if
  32378. * all predicates return truthy, else `false`.
  32379. *
  32380. * **Note:** The created function is equivalent to `_.conformsTo` with
  32381. * `source` partially applied.
  32382. *
  32383. * @static
  32384. * @memberOf _
  32385. * @since 4.0.0
  32386. * @category Util
  32387. * @param {Object} source The object of property predicates to conform to.
  32388. * @returns {Function} Returns the new spec function.
  32389. * @example
  32390. *
  32391. * var objects = [
  32392. * { 'a': 2, 'b': 1 },
  32393. * { 'a': 1, 'b': 2 }
  32394. * ];
  32395. *
  32396. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32397. * // => [{ 'a': 1, 'b': 2 }]
  32398. */
  32399. function conforms(source) {
  32400. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32401. }
  32402. /**
  32403. * Creates a function that returns `value`.
  32404. *
  32405. * @static
  32406. * @memberOf _
  32407. * @since 2.4.0
  32408. * @category Util
  32409. * @param {*} value The value to return from the new function.
  32410. * @returns {Function} Returns the new constant function.
  32411. * @example
  32412. *
  32413. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32414. *
  32415. * console.log(objects);
  32416. * // => [{ 'a': 1 }, { 'a': 1 }]
  32417. *
  32418. * console.log(objects[0] === objects[1]);
  32419. * // => true
  32420. */
  32421. function constant(value) {
  32422. return function() {
  32423. return value;
  32424. };
  32425. }
  32426. /**
  32427. * Checks `value` to determine whether a default value should be returned in
  32428. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32429. * or `undefined`.
  32430. *
  32431. * @static
  32432. * @memberOf _
  32433. * @since 4.14.0
  32434. * @category Util
  32435. * @param {*} value The value to check.
  32436. * @param {*} defaultValue The default value.
  32437. * @returns {*} Returns the resolved value.
  32438. * @example
  32439. *
  32440. * _.defaultTo(1, 10);
  32441. * // => 1
  32442. *
  32443. * _.defaultTo(undefined, 10);
  32444. * // => 10
  32445. */
  32446. function defaultTo(value, defaultValue) {
  32447. return (value == null || value !== value) ? defaultValue : value;
  32448. }
  32449. /**
  32450. * Creates a function that returns the result of invoking the given functions
  32451. * with the `this` binding of the created function, where each successive
  32452. * invocation is supplied the return value of the previous.
  32453. *
  32454. * @static
  32455. * @memberOf _
  32456. * @since 3.0.0
  32457. * @category Util
  32458. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32459. * @returns {Function} Returns the new composite function.
  32460. * @see _.flowRight
  32461. * @example
  32462. *
  32463. * function square(n) {
  32464. * return n * n;
  32465. * }
  32466. *
  32467. * var addSquare = _.flow([_.add, square]);
  32468. * addSquare(1, 2);
  32469. * // => 9
  32470. */
  32471. var flow = createFlow();
  32472. /**
  32473. * This method is like `_.flow` except that it creates a function that
  32474. * invokes the given functions from right to left.
  32475. *
  32476. * @static
  32477. * @since 3.0.0
  32478. * @memberOf _
  32479. * @category Util
  32480. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32481. * @returns {Function} Returns the new composite function.
  32482. * @see _.flow
  32483. * @example
  32484. *
  32485. * function square(n) {
  32486. * return n * n;
  32487. * }
  32488. *
  32489. * var addSquare = _.flowRight([square, _.add]);
  32490. * addSquare(1, 2);
  32491. * // => 9
  32492. */
  32493. var flowRight = createFlow(true);
  32494. /**
  32495. * This method returns the first argument it receives.
  32496. *
  32497. * @static
  32498. * @since 0.1.0
  32499. * @memberOf _
  32500. * @category Util
  32501. * @param {*} value Any value.
  32502. * @returns {*} Returns `value`.
  32503. * @example
  32504. *
  32505. * var object = { 'a': 1 };
  32506. *
  32507. * console.log(_.identity(object) === object);
  32508. * // => true
  32509. */
  32510. function identity(value) {
  32511. return value;
  32512. }
  32513. /**
  32514. * Creates a function that invokes `func` with the arguments of the created
  32515. * function. If `func` is a property name, the created function returns the
  32516. * property value for a given element. If `func` is an array or object, the
  32517. * created function returns `true` for elements that contain the equivalent
  32518. * source properties, otherwise it returns `false`.
  32519. *
  32520. * @static
  32521. * @since 4.0.0
  32522. * @memberOf _
  32523. * @category Util
  32524. * @param {*} [func=_.identity] The value to convert to a callback.
  32525. * @returns {Function} Returns the callback.
  32526. * @example
  32527. *
  32528. * var users = [
  32529. * { 'user': 'barney', 'age': 36, 'active': true },
  32530. * { 'user': 'fred', 'age': 40, 'active': false }
  32531. * ];
  32532. *
  32533. * // The `_.matches` iteratee shorthand.
  32534. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32535. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32536. *
  32537. * // The `_.matchesProperty` iteratee shorthand.
  32538. * _.filter(users, _.iteratee(['user', 'fred']));
  32539. * // => [{ 'user': 'fred', 'age': 40 }]
  32540. *
  32541. * // The `_.property` iteratee shorthand.
  32542. * _.map(users, _.iteratee('user'));
  32543. * // => ['barney', 'fred']
  32544. *
  32545. * // Create custom iteratee shorthands.
  32546. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32547. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32548. * return func.test(string);
  32549. * };
  32550. * });
  32551. *
  32552. * _.filter(['abc', 'def'], /ef/);
  32553. * // => ['def']
  32554. */
  32555. function iteratee(func) {
  32556. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32557. }
  32558. /**
  32559. * Creates a function that performs a partial deep comparison between a given
  32560. * object and `source`, returning `true` if the given object has equivalent
  32561. * property values, else `false`.
  32562. *
  32563. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32564. * partially applied.
  32565. *
  32566. * Partial comparisons will match empty array and empty object `source`
  32567. * values against any array or object value, respectively. See `_.isEqual`
  32568. * for a list of supported value comparisons.
  32569. *
  32570. * @static
  32571. * @memberOf _
  32572. * @since 3.0.0
  32573. * @category Util
  32574. * @param {Object} source The object of property values to match.
  32575. * @returns {Function} Returns the new spec function.
  32576. * @example
  32577. *
  32578. * var objects = [
  32579. * { 'a': 1, 'b': 2, 'c': 3 },
  32580. * { 'a': 4, 'b': 5, 'c': 6 }
  32581. * ];
  32582. *
  32583. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32584. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32585. */
  32586. function matches(source) {
  32587. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32588. }
  32589. /**
  32590. * Creates a function that performs a partial deep comparison between the
  32591. * value at `path` of a given object to `srcValue`, returning `true` if the
  32592. * object value is equivalent, else `false`.
  32593. *
  32594. * **Note:** Partial comparisons will match empty array and empty object
  32595. * `srcValue` values against any array or object value, respectively. See
  32596. * `_.isEqual` for a list of supported value comparisons.
  32597. *
  32598. * @static
  32599. * @memberOf _
  32600. * @since 3.2.0
  32601. * @category Util
  32602. * @param {Array|string} path The path of the property to get.
  32603. * @param {*} srcValue The value to match.
  32604. * @returns {Function} Returns the new spec function.
  32605. * @example
  32606. *
  32607. * var objects = [
  32608. * { 'a': 1, 'b': 2, 'c': 3 },
  32609. * { 'a': 4, 'b': 5, 'c': 6 }
  32610. * ];
  32611. *
  32612. * _.find(objects, _.matchesProperty('a', 4));
  32613. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32614. */
  32615. function matchesProperty(path, srcValue) {
  32616. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32617. }
  32618. /**
  32619. * Creates a function that invokes the method at `path` of a given object.
  32620. * Any additional arguments are provided to the invoked method.
  32621. *
  32622. * @static
  32623. * @memberOf _
  32624. * @since 3.7.0
  32625. * @category Util
  32626. * @param {Array|string} path The path of the method to invoke.
  32627. * @param {...*} [args] The arguments to invoke the method with.
  32628. * @returns {Function} Returns the new invoker function.
  32629. * @example
  32630. *
  32631. * var objects = [
  32632. * { 'a': { 'b': _.constant(2) } },
  32633. * { 'a': { 'b': _.constant(1) } }
  32634. * ];
  32635. *
  32636. * _.map(objects, _.method('a.b'));
  32637. * // => [2, 1]
  32638. *
  32639. * _.map(objects, _.method(['a', 'b']));
  32640. * // => [2, 1]
  32641. */
  32642. var method = baseRest(function(path, args) {
  32643. return function(object) {
  32644. return baseInvoke(object, path, args);
  32645. };
  32646. });
  32647. /**
  32648. * The opposite of `_.method`; this method creates a function that invokes
  32649. * the method at a given path of `object`. Any additional arguments are
  32650. * provided to the invoked method.
  32651. *
  32652. * @static
  32653. * @memberOf _
  32654. * @since 3.7.0
  32655. * @category Util
  32656. * @param {Object} object The object to query.
  32657. * @param {...*} [args] The arguments to invoke the method with.
  32658. * @returns {Function} Returns the new invoker function.
  32659. * @example
  32660. *
  32661. * var array = _.times(3, _.constant),
  32662. * object = { 'a': array, 'b': array, 'c': array };
  32663. *
  32664. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32665. * // => [2, 0]
  32666. *
  32667. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32668. * // => [2, 0]
  32669. */
  32670. var methodOf = baseRest(function(object, args) {
  32671. return function(path) {
  32672. return baseInvoke(object, path, args);
  32673. };
  32674. });
  32675. /**
  32676. * Adds all own enumerable string keyed function properties of a source
  32677. * object to the destination object. If `object` is a function, then methods
  32678. * are added to its prototype as well.
  32679. *
  32680. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32681. * avoid conflicts caused by modifying the original.
  32682. *
  32683. * @static
  32684. * @since 0.1.0
  32685. * @memberOf _
  32686. * @category Util
  32687. * @param {Function|Object} [object=lodash] The destination object.
  32688. * @param {Object} source The object of functions to add.
  32689. * @param {Object} [options={}] The options object.
  32690. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32691. * @returns {Function|Object} Returns `object`.
  32692. * @example
  32693. *
  32694. * function vowels(string) {
  32695. * return _.filter(string, function(v) {
  32696. * return /[aeiou]/i.test(v);
  32697. * });
  32698. * }
  32699. *
  32700. * _.mixin({ 'vowels': vowels });
  32701. * _.vowels('fred');
  32702. * // => ['e']
  32703. *
  32704. * _('fred').vowels().value();
  32705. * // => ['e']
  32706. *
  32707. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32708. * _('fred').vowels();
  32709. * // => ['e']
  32710. */
  32711. function mixin(object, source, options) {
  32712. var props = keys(source),
  32713. methodNames = baseFunctions(source, props);
  32714. if (options == null &&
  32715. !(isObject(source) && (methodNames.length || !props.length))) {
  32716. options = source;
  32717. source = object;
  32718. object = this;
  32719. methodNames = baseFunctions(source, keys(source));
  32720. }
  32721. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  32722. isFunc = isFunction(object);
  32723. arrayEach(methodNames, function(methodName) {
  32724. var func = source[methodName];
  32725. object[methodName] = func;
  32726. if (isFunc) {
  32727. object.prototype[methodName] = function() {
  32728. var chainAll = this.__chain__;
  32729. if (chain || chainAll) {
  32730. var result = object(this.__wrapped__),
  32731. actions = result.__actions__ = copyArray(this.__actions__);
  32732. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  32733. result.__chain__ = chainAll;
  32734. return result;
  32735. }
  32736. return func.apply(object, arrayPush([this.value()], arguments));
  32737. };
  32738. }
  32739. });
  32740. return object;
  32741. }
  32742. /**
  32743. * Reverts the `_` variable to its previous value and returns a reference to
  32744. * the `lodash` function.
  32745. *
  32746. * @static
  32747. * @since 0.1.0
  32748. * @memberOf _
  32749. * @category Util
  32750. * @returns {Function} Returns the `lodash` function.
  32751. * @example
  32752. *
  32753. * var lodash = _.noConflict();
  32754. */
  32755. function noConflict() {
  32756. if (root._ === this) {
  32757. root._ = oldDash;
  32758. }
  32759. return this;
  32760. }
  32761. /**
  32762. * This method returns `undefined`.
  32763. *
  32764. * @static
  32765. * @memberOf _
  32766. * @since 2.3.0
  32767. * @category Util
  32768. * @example
  32769. *
  32770. * _.times(2, _.noop);
  32771. * // => [undefined, undefined]
  32772. */
  32773. function noop() {
  32774. // No operation performed.
  32775. }
  32776. /**
  32777. * Creates a function that gets the argument at index `n`. If `n` is negative,
  32778. * the nth argument from the end is returned.
  32779. *
  32780. * @static
  32781. * @memberOf _
  32782. * @since 4.0.0
  32783. * @category Util
  32784. * @param {number} [n=0] The index of the argument to return.
  32785. * @returns {Function} Returns the new pass-thru function.
  32786. * @example
  32787. *
  32788. * var func = _.nthArg(1);
  32789. * func('a', 'b', 'c', 'd');
  32790. * // => 'b'
  32791. *
  32792. * var func = _.nthArg(-2);
  32793. * func('a', 'b', 'c', 'd');
  32794. * // => 'c'
  32795. */
  32796. function nthArg(n) {
  32797. n = toInteger(n);
  32798. return baseRest(function(args) {
  32799. return baseNth(args, n);
  32800. });
  32801. }
  32802. /**
  32803. * Creates a function that invokes `iteratees` with the arguments it receives
  32804. * and returns their results.
  32805. *
  32806. * @static
  32807. * @memberOf _
  32808. * @since 4.0.0
  32809. * @category Util
  32810. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  32811. * The iteratees to invoke.
  32812. * @returns {Function} Returns the new function.
  32813. * @example
  32814. *
  32815. * var func = _.over([Math.max, Math.min]);
  32816. *
  32817. * func(1, 2, 3, 4);
  32818. * // => [4, 1]
  32819. */
  32820. var over = createOver(arrayMap);
  32821. /**
  32822. * Creates a function that checks if **all** of the `predicates` return
  32823. * truthy when invoked with the arguments it receives.
  32824. *
  32825. * @static
  32826. * @memberOf _
  32827. * @since 4.0.0
  32828. * @category Util
  32829. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32830. * The predicates to check.
  32831. * @returns {Function} Returns the new function.
  32832. * @example
  32833. *
  32834. * var func = _.overEvery([Boolean, isFinite]);
  32835. *
  32836. * func('1');
  32837. * // => true
  32838. *
  32839. * func(null);
  32840. * // => false
  32841. *
  32842. * func(NaN);
  32843. * // => false
  32844. */
  32845. var overEvery = createOver(arrayEvery);
  32846. /**
  32847. * Creates a function that checks if **any** of the `predicates` return
  32848. * truthy when invoked with the arguments it receives.
  32849. *
  32850. * @static
  32851. * @memberOf _
  32852. * @since 4.0.0
  32853. * @category Util
  32854. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32855. * The predicates to check.
  32856. * @returns {Function} Returns the new function.
  32857. * @example
  32858. *
  32859. * var func = _.overSome([Boolean, isFinite]);
  32860. *
  32861. * func('1');
  32862. * // => true
  32863. *
  32864. * func(null);
  32865. * // => true
  32866. *
  32867. * func(NaN);
  32868. * // => false
  32869. */
  32870. var overSome = createOver(arraySome);
  32871. /**
  32872. * Creates a function that returns the value at `path` of a given object.
  32873. *
  32874. * @static
  32875. * @memberOf _
  32876. * @since 2.4.0
  32877. * @category Util
  32878. * @param {Array|string} path The path of the property to get.
  32879. * @returns {Function} Returns the new accessor function.
  32880. * @example
  32881. *
  32882. * var objects = [
  32883. * { 'a': { 'b': 2 } },
  32884. * { 'a': { 'b': 1 } }
  32885. * ];
  32886. *
  32887. * _.map(objects, _.property('a.b'));
  32888. * // => [2, 1]
  32889. *
  32890. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  32891. * // => [1, 2]
  32892. */
  32893. function property(path) {
  32894. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  32895. }
  32896. /**
  32897. * The opposite of `_.property`; this method creates a function that returns
  32898. * the value at a given path of `object`.
  32899. *
  32900. * @static
  32901. * @memberOf _
  32902. * @since 3.0.0
  32903. * @category Util
  32904. * @param {Object} object The object to query.
  32905. * @returns {Function} Returns the new accessor function.
  32906. * @example
  32907. *
  32908. * var array = [0, 1, 2],
  32909. * object = { 'a': array, 'b': array, 'c': array };
  32910. *
  32911. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  32912. * // => [2, 0]
  32913. *
  32914. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  32915. * // => [2, 0]
  32916. */
  32917. function propertyOf(object) {
  32918. return function(path) {
  32919. return object == null ? undefined : baseGet(object, path);
  32920. };
  32921. }
  32922. /**
  32923. * Creates an array of numbers (positive and/or negative) progressing from
  32924. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  32925. * `start` is specified without an `end` or `step`. If `end` is not specified,
  32926. * it's set to `start` with `start` then set to `0`.
  32927. *
  32928. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32929. * floating-point values which can produce unexpected results.
  32930. *
  32931. * @static
  32932. * @since 0.1.0
  32933. * @memberOf _
  32934. * @category Util
  32935. * @param {number} [start=0] The start of the range.
  32936. * @param {number} end The end of the range.
  32937. * @param {number} [step=1] The value to increment or decrement by.
  32938. * @returns {Array} Returns the range of numbers.
  32939. * @see _.inRange, _.rangeRight
  32940. * @example
  32941. *
  32942. * _.range(4);
  32943. * // => [0, 1, 2, 3]
  32944. *
  32945. * _.range(-4);
  32946. * // => [0, -1, -2, -3]
  32947. *
  32948. * _.range(1, 5);
  32949. * // => [1, 2, 3, 4]
  32950. *
  32951. * _.range(0, 20, 5);
  32952. * // => [0, 5, 10, 15]
  32953. *
  32954. * _.range(0, -4, -1);
  32955. * // => [0, -1, -2, -3]
  32956. *
  32957. * _.range(1, 4, 0);
  32958. * // => [1, 1, 1]
  32959. *
  32960. * _.range(0);
  32961. * // => []
  32962. */
  32963. var range = createRange();
  32964. /**
  32965. * This method is like `_.range` except that it populates values in
  32966. * descending order.
  32967. *
  32968. * @static
  32969. * @memberOf _
  32970. * @since 4.0.0
  32971. * @category Util
  32972. * @param {number} [start=0] The start of the range.
  32973. * @param {number} end The end of the range.
  32974. * @param {number} [step=1] The value to increment or decrement by.
  32975. * @returns {Array} Returns the range of numbers.
  32976. * @see _.inRange, _.range
  32977. * @example
  32978. *
  32979. * _.rangeRight(4);
  32980. * // => [3, 2, 1, 0]
  32981. *
  32982. * _.rangeRight(-4);
  32983. * // => [-3, -2, -1, 0]
  32984. *
  32985. * _.rangeRight(1, 5);
  32986. * // => [4, 3, 2, 1]
  32987. *
  32988. * _.rangeRight(0, 20, 5);
  32989. * // => [15, 10, 5, 0]
  32990. *
  32991. * _.rangeRight(0, -4, -1);
  32992. * // => [-3, -2, -1, 0]
  32993. *
  32994. * _.rangeRight(1, 4, 0);
  32995. * // => [1, 1, 1]
  32996. *
  32997. * _.rangeRight(0);
  32998. * // => []
  32999. */
  33000. var rangeRight = createRange(true);
  33001. /**
  33002. * This method returns a new empty array.
  33003. *
  33004. * @static
  33005. * @memberOf _
  33006. * @since 4.13.0
  33007. * @category Util
  33008. * @returns {Array} Returns the new empty array.
  33009. * @example
  33010. *
  33011. * var arrays = _.times(2, _.stubArray);
  33012. *
  33013. * console.log(arrays);
  33014. * // => [[], []]
  33015. *
  33016. * console.log(arrays[0] === arrays[1]);
  33017. * // => false
  33018. */
  33019. function stubArray() {
  33020. return [];
  33021. }
  33022. /**
  33023. * This method returns `false`.
  33024. *
  33025. * @static
  33026. * @memberOf _
  33027. * @since 4.13.0
  33028. * @category Util
  33029. * @returns {boolean} Returns `false`.
  33030. * @example
  33031. *
  33032. * _.times(2, _.stubFalse);
  33033. * // => [false, false]
  33034. */
  33035. function stubFalse() {
  33036. return false;
  33037. }
  33038. /**
  33039. * This method returns a new empty object.
  33040. *
  33041. * @static
  33042. * @memberOf _
  33043. * @since 4.13.0
  33044. * @category Util
  33045. * @returns {Object} Returns the new empty object.
  33046. * @example
  33047. *
  33048. * var objects = _.times(2, _.stubObject);
  33049. *
  33050. * console.log(objects);
  33051. * // => [{}, {}]
  33052. *
  33053. * console.log(objects[0] === objects[1]);
  33054. * // => false
  33055. */
  33056. function stubObject() {
  33057. return {};
  33058. }
  33059. /**
  33060. * This method returns an empty string.
  33061. *
  33062. * @static
  33063. * @memberOf _
  33064. * @since 4.13.0
  33065. * @category Util
  33066. * @returns {string} Returns the empty string.
  33067. * @example
  33068. *
  33069. * _.times(2, _.stubString);
  33070. * // => ['', '']
  33071. */
  33072. function stubString() {
  33073. return '';
  33074. }
  33075. /**
  33076. * This method returns `true`.
  33077. *
  33078. * @static
  33079. * @memberOf _
  33080. * @since 4.13.0
  33081. * @category Util
  33082. * @returns {boolean} Returns `true`.
  33083. * @example
  33084. *
  33085. * _.times(2, _.stubTrue);
  33086. * // => [true, true]
  33087. */
  33088. function stubTrue() {
  33089. return true;
  33090. }
  33091. /**
  33092. * Invokes the iteratee `n` times, returning an array of the results of
  33093. * each invocation. The iteratee is invoked with one argument; (index).
  33094. *
  33095. * @static
  33096. * @since 0.1.0
  33097. * @memberOf _
  33098. * @category Util
  33099. * @param {number} n The number of times to invoke `iteratee`.
  33100. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33101. * @returns {Array} Returns the array of results.
  33102. * @example
  33103. *
  33104. * _.times(3, String);
  33105. * // => ['0', '1', '2']
  33106. *
  33107. * _.times(4, _.constant(0));
  33108. * // => [0, 0, 0, 0]
  33109. */
  33110. function times(n, iteratee) {
  33111. n = toInteger(n);
  33112. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33113. return [];
  33114. }
  33115. var index = MAX_ARRAY_LENGTH,
  33116. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33117. iteratee = getIteratee(iteratee);
  33118. n -= MAX_ARRAY_LENGTH;
  33119. var result = baseTimes(length, iteratee);
  33120. while (++index < n) {
  33121. iteratee(index);
  33122. }
  33123. return result;
  33124. }
  33125. /**
  33126. * Converts `value` to a property path array.
  33127. *
  33128. * @static
  33129. * @memberOf _
  33130. * @since 4.0.0
  33131. * @category Util
  33132. * @param {*} value The value to convert.
  33133. * @returns {Array} Returns the new property path array.
  33134. * @example
  33135. *
  33136. * _.toPath('a.b.c');
  33137. * // => ['a', 'b', 'c']
  33138. *
  33139. * _.toPath('a[0].b.c');
  33140. * // => ['a', '0', 'b', 'c']
  33141. */
  33142. function toPath(value) {
  33143. if (isArray(value)) {
  33144. return arrayMap(value, toKey);
  33145. }
  33146. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33147. }
  33148. /**
  33149. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33150. *
  33151. * @static
  33152. * @since 0.1.0
  33153. * @memberOf _
  33154. * @category Util
  33155. * @param {string} [prefix=''] The value to prefix the ID with.
  33156. * @returns {string} Returns the unique ID.
  33157. * @example
  33158. *
  33159. * _.uniqueId('contact_');
  33160. * // => 'contact_104'
  33161. *
  33162. * _.uniqueId();
  33163. * // => '105'
  33164. */
  33165. function uniqueId(prefix) {
  33166. var id = ++idCounter;
  33167. return toString(prefix) + id;
  33168. }
  33169. /*------------------------------------------------------------------------*/
  33170. /**
  33171. * Adds two numbers.
  33172. *
  33173. * @static
  33174. * @memberOf _
  33175. * @since 3.4.0
  33176. * @category Math
  33177. * @param {number} augend The first number in an addition.
  33178. * @param {number} addend The second number in an addition.
  33179. * @returns {number} Returns the total.
  33180. * @example
  33181. *
  33182. * _.add(6, 4);
  33183. * // => 10
  33184. */
  33185. var add = createMathOperation(function(augend, addend) {
  33186. return augend + addend;
  33187. }, 0);
  33188. /**
  33189. * Computes `number` rounded up to `precision`.
  33190. *
  33191. * @static
  33192. * @memberOf _
  33193. * @since 3.10.0
  33194. * @category Math
  33195. * @param {number} number The number to round up.
  33196. * @param {number} [precision=0] The precision to round up to.
  33197. * @returns {number} Returns the rounded up number.
  33198. * @example
  33199. *
  33200. * _.ceil(4.006);
  33201. * // => 5
  33202. *
  33203. * _.ceil(6.004, 2);
  33204. * // => 6.01
  33205. *
  33206. * _.ceil(6040, -2);
  33207. * // => 6100
  33208. */
  33209. var ceil = createRound('ceil');
  33210. /**
  33211. * Divide two numbers.
  33212. *
  33213. * @static
  33214. * @memberOf _
  33215. * @since 4.7.0
  33216. * @category Math
  33217. * @param {number} dividend The first number in a division.
  33218. * @param {number} divisor The second number in a division.
  33219. * @returns {number} Returns the quotient.
  33220. * @example
  33221. *
  33222. * _.divide(6, 4);
  33223. * // => 1.5
  33224. */
  33225. var divide = createMathOperation(function(dividend, divisor) {
  33226. return dividend / divisor;
  33227. }, 1);
  33228. /**
  33229. * Computes `number` rounded down to `precision`.
  33230. *
  33231. * @static
  33232. * @memberOf _
  33233. * @since 3.10.0
  33234. * @category Math
  33235. * @param {number} number The number to round down.
  33236. * @param {number} [precision=0] The precision to round down to.
  33237. * @returns {number} Returns the rounded down number.
  33238. * @example
  33239. *
  33240. * _.floor(4.006);
  33241. * // => 4
  33242. *
  33243. * _.floor(0.046, 2);
  33244. * // => 0.04
  33245. *
  33246. * _.floor(4060, -2);
  33247. * // => 4000
  33248. */
  33249. var floor = createRound('floor');
  33250. /**
  33251. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33252. * `undefined` is returned.
  33253. *
  33254. * @static
  33255. * @since 0.1.0
  33256. * @memberOf _
  33257. * @category Math
  33258. * @param {Array} array The array to iterate over.
  33259. * @returns {*} Returns the maximum value.
  33260. * @example
  33261. *
  33262. * _.max([4, 2, 8, 6]);
  33263. * // => 8
  33264. *
  33265. * _.max([]);
  33266. * // => undefined
  33267. */
  33268. function max(array) {
  33269. return (array && array.length)
  33270. ? baseExtremum(array, identity, baseGt)
  33271. : undefined;
  33272. }
  33273. /**
  33274. * This method is like `_.max` except that it accepts `iteratee` which is
  33275. * invoked for each element in `array` to generate the criterion by which
  33276. * the value is ranked. The iteratee is invoked with one argument: (value).
  33277. *
  33278. * @static
  33279. * @memberOf _
  33280. * @since 4.0.0
  33281. * @category Math
  33282. * @param {Array} array The array to iterate over.
  33283. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33284. * @returns {*} Returns the maximum value.
  33285. * @example
  33286. *
  33287. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33288. *
  33289. * _.maxBy(objects, function(o) { return o.n; });
  33290. * // => { 'n': 2 }
  33291. *
  33292. * // The `_.property` iteratee shorthand.
  33293. * _.maxBy(objects, 'n');
  33294. * // => { 'n': 2 }
  33295. */
  33296. function maxBy(array, iteratee) {
  33297. return (array && array.length)
  33298. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33299. : undefined;
  33300. }
  33301. /**
  33302. * Computes the mean of the values in `array`.
  33303. *
  33304. * @static
  33305. * @memberOf _
  33306. * @since 4.0.0
  33307. * @category Math
  33308. * @param {Array} array The array to iterate over.
  33309. * @returns {number} Returns the mean.
  33310. * @example
  33311. *
  33312. * _.mean([4, 2, 8, 6]);
  33313. * // => 5
  33314. */
  33315. function mean(array) {
  33316. return baseMean(array, identity);
  33317. }
  33318. /**
  33319. * This method is like `_.mean` except that it accepts `iteratee` which is
  33320. * invoked for each element in `array` to generate the value to be averaged.
  33321. * The iteratee is invoked with one argument: (value).
  33322. *
  33323. * @static
  33324. * @memberOf _
  33325. * @since 4.7.0
  33326. * @category Math
  33327. * @param {Array} array The array to iterate over.
  33328. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33329. * @returns {number} Returns the mean.
  33330. * @example
  33331. *
  33332. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33333. *
  33334. * _.meanBy(objects, function(o) { return o.n; });
  33335. * // => 5
  33336. *
  33337. * // The `_.property` iteratee shorthand.
  33338. * _.meanBy(objects, 'n');
  33339. * // => 5
  33340. */
  33341. function meanBy(array, iteratee) {
  33342. return baseMean(array, getIteratee(iteratee, 2));
  33343. }
  33344. /**
  33345. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33346. * `undefined` is returned.
  33347. *
  33348. * @static
  33349. * @since 0.1.0
  33350. * @memberOf _
  33351. * @category Math
  33352. * @param {Array} array The array to iterate over.
  33353. * @returns {*} Returns the minimum value.
  33354. * @example
  33355. *
  33356. * _.min([4, 2, 8, 6]);
  33357. * // => 2
  33358. *
  33359. * _.min([]);
  33360. * // => undefined
  33361. */
  33362. function min(array) {
  33363. return (array && array.length)
  33364. ? baseExtremum(array, identity, baseLt)
  33365. : undefined;
  33366. }
  33367. /**
  33368. * This method is like `_.min` except that it accepts `iteratee` which is
  33369. * invoked for each element in `array` to generate the criterion by which
  33370. * the value is ranked. The iteratee is invoked with one argument: (value).
  33371. *
  33372. * @static
  33373. * @memberOf _
  33374. * @since 4.0.0
  33375. * @category Math
  33376. * @param {Array} array The array to iterate over.
  33377. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33378. * @returns {*} Returns the minimum value.
  33379. * @example
  33380. *
  33381. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33382. *
  33383. * _.minBy(objects, function(o) { return o.n; });
  33384. * // => { 'n': 1 }
  33385. *
  33386. * // The `_.property` iteratee shorthand.
  33387. * _.minBy(objects, 'n');
  33388. * // => { 'n': 1 }
  33389. */
  33390. function minBy(array, iteratee) {
  33391. return (array && array.length)
  33392. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33393. : undefined;
  33394. }
  33395. /**
  33396. * Multiply two numbers.
  33397. *
  33398. * @static
  33399. * @memberOf _
  33400. * @since 4.7.0
  33401. * @category Math
  33402. * @param {number} multiplier The first number in a multiplication.
  33403. * @param {number} multiplicand The second number in a multiplication.
  33404. * @returns {number} Returns the product.
  33405. * @example
  33406. *
  33407. * _.multiply(6, 4);
  33408. * // => 24
  33409. */
  33410. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33411. return multiplier * multiplicand;
  33412. }, 1);
  33413. /**
  33414. * Computes `number` rounded to `precision`.
  33415. *
  33416. * @static
  33417. * @memberOf _
  33418. * @since 3.10.0
  33419. * @category Math
  33420. * @param {number} number The number to round.
  33421. * @param {number} [precision=0] The precision to round to.
  33422. * @returns {number} Returns the rounded number.
  33423. * @example
  33424. *
  33425. * _.round(4.006);
  33426. * // => 4
  33427. *
  33428. * _.round(4.006, 2);
  33429. * // => 4.01
  33430. *
  33431. * _.round(4060, -2);
  33432. * // => 4100
  33433. */
  33434. var round = createRound('round');
  33435. /**
  33436. * Subtract two numbers.
  33437. *
  33438. * @static
  33439. * @memberOf _
  33440. * @since 4.0.0
  33441. * @category Math
  33442. * @param {number} minuend The first number in a subtraction.
  33443. * @param {number} subtrahend The second number in a subtraction.
  33444. * @returns {number} Returns the difference.
  33445. * @example
  33446. *
  33447. * _.subtract(6, 4);
  33448. * // => 2
  33449. */
  33450. var subtract = createMathOperation(function(minuend, subtrahend) {
  33451. return minuend - subtrahend;
  33452. }, 0);
  33453. /**
  33454. * Computes the sum of the values in `array`.
  33455. *
  33456. * @static
  33457. * @memberOf _
  33458. * @since 3.4.0
  33459. * @category Math
  33460. * @param {Array} array The array to iterate over.
  33461. * @returns {number} Returns the sum.
  33462. * @example
  33463. *
  33464. * _.sum([4, 2, 8, 6]);
  33465. * // => 20
  33466. */
  33467. function sum(array) {
  33468. return (array && array.length)
  33469. ? baseSum(array, identity)
  33470. : 0;
  33471. }
  33472. /**
  33473. * This method is like `_.sum` except that it accepts `iteratee` which is
  33474. * invoked for each element in `array` to generate the value to be summed.
  33475. * The iteratee is invoked with one argument: (value).
  33476. *
  33477. * @static
  33478. * @memberOf _
  33479. * @since 4.0.0
  33480. * @category Math
  33481. * @param {Array} array The array to iterate over.
  33482. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33483. * @returns {number} Returns the sum.
  33484. * @example
  33485. *
  33486. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33487. *
  33488. * _.sumBy(objects, function(o) { return o.n; });
  33489. * // => 20
  33490. *
  33491. * // The `_.property` iteratee shorthand.
  33492. * _.sumBy(objects, 'n');
  33493. * // => 20
  33494. */
  33495. function sumBy(array, iteratee) {
  33496. return (array && array.length)
  33497. ? baseSum(array, getIteratee(iteratee, 2))
  33498. : 0;
  33499. }
  33500. /*------------------------------------------------------------------------*/
  33501. // Add methods that return wrapped values in chain sequences.
  33502. lodash.after = after;
  33503. lodash.ary = ary;
  33504. lodash.assign = assign;
  33505. lodash.assignIn = assignIn;
  33506. lodash.assignInWith = assignInWith;
  33507. lodash.assignWith = assignWith;
  33508. lodash.at = at;
  33509. lodash.before = before;
  33510. lodash.bind = bind;
  33511. lodash.bindAll = bindAll;
  33512. lodash.bindKey = bindKey;
  33513. lodash.castArray = castArray;
  33514. lodash.chain = chain;
  33515. lodash.chunk = chunk;
  33516. lodash.compact = compact;
  33517. lodash.concat = concat;
  33518. lodash.cond = cond;
  33519. lodash.conforms = conforms;
  33520. lodash.constant = constant;
  33521. lodash.countBy = countBy;
  33522. lodash.create = create;
  33523. lodash.curry = curry;
  33524. lodash.curryRight = curryRight;
  33525. lodash.debounce = debounce;
  33526. lodash.defaults = defaults;
  33527. lodash.defaultsDeep = defaultsDeep;
  33528. lodash.defer = defer;
  33529. lodash.delay = delay;
  33530. lodash.difference = difference;
  33531. lodash.differenceBy = differenceBy;
  33532. lodash.differenceWith = differenceWith;
  33533. lodash.drop = drop;
  33534. lodash.dropRight = dropRight;
  33535. lodash.dropRightWhile = dropRightWhile;
  33536. lodash.dropWhile = dropWhile;
  33537. lodash.fill = fill;
  33538. lodash.filter = filter;
  33539. lodash.flatMap = flatMap;
  33540. lodash.flatMapDeep = flatMapDeep;
  33541. lodash.flatMapDepth = flatMapDepth;
  33542. lodash.flatten = flatten;
  33543. lodash.flattenDeep = flattenDeep;
  33544. lodash.flattenDepth = flattenDepth;
  33545. lodash.flip = flip;
  33546. lodash.flow = flow;
  33547. lodash.flowRight = flowRight;
  33548. lodash.fromPairs = fromPairs;
  33549. lodash.functions = functions;
  33550. lodash.functionsIn = functionsIn;
  33551. lodash.groupBy = groupBy;
  33552. lodash.initial = initial;
  33553. lodash.intersection = intersection;
  33554. lodash.intersectionBy = intersectionBy;
  33555. lodash.intersectionWith = intersectionWith;
  33556. lodash.invert = invert;
  33557. lodash.invertBy = invertBy;
  33558. lodash.invokeMap = invokeMap;
  33559. lodash.iteratee = iteratee;
  33560. lodash.keyBy = keyBy;
  33561. lodash.keys = keys;
  33562. lodash.keysIn = keysIn;
  33563. lodash.map = map;
  33564. lodash.mapKeys = mapKeys;
  33565. lodash.mapValues = mapValues;
  33566. lodash.matches = matches;
  33567. lodash.matchesProperty = matchesProperty;
  33568. lodash.memoize = memoize;
  33569. lodash.merge = merge;
  33570. lodash.mergeWith = mergeWith;
  33571. lodash.method = method;
  33572. lodash.methodOf = methodOf;
  33573. lodash.mixin = mixin;
  33574. lodash.negate = negate;
  33575. lodash.nthArg = nthArg;
  33576. lodash.omit = omit;
  33577. lodash.omitBy = omitBy;
  33578. lodash.once = once;
  33579. lodash.orderBy = orderBy;
  33580. lodash.over = over;
  33581. lodash.overArgs = overArgs;
  33582. lodash.overEvery = overEvery;
  33583. lodash.overSome = overSome;
  33584. lodash.partial = partial;
  33585. lodash.partialRight = partialRight;
  33586. lodash.partition = partition;
  33587. lodash.pick = pick;
  33588. lodash.pickBy = pickBy;
  33589. lodash.property = property;
  33590. lodash.propertyOf = propertyOf;
  33591. lodash.pull = pull;
  33592. lodash.pullAll = pullAll;
  33593. lodash.pullAllBy = pullAllBy;
  33594. lodash.pullAllWith = pullAllWith;
  33595. lodash.pullAt = pullAt;
  33596. lodash.range = range;
  33597. lodash.rangeRight = rangeRight;
  33598. lodash.rearg = rearg;
  33599. lodash.reject = reject;
  33600. lodash.remove = remove;
  33601. lodash.rest = rest;
  33602. lodash.reverse = reverse;
  33603. lodash.sampleSize = sampleSize;
  33604. lodash.set = set;
  33605. lodash.setWith = setWith;
  33606. lodash.shuffle = shuffle;
  33607. lodash.slice = slice;
  33608. lodash.sortBy = sortBy;
  33609. lodash.sortedUniq = sortedUniq;
  33610. lodash.sortedUniqBy = sortedUniqBy;
  33611. lodash.split = split;
  33612. lodash.spread = spread;
  33613. lodash.tail = tail;
  33614. lodash.take = take;
  33615. lodash.takeRight = takeRight;
  33616. lodash.takeRightWhile = takeRightWhile;
  33617. lodash.takeWhile = takeWhile;
  33618. lodash.tap = tap;
  33619. lodash.throttle = throttle;
  33620. lodash.thru = thru;
  33621. lodash.toArray = toArray;
  33622. lodash.toPairs = toPairs;
  33623. lodash.toPairsIn = toPairsIn;
  33624. lodash.toPath = toPath;
  33625. lodash.toPlainObject = toPlainObject;
  33626. lodash.transform = transform;
  33627. lodash.unary = unary;
  33628. lodash.union = union;
  33629. lodash.unionBy = unionBy;
  33630. lodash.unionWith = unionWith;
  33631. lodash.uniq = uniq;
  33632. lodash.uniqBy = uniqBy;
  33633. lodash.uniqWith = uniqWith;
  33634. lodash.unset = unset;
  33635. lodash.unzip = unzip;
  33636. lodash.unzipWith = unzipWith;
  33637. lodash.update = update;
  33638. lodash.updateWith = updateWith;
  33639. lodash.values = values;
  33640. lodash.valuesIn = valuesIn;
  33641. lodash.without = without;
  33642. lodash.words = words;
  33643. lodash.wrap = wrap;
  33644. lodash.xor = xor;
  33645. lodash.xorBy = xorBy;
  33646. lodash.xorWith = xorWith;
  33647. lodash.zip = zip;
  33648. lodash.zipObject = zipObject;
  33649. lodash.zipObjectDeep = zipObjectDeep;
  33650. lodash.zipWith = zipWith;
  33651. // Add aliases.
  33652. lodash.entries = toPairs;
  33653. lodash.entriesIn = toPairsIn;
  33654. lodash.extend = assignIn;
  33655. lodash.extendWith = assignInWith;
  33656. // Add methods to `lodash.prototype`.
  33657. mixin(lodash, lodash);
  33658. /*------------------------------------------------------------------------*/
  33659. // Add methods that return unwrapped values in chain sequences.
  33660. lodash.add = add;
  33661. lodash.attempt = attempt;
  33662. lodash.camelCase = camelCase;
  33663. lodash.capitalize = capitalize;
  33664. lodash.ceil = ceil;
  33665. lodash.clamp = clamp;
  33666. lodash.clone = clone;
  33667. lodash.cloneDeep = cloneDeep;
  33668. lodash.cloneDeepWith = cloneDeepWith;
  33669. lodash.cloneWith = cloneWith;
  33670. lodash.conformsTo = conformsTo;
  33671. lodash.deburr = deburr;
  33672. lodash.defaultTo = defaultTo;
  33673. lodash.divide = divide;
  33674. lodash.endsWith = endsWith;
  33675. lodash.eq = eq;
  33676. lodash.escape = escape;
  33677. lodash.escapeRegExp = escapeRegExp;
  33678. lodash.every = every;
  33679. lodash.find = find;
  33680. lodash.findIndex = findIndex;
  33681. lodash.findKey = findKey;
  33682. lodash.findLast = findLast;
  33683. lodash.findLastIndex = findLastIndex;
  33684. lodash.findLastKey = findLastKey;
  33685. lodash.floor = floor;
  33686. lodash.forEach = forEach;
  33687. lodash.forEachRight = forEachRight;
  33688. lodash.forIn = forIn;
  33689. lodash.forInRight = forInRight;
  33690. lodash.forOwn = forOwn;
  33691. lodash.forOwnRight = forOwnRight;
  33692. lodash.get = get;
  33693. lodash.gt = gt;
  33694. lodash.gte = gte;
  33695. lodash.has = has;
  33696. lodash.hasIn = hasIn;
  33697. lodash.head = head;
  33698. lodash.identity = identity;
  33699. lodash.includes = includes;
  33700. lodash.indexOf = indexOf;
  33701. lodash.inRange = inRange;
  33702. lodash.invoke = invoke;
  33703. lodash.isArguments = isArguments;
  33704. lodash.isArray = isArray;
  33705. lodash.isArrayBuffer = isArrayBuffer;
  33706. lodash.isArrayLike = isArrayLike;
  33707. lodash.isArrayLikeObject = isArrayLikeObject;
  33708. lodash.isBoolean = isBoolean;
  33709. lodash.isBuffer = isBuffer;
  33710. lodash.isDate = isDate;
  33711. lodash.isElement = isElement;
  33712. lodash.isEmpty = isEmpty;
  33713. lodash.isEqual = isEqual;
  33714. lodash.isEqualWith = isEqualWith;
  33715. lodash.isError = isError;
  33716. lodash.isFinite = isFinite;
  33717. lodash.isFunction = isFunction;
  33718. lodash.isInteger = isInteger;
  33719. lodash.isLength = isLength;
  33720. lodash.isMap = isMap;
  33721. lodash.isMatch = isMatch;
  33722. lodash.isMatchWith = isMatchWith;
  33723. lodash.isNaN = isNaN;
  33724. lodash.isNative = isNative;
  33725. lodash.isNil = isNil;
  33726. lodash.isNull = isNull;
  33727. lodash.isNumber = isNumber;
  33728. lodash.isObject = isObject;
  33729. lodash.isObjectLike = isObjectLike;
  33730. lodash.isPlainObject = isPlainObject;
  33731. lodash.isRegExp = isRegExp;
  33732. lodash.isSafeInteger = isSafeInteger;
  33733. lodash.isSet = isSet;
  33734. lodash.isString = isString;
  33735. lodash.isSymbol = isSymbol;
  33736. lodash.isTypedArray = isTypedArray;
  33737. lodash.isUndefined = isUndefined;
  33738. lodash.isWeakMap = isWeakMap;
  33739. lodash.isWeakSet = isWeakSet;
  33740. lodash.join = join;
  33741. lodash.kebabCase = kebabCase;
  33742. lodash.last = last;
  33743. lodash.lastIndexOf = lastIndexOf;
  33744. lodash.lowerCase = lowerCase;
  33745. lodash.lowerFirst = lowerFirst;
  33746. lodash.lt = lt;
  33747. lodash.lte = lte;
  33748. lodash.max = max;
  33749. lodash.maxBy = maxBy;
  33750. lodash.mean = mean;
  33751. lodash.meanBy = meanBy;
  33752. lodash.min = min;
  33753. lodash.minBy = minBy;
  33754. lodash.stubArray = stubArray;
  33755. lodash.stubFalse = stubFalse;
  33756. lodash.stubObject = stubObject;
  33757. lodash.stubString = stubString;
  33758. lodash.stubTrue = stubTrue;
  33759. lodash.multiply = multiply;
  33760. lodash.nth = nth;
  33761. lodash.noConflict = noConflict;
  33762. lodash.noop = noop;
  33763. lodash.now = now;
  33764. lodash.pad = pad;
  33765. lodash.padEnd = padEnd;
  33766. lodash.padStart = padStart;
  33767. lodash.parseInt = parseInt;
  33768. lodash.random = random;
  33769. lodash.reduce = reduce;
  33770. lodash.reduceRight = reduceRight;
  33771. lodash.repeat = repeat;
  33772. lodash.replace = replace;
  33773. lodash.result = result;
  33774. lodash.round = round;
  33775. lodash.runInContext = runInContext;
  33776. lodash.sample = sample;
  33777. lodash.size = size;
  33778. lodash.snakeCase = snakeCase;
  33779. lodash.some = some;
  33780. lodash.sortedIndex = sortedIndex;
  33781. lodash.sortedIndexBy = sortedIndexBy;
  33782. lodash.sortedIndexOf = sortedIndexOf;
  33783. lodash.sortedLastIndex = sortedLastIndex;
  33784. lodash.sortedLastIndexBy = sortedLastIndexBy;
  33785. lodash.sortedLastIndexOf = sortedLastIndexOf;
  33786. lodash.startCase = startCase;
  33787. lodash.startsWith = startsWith;
  33788. lodash.subtract = subtract;
  33789. lodash.sum = sum;
  33790. lodash.sumBy = sumBy;
  33791. lodash.template = template;
  33792. lodash.times = times;
  33793. lodash.toFinite = toFinite;
  33794. lodash.toInteger = toInteger;
  33795. lodash.toLength = toLength;
  33796. lodash.toLower = toLower;
  33797. lodash.toNumber = toNumber;
  33798. lodash.toSafeInteger = toSafeInteger;
  33799. lodash.toString = toString;
  33800. lodash.toUpper = toUpper;
  33801. lodash.trim = trim;
  33802. lodash.trimEnd = trimEnd;
  33803. lodash.trimStart = trimStart;
  33804. lodash.truncate = truncate;
  33805. lodash.unescape = unescape;
  33806. lodash.uniqueId = uniqueId;
  33807. lodash.upperCase = upperCase;
  33808. lodash.upperFirst = upperFirst;
  33809. // Add aliases.
  33810. lodash.each = forEach;
  33811. lodash.eachRight = forEachRight;
  33812. lodash.first = head;
  33813. mixin(lodash, (function() {
  33814. var source = {};
  33815. baseForOwn(lodash, function(func, methodName) {
  33816. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  33817. source[methodName] = func;
  33818. }
  33819. });
  33820. return source;
  33821. }()), { 'chain': false });
  33822. /*------------------------------------------------------------------------*/
  33823. /**
  33824. * The semantic version number.
  33825. *
  33826. * @static
  33827. * @memberOf _
  33828. * @type {string}
  33829. */
  33830. lodash.VERSION = VERSION;
  33831. // Assign default placeholders.
  33832. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  33833. lodash[methodName].placeholder = lodash;
  33834. });
  33835. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  33836. arrayEach(['drop', 'take'], function(methodName, index) {
  33837. LazyWrapper.prototype[methodName] = function(n) {
  33838. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  33839. var result = (this.__filtered__ && !index)
  33840. ? new LazyWrapper(this)
  33841. : this.clone();
  33842. if (result.__filtered__) {
  33843. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  33844. } else {
  33845. result.__views__.push({
  33846. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  33847. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  33848. });
  33849. }
  33850. return result;
  33851. };
  33852. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  33853. return this.reverse()[methodName](n).reverse();
  33854. };
  33855. });
  33856. // Add `LazyWrapper` methods that accept an `iteratee` value.
  33857. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  33858. var type = index + 1,
  33859. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  33860. LazyWrapper.prototype[methodName] = function(iteratee) {
  33861. var result = this.clone();
  33862. result.__iteratees__.push({
  33863. 'iteratee': getIteratee(iteratee, 3),
  33864. 'type': type
  33865. });
  33866. result.__filtered__ = result.__filtered__ || isFilter;
  33867. return result;
  33868. };
  33869. });
  33870. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  33871. arrayEach(['head', 'last'], function(methodName, index) {
  33872. var takeName = 'take' + (index ? 'Right' : '');
  33873. LazyWrapper.prototype[methodName] = function() {
  33874. return this[takeName](1).value()[0];
  33875. };
  33876. });
  33877. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  33878. arrayEach(['initial', 'tail'], function(methodName, index) {
  33879. var dropName = 'drop' + (index ? '' : 'Right');
  33880. LazyWrapper.prototype[methodName] = function() {
  33881. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  33882. };
  33883. });
  33884. LazyWrapper.prototype.compact = function() {
  33885. return this.filter(identity);
  33886. };
  33887. LazyWrapper.prototype.find = function(predicate) {
  33888. return this.filter(predicate).head();
  33889. };
  33890. LazyWrapper.prototype.findLast = function(predicate) {
  33891. return this.reverse().find(predicate);
  33892. };
  33893. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  33894. if (typeof path == 'function') {
  33895. return new LazyWrapper(this);
  33896. }
  33897. return this.map(function(value) {
  33898. return baseInvoke(value, path, args);
  33899. });
  33900. });
  33901. LazyWrapper.prototype.reject = function(predicate) {
  33902. return this.filter(negate(getIteratee(predicate)));
  33903. };
  33904. LazyWrapper.prototype.slice = function(start, end) {
  33905. start = toInteger(start);
  33906. var result = this;
  33907. if (result.__filtered__ && (start > 0 || end < 0)) {
  33908. return new LazyWrapper(result);
  33909. }
  33910. if (start < 0) {
  33911. result = result.takeRight(-start);
  33912. } else if (start) {
  33913. result = result.drop(start);
  33914. }
  33915. if (end !== undefined) {
  33916. end = toInteger(end);
  33917. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  33918. }
  33919. return result;
  33920. };
  33921. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  33922. return this.reverse().takeWhile(predicate).reverse();
  33923. };
  33924. LazyWrapper.prototype.toArray = function() {
  33925. return this.take(MAX_ARRAY_LENGTH);
  33926. };
  33927. // Add `LazyWrapper` methods to `lodash.prototype`.
  33928. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33929. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  33930. isTaker = /^(?:head|last)$/.test(methodName),
  33931. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  33932. retUnwrapped = isTaker || /^find/.test(methodName);
  33933. if (!lodashFunc) {
  33934. return;
  33935. }
  33936. lodash.prototype[methodName] = function() {
  33937. var value = this.__wrapped__,
  33938. args = isTaker ? [1] : arguments,
  33939. isLazy = value instanceof LazyWrapper,
  33940. iteratee = args[0],
  33941. useLazy = isLazy || isArray(value);
  33942. var interceptor = function(value) {
  33943. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  33944. return (isTaker && chainAll) ? result[0] : result;
  33945. };
  33946. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  33947. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  33948. isLazy = useLazy = false;
  33949. }
  33950. var chainAll = this.__chain__,
  33951. isHybrid = !!this.__actions__.length,
  33952. isUnwrapped = retUnwrapped && !chainAll,
  33953. onlyLazy = isLazy && !isHybrid;
  33954. if (!retUnwrapped && useLazy) {
  33955. value = onlyLazy ? value : new LazyWrapper(this);
  33956. var result = func.apply(value, args);
  33957. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  33958. return new LodashWrapper(result, chainAll);
  33959. }
  33960. if (isUnwrapped && onlyLazy) {
  33961. return func.apply(this, args);
  33962. }
  33963. result = this.thru(interceptor);
  33964. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  33965. };
  33966. });
  33967. // Add `Array` methods to `lodash.prototype`.
  33968. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  33969. var func = arrayProto[methodName],
  33970. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  33971. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  33972. lodash.prototype[methodName] = function() {
  33973. var args = arguments;
  33974. if (retUnwrapped && !this.__chain__) {
  33975. var value = this.value();
  33976. return func.apply(isArray(value) ? value : [], args);
  33977. }
  33978. return this[chainName](function(value) {
  33979. return func.apply(isArray(value) ? value : [], args);
  33980. });
  33981. };
  33982. });
  33983. // Map minified method names to their real names.
  33984. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33985. var lodashFunc = lodash[methodName];
  33986. if (lodashFunc) {
  33987. var key = lodashFunc.name + '';
  33988. if (!hasOwnProperty.call(realNames, key)) {
  33989. realNames[key] = [];
  33990. }
  33991. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  33992. }
  33993. });
  33994. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  33995. 'name': 'wrapper',
  33996. 'func': undefined
  33997. }];
  33998. // Add methods to `LazyWrapper`.
  33999. LazyWrapper.prototype.clone = lazyClone;
  34000. LazyWrapper.prototype.reverse = lazyReverse;
  34001. LazyWrapper.prototype.value = lazyValue;
  34002. // Add chain sequence methods to the `lodash` wrapper.
  34003. lodash.prototype.at = wrapperAt;
  34004. lodash.prototype.chain = wrapperChain;
  34005. lodash.prototype.commit = wrapperCommit;
  34006. lodash.prototype.next = wrapperNext;
  34007. lodash.prototype.plant = wrapperPlant;
  34008. lodash.prototype.reverse = wrapperReverse;
  34009. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34010. // Add lazy aliases.
  34011. lodash.prototype.first = lodash.prototype.head;
  34012. if (symIterator) {
  34013. lodash.prototype[symIterator] = wrapperToIterator;
  34014. }
  34015. return lodash;
  34016. });
  34017. /*--------------------------------------------------------------------------*/
  34018. // Export lodash.
  34019. var _ = runInContext();
  34020. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34021. if (true) {
  34022. // Expose Lodash on the global object to prevent errors when Lodash is
  34023. // loaded by a script tag in the presence of an AMD loader.
  34024. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34025. // Use `_.noConflict` to remove Lodash from the global object.
  34026. root._ = _;
  34027. // Define as an anonymous module so, through path mapping, it can be
  34028. // referenced as the "underscore" module.
  34029. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34030. return _;
  34031. }).call(exports, __webpack_require__, exports, module),
  34032. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34033. }
  34034. // Check for `exports` after `define` in case a build optimizer adds it.
  34035. else {}
  34036. }.call(this));
  34037. /* 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)))
  34038. /***/ }),
  34039. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34040. /*!***************************************************!*\
  34041. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34042. \***************************************************/
  34043. /*! exports provided: default */
  34044. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34045. "use strict";
  34046. __webpack_require__.r(__webpack_exports__);
  34047. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34048. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34049. * @version 1.16.1
  34050. * @license
  34051. * Copyright (c) 2016 Federico Zivolo and contributors
  34052. *
  34053. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34054. * of this software and associated documentation files (the "Software"), to deal
  34055. * in the Software without restriction, including without limitation the rights
  34056. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34057. * copies of the Software, and to permit persons to whom the Software is
  34058. * furnished to do so, subject to the following conditions:
  34059. *
  34060. * The above copyright notice and this permission notice shall be included in all
  34061. * copies or substantial portions of the Software.
  34062. *
  34063. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34064. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34065. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34066. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34067. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34068. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34069. * SOFTWARE.
  34070. */
  34071. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34072. var timeoutDuration = function () {
  34073. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34074. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34075. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34076. return 1;
  34077. }
  34078. }
  34079. return 0;
  34080. }();
  34081. function microtaskDebounce(fn) {
  34082. var called = false;
  34083. return function () {
  34084. if (called) {
  34085. return;
  34086. }
  34087. called = true;
  34088. window.Promise.resolve().then(function () {
  34089. called = false;
  34090. fn();
  34091. });
  34092. };
  34093. }
  34094. function taskDebounce(fn) {
  34095. var scheduled = false;
  34096. return function () {
  34097. if (!scheduled) {
  34098. scheduled = true;
  34099. setTimeout(function () {
  34100. scheduled = false;
  34101. fn();
  34102. }, timeoutDuration);
  34103. }
  34104. };
  34105. }
  34106. var supportsMicroTasks = isBrowser && window.Promise;
  34107. /**
  34108. * Create a debounced version of a method, that's asynchronously deferred
  34109. * but called in the minimum time possible.
  34110. *
  34111. * @method
  34112. * @memberof Popper.Utils
  34113. * @argument {Function} fn
  34114. * @returns {Function}
  34115. */
  34116. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34117. /**
  34118. * Check if the given variable is a function
  34119. * @method
  34120. * @memberof Popper.Utils
  34121. * @argument {Any} functionToCheck - variable to check
  34122. * @returns {Boolean} answer to: is a function?
  34123. */
  34124. function isFunction(functionToCheck) {
  34125. var getType = {};
  34126. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34127. }
  34128. /**
  34129. * Get CSS computed property of the given element
  34130. * @method
  34131. * @memberof Popper.Utils
  34132. * @argument {Eement} element
  34133. * @argument {String} property
  34134. */
  34135. function getStyleComputedProperty(element, property) {
  34136. if (element.nodeType !== 1) {
  34137. return [];
  34138. }
  34139. // NOTE: 1 DOM access here
  34140. var window = element.ownerDocument.defaultView;
  34141. var css = window.getComputedStyle(element, null);
  34142. return property ? css[property] : css;
  34143. }
  34144. /**
  34145. * Returns the parentNode or the host of the element
  34146. * @method
  34147. * @memberof Popper.Utils
  34148. * @argument {Element} element
  34149. * @returns {Element} parent
  34150. */
  34151. function getParentNode(element) {
  34152. if (element.nodeName === 'HTML') {
  34153. return element;
  34154. }
  34155. return element.parentNode || element.host;
  34156. }
  34157. /**
  34158. * Returns the scrolling parent of the given element
  34159. * @method
  34160. * @memberof Popper.Utils
  34161. * @argument {Element} element
  34162. * @returns {Element} scroll parent
  34163. */
  34164. function getScrollParent(element) {
  34165. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34166. if (!element) {
  34167. return document.body;
  34168. }
  34169. switch (element.nodeName) {
  34170. case 'HTML':
  34171. case 'BODY':
  34172. return element.ownerDocument.body;
  34173. case '#document':
  34174. return element.body;
  34175. }
  34176. // Firefox want us to check `-x` and `-y` variations as well
  34177. var _getStyleComputedProp = getStyleComputedProperty(element),
  34178. overflow = _getStyleComputedProp.overflow,
  34179. overflowX = _getStyleComputedProp.overflowX,
  34180. overflowY = _getStyleComputedProp.overflowY;
  34181. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34182. return element;
  34183. }
  34184. return getScrollParent(getParentNode(element));
  34185. }
  34186. /**
  34187. * Returns the reference node of the reference object, or the reference object itself.
  34188. * @method
  34189. * @memberof Popper.Utils
  34190. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34191. * @returns {Element} parent
  34192. */
  34193. function getReferenceNode(reference) {
  34194. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34195. }
  34196. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34197. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34198. /**
  34199. * Determines if the browser is Internet Explorer
  34200. * @method
  34201. * @memberof Popper.Utils
  34202. * @param {Number} version to check
  34203. * @returns {Boolean} isIE
  34204. */
  34205. function isIE(version) {
  34206. if (version === 11) {
  34207. return isIE11;
  34208. }
  34209. if (version === 10) {
  34210. return isIE10;
  34211. }
  34212. return isIE11 || isIE10;
  34213. }
  34214. /**
  34215. * Returns the offset parent of the given element
  34216. * @method
  34217. * @memberof Popper.Utils
  34218. * @argument {Element} element
  34219. * @returns {Element} offset parent
  34220. */
  34221. function getOffsetParent(element) {
  34222. if (!element) {
  34223. return document.documentElement;
  34224. }
  34225. var noOffsetParent = isIE(10) ? document.body : null;
  34226. // NOTE: 1 DOM access here
  34227. var offsetParent = element.offsetParent || null;
  34228. // Skip hidden elements which don't have an offsetParent
  34229. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34230. offsetParent = (element = element.nextElementSibling).offsetParent;
  34231. }
  34232. var nodeName = offsetParent && offsetParent.nodeName;
  34233. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34234. return element ? element.ownerDocument.documentElement : document.documentElement;
  34235. }
  34236. // .offsetParent will return the closest TH, TD or TABLE in case
  34237. // no offsetParent is present, I hate this job...
  34238. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34239. return getOffsetParent(offsetParent);
  34240. }
  34241. return offsetParent;
  34242. }
  34243. function isOffsetContainer(element) {
  34244. var nodeName = element.nodeName;
  34245. if (nodeName === 'BODY') {
  34246. return false;
  34247. }
  34248. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34249. }
  34250. /**
  34251. * Finds the root node (document, shadowDOM root) of the given element
  34252. * @method
  34253. * @memberof Popper.Utils
  34254. * @argument {Element} node
  34255. * @returns {Element} root node
  34256. */
  34257. function getRoot(node) {
  34258. if (node.parentNode !== null) {
  34259. return getRoot(node.parentNode);
  34260. }
  34261. return node;
  34262. }
  34263. /**
  34264. * Finds the offset parent common to the two provided nodes
  34265. * @method
  34266. * @memberof Popper.Utils
  34267. * @argument {Element} element1
  34268. * @argument {Element} element2
  34269. * @returns {Element} common offset parent
  34270. */
  34271. function findCommonOffsetParent(element1, element2) {
  34272. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34273. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34274. return document.documentElement;
  34275. }
  34276. // Here we make sure to give as "start" the element that comes first in the DOM
  34277. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34278. var start = order ? element1 : element2;
  34279. var end = order ? element2 : element1;
  34280. // Get common ancestor container
  34281. var range = document.createRange();
  34282. range.setStart(start, 0);
  34283. range.setEnd(end, 0);
  34284. var commonAncestorContainer = range.commonAncestorContainer;
  34285. // Both nodes are inside #document
  34286. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34287. if (isOffsetContainer(commonAncestorContainer)) {
  34288. return commonAncestorContainer;
  34289. }
  34290. return getOffsetParent(commonAncestorContainer);
  34291. }
  34292. // one of the nodes is inside shadowDOM, find which one
  34293. var element1root = getRoot(element1);
  34294. if (element1root.host) {
  34295. return findCommonOffsetParent(element1root.host, element2);
  34296. } else {
  34297. return findCommonOffsetParent(element1, getRoot(element2).host);
  34298. }
  34299. }
  34300. /**
  34301. * Gets the scroll value of the given element in the given side (top and left)
  34302. * @method
  34303. * @memberof Popper.Utils
  34304. * @argument {Element} element
  34305. * @argument {String} side `top` or `left`
  34306. * @returns {number} amount of scrolled pixels
  34307. */
  34308. function getScroll(element) {
  34309. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34310. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34311. var nodeName = element.nodeName;
  34312. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34313. var html = element.ownerDocument.documentElement;
  34314. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34315. return scrollingElement[upperSide];
  34316. }
  34317. return element[upperSide];
  34318. }
  34319. /*
  34320. * Sum or subtract the element scroll values (left and top) from a given rect object
  34321. * @method
  34322. * @memberof Popper.Utils
  34323. * @param {Object} rect - Rect object you want to change
  34324. * @param {HTMLElement} element - The element from the function reads the scroll values
  34325. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34326. * @return {Object} rect - The modifier rect object
  34327. */
  34328. function includeScroll(rect, element) {
  34329. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34330. var scrollTop = getScroll(element, 'top');
  34331. var scrollLeft = getScroll(element, 'left');
  34332. var modifier = subtract ? -1 : 1;
  34333. rect.top += scrollTop * modifier;
  34334. rect.bottom += scrollTop * modifier;
  34335. rect.left += scrollLeft * modifier;
  34336. rect.right += scrollLeft * modifier;
  34337. return rect;
  34338. }
  34339. /*
  34340. * Helper to detect borders of a given element
  34341. * @method
  34342. * @memberof Popper.Utils
  34343. * @param {CSSStyleDeclaration} styles
  34344. * Result of `getStyleComputedProperty` on the given element
  34345. * @param {String} axis - `x` or `y`
  34346. * @return {number} borders - The borders size of the given axis
  34347. */
  34348. function getBordersSize(styles, axis) {
  34349. var sideA = axis === 'x' ? 'Left' : 'Top';
  34350. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34351. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34352. }
  34353. function getSize(axis, body, html, computedStyle) {
  34354. 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);
  34355. }
  34356. function getWindowSizes(document) {
  34357. var body = document.body;
  34358. var html = document.documentElement;
  34359. var computedStyle = isIE(10) && getComputedStyle(html);
  34360. return {
  34361. height: getSize('Height', body, html, computedStyle),
  34362. width: getSize('Width', body, html, computedStyle)
  34363. };
  34364. }
  34365. var classCallCheck = function (instance, Constructor) {
  34366. if (!(instance instanceof Constructor)) {
  34367. throw new TypeError("Cannot call a class as a function");
  34368. }
  34369. };
  34370. var createClass = function () {
  34371. function defineProperties(target, props) {
  34372. for (var i = 0; i < props.length; i++) {
  34373. var descriptor = props[i];
  34374. descriptor.enumerable = descriptor.enumerable || false;
  34375. descriptor.configurable = true;
  34376. if ("value" in descriptor) descriptor.writable = true;
  34377. Object.defineProperty(target, descriptor.key, descriptor);
  34378. }
  34379. }
  34380. return function (Constructor, protoProps, staticProps) {
  34381. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34382. if (staticProps) defineProperties(Constructor, staticProps);
  34383. return Constructor;
  34384. };
  34385. }();
  34386. var defineProperty = function (obj, key, value) {
  34387. if (key in obj) {
  34388. Object.defineProperty(obj, key, {
  34389. value: value,
  34390. enumerable: true,
  34391. configurable: true,
  34392. writable: true
  34393. });
  34394. } else {
  34395. obj[key] = value;
  34396. }
  34397. return obj;
  34398. };
  34399. var _extends = Object.assign || function (target) {
  34400. for (var i = 1; i < arguments.length; i++) {
  34401. var source = arguments[i];
  34402. for (var key in source) {
  34403. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34404. target[key] = source[key];
  34405. }
  34406. }
  34407. }
  34408. return target;
  34409. };
  34410. /**
  34411. * Given element offsets, generate an output similar to getBoundingClientRect
  34412. * @method
  34413. * @memberof Popper.Utils
  34414. * @argument {Object} offsets
  34415. * @returns {Object} ClientRect like output
  34416. */
  34417. function getClientRect(offsets) {
  34418. return _extends({}, offsets, {
  34419. right: offsets.left + offsets.width,
  34420. bottom: offsets.top + offsets.height
  34421. });
  34422. }
  34423. /**
  34424. * Get bounding client rect of given element
  34425. * @method
  34426. * @memberof Popper.Utils
  34427. * @param {HTMLElement} element
  34428. * @return {Object} client rect
  34429. */
  34430. function getBoundingClientRect(element) {
  34431. var rect = {};
  34432. // IE10 10 FIX: Please, don't ask, the element isn't
  34433. // considered in DOM in some circumstances...
  34434. // This isn't reproducible in IE10 compatibility mode of IE11
  34435. try {
  34436. if (isIE(10)) {
  34437. rect = element.getBoundingClientRect();
  34438. var scrollTop = getScroll(element, 'top');
  34439. var scrollLeft = getScroll(element, 'left');
  34440. rect.top += scrollTop;
  34441. rect.left += scrollLeft;
  34442. rect.bottom += scrollTop;
  34443. rect.right += scrollLeft;
  34444. } else {
  34445. rect = element.getBoundingClientRect();
  34446. }
  34447. } catch (e) {}
  34448. var result = {
  34449. left: rect.left,
  34450. top: rect.top,
  34451. width: rect.right - rect.left,
  34452. height: rect.bottom - rect.top
  34453. };
  34454. // subtract scrollbar size from sizes
  34455. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34456. var width = sizes.width || element.clientWidth || result.width;
  34457. var height = sizes.height || element.clientHeight || result.height;
  34458. var horizScrollbar = element.offsetWidth - width;
  34459. var vertScrollbar = element.offsetHeight - height;
  34460. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34461. // we make this check conditional for performance reasons
  34462. if (horizScrollbar || vertScrollbar) {
  34463. var styles = getStyleComputedProperty(element);
  34464. horizScrollbar -= getBordersSize(styles, 'x');
  34465. vertScrollbar -= getBordersSize(styles, 'y');
  34466. result.width -= horizScrollbar;
  34467. result.height -= vertScrollbar;
  34468. }
  34469. return getClientRect(result);
  34470. }
  34471. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34472. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34473. var isIE10 = isIE(10);
  34474. var isHTML = parent.nodeName === 'HTML';
  34475. var childrenRect = getBoundingClientRect(children);
  34476. var parentRect = getBoundingClientRect(parent);
  34477. var scrollParent = getScrollParent(children);
  34478. var styles = getStyleComputedProperty(parent);
  34479. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34480. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34481. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34482. if (fixedPosition && isHTML) {
  34483. parentRect.top = Math.max(parentRect.top, 0);
  34484. parentRect.left = Math.max(parentRect.left, 0);
  34485. }
  34486. var offsets = getClientRect({
  34487. top: childrenRect.top - parentRect.top - borderTopWidth,
  34488. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34489. width: childrenRect.width,
  34490. height: childrenRect.height
  34491. });
  34492. offsets.marginTop = 0;
  34493. offsets.marginLeft = 0;
  34494. // Subtract margins of documentElement in case it's being used as parent
  34495. // we do this only on HTML because it's the only element that behaves
  34496. // differently when margins are applied to it. The margins are included in
  34497. // the box of the documentElement, in the other cases not.
  34498. if (!isIE10 && isHTML) {
  34499. var marginTop = parseFloat(styles.marginTop);
  34500. var marginLeft = parseFloat(styles.marginLeft);
  34501. offsets.top -= borderTopWidth - marginTop;
  34502. offsets.bottom -= borderTopWidth - marginTop;
  34503. offsets.left -= borderLeftWidth - marginLeft;
  34504. offsets.right -= borderLeftWidth - marginLeft;
  34505. // Attach marginTop and marginLeft because in some circumstances we may need them
  34506. offsets.marginTop = marginTop;
  34507. offsets.marginLeft = marginLeft;
  34508. }
  34509. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34510. offsets = includeScroll(offsets, parent);
  34511. }
  34512. return offsets;
  34513. }
  34514. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34515. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34516. var html = element.ownerDocument.documentElement;
  34517. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34518. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34519. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34520. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34521. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34522. var offset = {
  34523. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34524. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34525. width: width,
  34526. height: height
  34527. };
  34528. return getClientRect(offset);
  34529. }
  34530. /**
  34531. * Check if the given element is fixed or is inside a fixed parent
  34532. * @method
  34533. * @memberof Popper.Utils
  34534. * @argument {Element} element
  34535. * @argument {Element} customContainer
  34536. * @returns {Boolean} answer to "isFixed?"
  34537. */
  34538. function isFixed(element) {
  34539. var nodeName = element.nodeName;
  34540. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34541. return false;
  34542. }
  34543. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34544. return true;
  34545. }
  34546. var parentNode = getParentNode(element);
  34547. if (!parentNode) {
  34548. return false;
  34549. }
  34550. return isFixed(parentNode);
  34551. }
  34552. /**
  34553. * Finds the first parent of an element that has a transformed property defined
  34554. * @method
  34555. * @memberof Popper.Utils
  34556. * @argument {Element} element
  34557. * @returns {Element} first transformed parent or documentElement
  34558. */
  34559. function getFixedPositionOffsetParent(element) {
  34560. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34561. if (!element || !element.parentElement || isIE()) {
  34562. return document.documentElement;
  34563. }
  34564. var el = element.parentElement;
  34565. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34566. el = el.parentElement;
  34567. }
  34568. return el || document.documentElement;
  34569. }
  34570. /**
  34571. * Computed the boundaries limits and return them
  34572. * @method
  34573. * @memberof Popper.Utils
  34574. * @param {HTMLElement} popper
  34575. * @param {HTMLElement} reference
  34576. * @param {number} padding
  34577. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34578. * @param {Boolean} fixedPosition - Is in fixed position mode
  34579. * @returns {Object} Coordinates of the boundaries
  34580. */
  34581. function getBoundaries(popper, reference, padding, boundariesElement) {
  34582. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34583. // NOTE: 1 DOM access here
  34584. var boundaries = { top: 0, left: 0 };
  34585. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34586. // Handle viewport case
  34587. if (boundariesElement === 'viewport') {
  34588. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34589. } else {
  34590. // Handle other cases based on DOM element used as boundaries
  34591. var boundariesNode = void 0;
  34592. if (boundariesElement === 'scrollParent') {
  34593. boundariesNode = getScrollParent(getParentNode(reference));
  34594. if (boundariesNode.nodeName === 'BODY') {
  34595. boundariesNode = popper.ownerDocument.documentElement;
  34596. }
  34597. } else if (boundariesElement === 'window') {
  34598. boundariesNode = popper.ownerDocument.documentElement;
  34599. } else {
  34600. boundariesNode = boundariesElement;
  34601. }
  34602. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34603. // In case of HTML, we need a different computation
  34604. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34605. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34606. height = _getWindowSizes.height,
  34607. width = _getWindowSizes.width;
  34608. boundaries.top += offsets.top - offsets.marginTop;
  34609. boundaries.bottom = height + offsets.top;
  34610. boundaries.left += offsets.left - offsets.marginLeft;
  34611. boundaries.right = width + offsets.left;
  34612. } else {
  34613. // for all the other DOM elements, this one is good
  34614. boundaries = offsets;
  34615. }
  34616. }
  34617. // Add paddings
  34618. padding = padding || 0;
  34619. var isPaddingNumber = typeof padding === 'number';
  34620. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34621. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34622. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34623. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34624. return boundaries;
  34625. }
  34626. function getArea(_ref) {
  34627. var width = _ref.width,
  34628. height = _ref.height;
  34629. return width * height;
  34630. }
  34631. /**
  34632. * Utility used to transform the `auto` placement to the placement with more
  34633. * available space.
  34634. * @method
  34635. * @memberof Popper.Utils
  34636. * @argument {Object} data - The data object generated by update method
  34637. * @argument {Object} options - Modifiers configuration and options
  34638. * @returns {Object} The data object, properly modified
  34639. */
  34640. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34641. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34642. if (placement.indexOf('auto') === -1) {
  34643. return placement;
  34644. }
  34645. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34646. var rects = {
  34647. top: {
  34648. width: boundaries.width,
  34649. height: refRect.top - boundaries.top
  34650. },
  34651. right: {
  34652. width: boundaries.right - refRect.right,
  34653. height: boundaries.height
  34654. },
  34655. bottom: {
  34656. width: boundaries.width,
  34657. height: boundaries.bottom - refRect.bottom
  34658. },
  34659. left: {
  34660. width: refRect.left - boundaries.left,
  34661. height: boundaries.height
  34662. }
  34663. };
  34664. var sortedAreas = Object.keys(rects).map(function (key) {
  34665. return _extends({
  34666. key: key
  34667. }, rects[key], {
  34668. area: getArea(rects[key])
  34669. });
  34670. }).sort(function (a, b) {
  34671. return b.area - a.area;
  34672. });
  34673. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34674. var width = _ref2.width,
  34675. height = _ref2.height;
  34676. return width >= popper.clientWidth && height >= popper.clientHeight;
  34677. });
  34678. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34679. var variation = placement.split('-')[1];
  34680. return computedPlacement + (variation ? '-' + variation : '');
  34681. }
  34682. /**
  34683. * Get offsets to the reference element
  34684. * @method
  34685. * @memberof Popper.Utils
  34686. * @param {Object} state
  34687. * @param {Element} popper - the popper element
  34688. * @param {Element} reference - the reference element (the popper will be relative to this)
  34689. * @param {Element} fixedPosition - is in fixed position mode
  34690. * @returns {Object} An object containing the offsets which will be applied to the popper
  34691. */
  34692. function getReferenceOffsets(state, popper, reference) {
  34693. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34694. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34695. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34696. }
  34697. /**
  34698. * Get the outer sizes of the given element (offset size + margins)
  34699. * @method
  34700. * @memberof Popper.Utils
  34701. * @argument {Element} element
  34702. * @returns {Object} object containing width and height properties
  34703. */
  34704. function getOuterSizes(element) {
  34705. var window = element.ownerDocument.defaultView;
  34706. var styles = window.getComputedStyle(element);
  34707. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34708. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34709. var result = {
  34710. width: element.offsetWidth + y,
  34711. height: element.offsetHeight + x
  34712. };
  34713. return result;
  34714. }
  34715. /**
  34716. * Get the opposite placement of the given one
  34717. * @method
  34718. * @memberof Popper.Utils
  34719. * @argument {String} placement
  34720. * @returns {String} flipped placement
  34721. */
  34722. function getOppositePlacement(placement) {
  34723. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  34724. return placement.replace(/left|right|bottom|top/g, function (matched) {
  34725. return hash[matched];
  34726. });
  34727. }
  34728. /**
  34729. * Get offsets to the popper
  34730. * @method
  34731. * @memberof Popper.Utils
  34732. * @param {Object} position - CSS position the Popper will get applied
  34733. * @param {HTMLElement} popper - the popper element
  34734. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  34735. * @param {String} placement - one of the valid placement options
  34736. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  34737. */
  34738. function getPopperOffsets(popper, referenceOffsets, placement) {
  34739. placement = placement.split('-')[0];
  34740. // Get popper node sizes
  34741. var popperRect = getOuterSizes(popper);
  34742. // Add position, width and height to our offsets object
  34743. var popperOffsets = {
  34744. width: popperRect.width,
  34745. height: popperRect.height
  34746. };
  34747. // depending by the popper placement we have to compute its offsets slightly differently
  34748. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  34749. var mainSide = isHoriz ? 'top' : 'left';
  34750. var secondarySide = isHoriz ? 'left' : 'top';
  34751. var measurement = isHoriz ? 'height' : 'width';
  34752. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  34753. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  34754. if (placement === secondarySide) {
  34755. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  34756. } else {
  34757. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  34758. }
  34759. return popperOffsets;
  34760. }
  34761. /**
  34762. * Mimics the `find` method of Array
  34763. * @method
  34764. * @memberof Popper.Utils
  34765. * @argument {Array} arr
  34766. * @argument prop
  34767. * @argument value
  34768. * @returns index or -1
  34769. */
  34770. function find(arr, check) {
  34771. // use native find if supported
  34772. if (Array.prototype.find) {
  34773. return arr.find(check);
  34774. }
  34775. // use `filter` to obtain the same behavior of `find`
  34776. return arr.filter(check)[0];
  34777. }
  34778. /**
  34779. * Return the index of the matching object
  34780. * @method
  34781. * @memberof Popper.Utils
  34782. * @argument {Array} arr
  34783. * @argument prop
  34784. * @argument value
  34785. * @returns index or -1
  34786. */
  34787. function findIndex(arr, prop, value) {
  34788. // use native findIndex if supported
  34789. if (Array.prototype.findIndex) {
  34790. return arr.findIndex(function (cur) {
  34791. return cur[prop] === value;
  34792. });
  34793. }
  34794. // use `find` + `indexOf` if `findIndex` isn't supported
  34795. var match = find(arr, function (obj) {
  34796. return obj[prop] === value;
  34797. });
  34798. return arr.indexOf(match);
  34799. }
  34800. /**
  34801. * Loop trough the list of modifiers and run them in order,
  34802. * each of them will then edit the data object.
  34803. * @method
  34804. * @memberof Popper.Utils
  34805. * @param {dataObject} data
  34806. * @param {Array} modifiers
  34807. * @param {String} ends - Optional modifier name used as stopper
  34808. * @returns {dataObject}
  34809. */
  34810. function runModifiers(modifiers, data, ends) {
  34811. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  34812. modifiersToRun.forEach(function (modifier) {
  34813. if (modifier['function']) {
  34814. // eslint-disable-line dot-notation
  34815. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  34816. }
  34817. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  34818. if (modifier.enabled && isFunction(fn)) {
  34819. // Add properties to offsets to make them a complete clientRect object
  34820. // we do this before each modifier to make sure the previous one doesn't
  34821. // mess with these values
  34822. data.offsets.popper = getClientRect(data.offsets.popper);
  34823. data.offsets.reference = getClientRect(data.offsets.reference);
  34824. data = fn(data, modifier);
  34825. }
  34826. });
  34827. return data;
  34828. }
  34829. /**
  34830. * Updates the position of the popper, computing the new offsets and applying
  34831. * the new style.<br />
  34832. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  34833. * @method
  34834. * @memberof Popper
  34835. */
  34836. function update() {
  34837. // if popper is destroyed, don't perform any further update
  34838. if (this.state.isDestroyed) {
  34839. return;
  34840. }
  34841. var data = {
  34842. instance: this,
  34843. styles: {},
  34844. arrowStyles: {},
  34845. attributes: {},
  34846. flipped: false,
  34847. offsets: {}
  34848. };
  34849. // compute reference element offsets
  34850. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  34851. // compute auto placement, store placement inside the data object,
  34852. // modifiers will be able to edit `placement` if needed
  34853. // and refer to originalPlacement to know the original value
  34854. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  34855. // store the computed placement inside `originalPlacement`
  34856. data.originalPlacement = data.placement;
  34857. data.positionFixed = this.options.positionFixed;
  34858. // compute the popper offsets
  34859. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  34860. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  34861. // run the modifiers
  34862. data = runModifiers(this.modifiers, data);
  34863. // the first `update` will call `onCreate` callback
  34864. // the other ones will call `onUpdate` callback
  34865. if (!this.state.isCreated) {
  34866. this.state.isCreated = true;
  34867. this.options.onCreate(data);
  34868. } else {
  34869. this.options.onUpdate(data);
  34870. }
  34871. }
  34872. /**
  34873. * Helper used to know if the given modifier is enabled.
  34874. * @method
  34875. * @memberof Popper.Utils
  34876. * @returns {Boolean}
  34877. */
  34878. function isModifierEnabled(modifiers, modifierName) {
  34879. return modifiers.some(function (_ref) {
  34880. var name = _ref.name,
  34881. enabled = _ref.enabled;
  34882. return enabled && name === modifierName;
  34883. });
  34884. }
  34885. /**
  34886. * Get the prefixed supported property name
  34887. * @method
  34888. * @memberof Popper.Utils
  34889. * @argument {String} property (camelCase)
  34890. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  34891. */
  34892. function getSupportedPropertyName(property) {
  34893. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  34894. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  34895. for (var i = 0; i < prefixes.length; i++) {
  34896. var prefix = prefixes[i];
  34897. var toCheck = prefix ? '' + prefix + upperProp : property;
  34898. if (typeof document.body.style[toCheck] !== 'undefined') {
  34899. return toCheck;
  34900. }
  34901. }
  34902. return null;
  34903. }
  34904. /**
  34905. * Destroys the popper.
  34906. * @method
  34907. * @memberof Popper
  34908. */
  34909. function destroy() {
  34910. this.state.isDestroyed = true;
  34911. // touch DOM only if `applyStyle` modifier is enabled
  34912. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  34913. this.popper.removeAttribute('x-placement');
  34914. this.popper.style.position = '';
  34915. this.popper.style.top = '';
  34916. this.popper.style.left = '';
  34917. this.popper.style.right = '';
  34918. this.popper.style.bottom = '';
  34919. this.popper.style.willChange = '';
  34920. this.popper.style[getSupportedPropertyName('transform')] = '';
  34921. }
  34922. this.disableEventListeners();
  34923. // remove the popper if user explicitly asked for the deletion on destroy
  34924. // do not use `remove` because IE11 doesn't support it
  34925. if (this.options.removeOnDestroy) {
  34926. this.popper.parentNode.removeChild(this.popper);
  34927. }
  34928. return this;
  34929. }
  34930. /**
  34931. * Get the window associated with the element
  34932. * @argument {Element} element
  34933. * @returns {Window}
  34934. */
  34935. function getWindow(element) {
  34936. var ownerDocument = element.ownerDocument;
  34937. return ownerDocument ? ownerDocument.defaultView : window;
  34938. }
  34939. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  34940. var isBody = scrollParent.nodeName === 'BODY';
  34941. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  34942. target.addEventListener(event, callback, { passive: true });
  34943. if (!isBody) {
  34944. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  34945. }
  34946. scrollParents.push(target);
  34947. }
  34948. /**
  34949. * Setup needed event listeners used to update the popper position
  34950. * @method
  34951. * @memberof Popper.Utils
  34952. * @private
  34953. */
  34954. function setupEventListeners(reference, options, state, updateBound) {
  34955. // Resize event listener on window
  34956. state.updateBound = updateBound;
  34957. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  34958. // Scroll event listener on scroll parents
  34959. var scrollElement = getScrollParent(reference);
  34960. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  34961. state.scrollElement = scrollElement;
  34962. state.eventsEnabled = true;
  34963. return state;
  34964. }
  34965. /**
  34966. * It will add resize/scroll events and start recalculating
  34967. * position of the popper element when they are triggered.
  34968. * @method
  34969. * @memberof Popper
  34970. */
  34971. function enableEventListeners() {
  34972. if (!this.state.eventsEnabled) {
  34973. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  34974. }
  34975. }
  34976. /**
  34977. * Remove event listeners used to update the popper position
  34978. * @method
  34979. * @memberof Popper.Utils
  34980. * @private
  34981. */
  34982. function removeEventListeners(reference, state) {
  34983. // Remove resize event listener on window
  34984. getWindow(reference).removeEventListener('resize', state.updateBound);
  34985. // Remove scroll event listener on scroll parents
  34986. state.scrollParents.forEach(function (target) {
  34987. target.removeEventListener('scroll', state.updateBound);
  34988. });
  34989. // Reset state
  34990. state.updateBound = null;
  34991. state.scrollParents = [];
  34992. state.scrollElement = null;
  34993. state.eventsEnabled = false;
  34994. return state;
  34995. }
  34996. /**
  34997. * It will remove resize/scroll events and won't recalculate popper position
  34998. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  34999. * unless you call `update` method manually.
  35000. * @method
  35001. * @memberof Popper
  35002. */
  35003. function disableEventListeners() {
  35004. if (this.state.eventsEnabled) {
  35005. cancelAnimationFrame(this.scheduleUpdate);
  35006. this.state = removeEventListeners(this.reference, this.state);
  35007. }
  35008. }
  35009. /**
  35010. * Tells if a given input is a number
  35011. * @method
  35012. * @memberof Popper.Utils
  35013. * @param {*} input to check
  35014. * @return {Boolean}
  35015. */
  35016. function isNumeric(n) {
  35017. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35018. }
  35019. /**
  35020. * Set the style to the given popper
  35021. * @method
  35022. * @memberof Popper.Utils
  35023. * @argument {Element} element - Element to apply the style to
  35024. * @argument {Object} styles
  35025. * Object with a list of properties and values which will be applied to the element
  35026. */
  35027. function setStyles(element, styles) {
  35028. Object.keys(styles).forEach(function (prop) {
  35029. var unit = '';
  35030. // add unit if the value is numeric and is one of the following
  35031. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35032. unit = 'px';
  35033. }
  35034. element.style[prop] = styles[prop] + unit;
  35035. });
  35036. }
  35037. /**
  35038. * Set the attributes to the given popper
  35039. * @method
  35040. * @memberof Popper.Utils
  35041. * @argument {Element} element - Element to apply the attributes to
  35042. * @argument {Object} styles
  35043. * Object with a list of properties and values which will be applied to the element
  35044. */
  35045. function setAttributes(element, attributes) {
  35046. Object.keys(attributes).forEach(function (prop) {
  35047. var value = attributes[prop];
  35048. if (value !== false) {
  35049. element.setAttribute(prop, attributes[prop]);
  35050. } else {
  35051. element.removeAttribute(prop);
  35052. }
  35053. });
  35054. }
  35055. /**
  35056. * @function
  35057. * @memberof Modifiers
  35058. * @argument {Object} data - The data object generated by `update` method
  35059. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35060. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35061. * @argument {Object} options - Modifiers configuration and options
  35062. * @returns {Object} The same data object
  35063. */
  35064. function applyStyle(data) {
  35065. // any property present in `data.styles` will be applied to the popper,
  35066. // in this way we can make the 3rd party modifiers add custom styles to it
  35067. // Be aware, modifiers could override the properties defined in the previous
  35068. // lines of this modifier!
  35069. setStyles(data.instance.popper, data.styles);
  35070. // any property present in `data.attributes` will be applied to the popper,
  35071. // they will be set as HTML attributes of the element
  35072. setAttributes(data.instance.popper, data.attributes);
  35073. // if arrowElement is defined and arrowStyles has some properties
  35074. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35075. setStyles(data.arrowElement, data.arrowStyles);
  35076. }
  35077. return data;
  35078. }
  35079. /**
  35080. * Set the x-placement attribute before everything else because it could be used
  35081. * to add margins to the popper margins needs to be calculated to get the
  35082. * correct popper offsets.
  35083. * @method
  35084. * @memberof Popper.modifiers
  35085. * @param {HTMLElement} reference - The reference element used to position the popper
  35086. * @param {HTMLElement} popper - The HTML element used as popper
  35087. * @param {Object} options - Popper.js options
  35088. */
  35089. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35090. // compute reference element offsets
  35091. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35092. // compute auto placement, store placement inside the data object,
  35093. // modifiers will be able to edit `placement` if needed
  35094. // and refer to originalPlacement to know the original value
  35095. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35096. popper.setAttribute('x-placement', placement);
  35097. // Apply `position` to popper before anything else because
  35098. // without the position applied we can't guarantee correct computations
  35099. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35100. return options;
  35101. }
  35102. /**
  35103. * @function
  35104. * @memberof Popper.Utils
  35105. * @argument {Object} data - The data object generated by `update` method
  35106. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35107. * @returns {Object} The popper's position offsets rounded
  35108. *
  35109. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35110. * good as it can be within reason.
  35111. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35112. *
  35113. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35114. * as well on High DPI screens).
  35115. *
  35116. * Firefox prefers no rounding for positioning and does not have blurriness on
  35117. * high DPI screens.
  35118. *
  35119. * Only horizontal placement and left/right values need to be considered.
  35120. */
  35121. function getRoundedOffsets(data, shouldRound) {
  35122. var _data$offsets = data.offsets,
  35123. popper = _data$offsets.popper,
  35124. reference = _data$offsets.reference;
  35125. var round = Math.round,
  35126. floor = Math.floor;
  35127. var noRound = function noRound(v) {
  35128. return v;
  35129. };
  35130. var referenceWidth = round(reference.width);
  35131. var popperWidth = round(popper.width);
  35132. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35133. var isVariation = data.placement.indexOf('-') !== -1;
  35134. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35135. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35136. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35137. var verticalToInteger = !shouldRound ? noRound : round;
  35138. return {
  35139. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35140. top: verticalToInteger(popper.top),
  35141. bottom: verticalToInteger(popper.bottom),
  35142. right: horizontalToInteger(popper.right)
  35143. };
  35144. }
  35145. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35146. /**
  35147. * @function
  35148. * @memberof Modifiers
  35149. * @argument {Object} data - The data object generated by `update` method
  35150. * @argument {Object} options - Modifiers configuration and options
  35151. * @returns {Object} The data object, properly modified
  35152. */
  35153. function computeStyle(data, options) {
  35154. var x = options.x,
  35155. y = options.y;
  35156. var popper = data.offsets.popper;
  35157. // Remove this legacy support in Popper.js v2
  35158. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35159. return modifier.name === 'applyStyle';
  35160. }).gpuAcceleration;
  35161. if (legacyGpuAccelerationOption !== undefined) {
  35162. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35163. }
  35164. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35165. var offsetParent = getOffsetParent(data.instance.popper);
  35166. var offsetParentRect = getBoundingClientRect(offsetParent);
  35167. // Styles
  35168. var styles = {
  35169. position: popper.position
  35170. };
  35171. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35172. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35173. var sideB = y === 'right' ? 'left' : 'right';
  35174. // if gpuAcceleration is set to `true` and transform is supported,
  35175. // we use `translate3d` to apply the position to the popper we
  35176. // automatically use the supported prefixed version if needed
  35177. var prefixedProperty = getSupportedPropertyName('transform');
  35178. // now, let's make a step back and look at this code closely (wtf?)
  35179. // If the content of the popper grows once it's been positioned, it
  35180. // may happen that the popper gets misplaced because of the new content
  35181. // overflowing its reference element
  35182. // To avoid this problem, we provide two options (x and y), which allow
  35183. // the consumer to define the offset origin.
  35184. // If we position a popper on top of a reference element, we can set
  35185. // `x` to `top` to make the popper grow towards its top instead of
  35186. // its bottom.
  35187. var left = void 0,
  35188. top = void 0;
  35189. if (sideA === 'bottom') {
  35190. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35191. // and not the bottom of the html element
  35192. if (offsetParent.nodeName === 'HTML') {
  35193. top = -offsetParent.clientHeight + offsets.bottom;
  35194. } else {
  35195. top = -offsetParentRect.height + offsets.bottom;
  35196. }
  35197. } else {
  35198. top = offsets.top;
  35199. }
  35200. if (sideB === 'right') {
  35201. if (offsetParent.nodeName === 'HTML') {
  35202. left = -offsetParent.clientWidth + offsets.right;
  35203. } else {
  35204. left = -offsetParentRect.width + offsets.right;
  35205. }
  35206. } else {
  35207. left = offsets.left;
  35208. }
  35209. if (gpuAcceleration && prefixedProperty) {
  35210. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35211. styles[sideA] = 0;
  35212. styles[sideB] = 0;
  35213. styles.willChange = 'transform';
  35214. } else {
  35215. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35216. var invertTop = sideA === 'bottom' ? -1 : 1;
  35217. var invertLeft = sideB === 'right' ? -1 : 1;
  35218. styles[sideA] = top * invertTop;
  35219. styles[sideB] = left * invertLeft;
  35220. styles.willChange = sideA + ', ' + sideB;
  35221. }
  35222. // Attributes
  35223. var attributes = {
  35224. 'x-placement': data.placement
  35225. };
  35226. // Update `data` attributes, styles and arrowStyles
  35227. data.attributes = _extends({}, attributes, data.attributes);
  35228. data.styles = _extends({}, styles, data.styles);
  35229. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35230. return data;
  35231. }
  35232. /**
  35233. * Helper used to know if the given modifier depends from another one.<br />
  35234. * It checks if the needed modifier is listed and enabled.
  35235. * @method
  35236. * @memberof Popper.Utils
  35237. * @param {Array} modifiers - list of modifiers
  35238. * @param {String} requestingName - name of requesting modifier
  35239. * @param {String} requestedName - name of requested modifier
  35240. * @returns {Boolean}
  35241. */
  35242. function isModifierRequired(modifiers, requestingName, requestedName) {
  35243. var requesting = find(modifiers, function (_ref) {
  35244. var name = _ref.name;
  35245. return name === requestingName;
  35246. });
  35247. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35248. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35249. });
  35250. if (!isRequired) {
  35251. var _requesting = '`' + requestingName + '`';
  35252. var requested = '`' + requestedName + '`';
  35253. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35254. }
  35255. return isRequired;
  35256. }
  35257. /**
  35258. * @function
  35259. * @memberof Modifiers
  35260. * @argument {Object} data - The data object generated by update method
  35261. * @argument {Object} options - Modifiers configuration and options
  35262. * @returns {Object} The data object, properly modified
  35263. */
  35264. function arrow(data, options) {
  35265. var _data$offsets$arrow;
  35266. // arrow depends on keepTogether in order to work
  35267. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35268. return data;
  35269. }
  35270. var arrowElement = options.element;
  35271. // if arrowElement is a string, suppose it's a CSS selector
  35272. if (typeof arrowElement === 'string') {
  35273. arrowElement = data.instance.popper.querySelector(arrowElement);
  35274. // if arrowElement is not found, don't run the modifier
  35275. if (!arrowElement) {
  35276. return data;
  35277. }
  35278. } else {
  35279. // if the arrowElement isn't a query selector we must check that the
  35280. // provided DOM node is child of its popper node
  35281. if (!data.instance.popper.contains(arrowElement)) {
  35282. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35283. return data;
  35284. }
  35285. }
  35286. var placement = data.placement.split('-')[0];
  35287. var _data$offsets = data.offsets,
  35288. popper = _data$offsets.popper,
  35289. reference = _data$offsets.reference;
  35290. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35291. var len = isVertical ? 'height' : 'width';
  35292. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35293. var side = sideCapitalized.toLowerCase();
  35294. var altSide = isVertical ? 'left' : 'top';
  35295. var opSide = isVertical ? 'bottom' : 'right';
  35296. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35297. //
  35298. // extends keepTogether behavior making sure the popper and its
  35299. // reference have enough pixels in conjunction
  35300. //
  35301. // top/left side
  35302. if (reference[opSide] - arrowElementSize < popper[side]) {
  35303. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35304. }
  35305. // bottom/right side
  35306. if (reference[side] + arrowElementSize > popper[opSide]) {
  35307. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35308. }
  35309. data.offsets.popper = getClientRect(data.offsets.popper);
  35310. // compute center of the popper
  35311. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35312. // Compute the sideValue using the updated popper offsets
  35313. // take popper margin in account because we don't have this info available
  35314. var css = getStyleComputedProperty(data.instance.popper);
  35315. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35316. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35317. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35318. // prevent arrowElement from being placed not contiguously to its popper
  35319. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35320. data.arrowElement = arrowElement;
  35321. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35322. return data;
  35323. }
  35324. /**
  35325. * Get the opposite placement variation of the given one
  35326. * @method
  35327. * @memberof Popper.Utils
  35328. * @argument {String} placement variation
  35329. * @returns {String} flipped placement variation
  35330. */
  35331. function getOppositeVariation(variation) {
  35332. if (variation === 'end') {
  35333. return 'start';
  35334. } else if (variation === 'start') {
  35335. return 'end';
  35336. }
  35337. return variation;
  35338. }
  35339. /**
  35340. * List of accepted placements to use as values of the `placement` option.<br />
  35341. * Valid placements are:
  35342. * - `auto`
  35343. * - `top`
  35344. * - `right`
  35345. * - `bottom`
  35346. * - `left`
  35347. *
  35348. * Each placement can have a variation from this list:
  35349. * - `-start`
  35350. * - `-end`
  35351. *
  35352. * Variations are interpreted easily if you think of them as the left to right
  35353. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35354. * is right.<br />
  35355. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35356. *
  35357. * Some valid examples are:
  35358. * - `top-end` (on top of reference, right aligned)
  35359. * - `right-start` (on right of reference, top aligned)
  35360. * - `bottom` (on bottom, centered)
  35361. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35362. *
  35363. * @static
  35364. * @type {Array}
  35365. * @enum {String}
  35366. * @readonly
  35367. * @method placements
  35368. * @memberof Popper
  35369. */
  35370. 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'];
  35371. // Get rid of `auto` `auto-start` and `auto-end`
  35372. var validPlacements = placements.slice(3);
  35373. /**
  35374. * Given an initial placement, returns all the subsequent placements
  35375. * clockwise (or counter-clockwise).
  35376. *
  35377. * @method
  35378. * @memberof Popper.Utils
  35379. * @argument {String} placement - A valid placement (it accepts variations)
  35380. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35381. * @returns {Array} placements including their variations
  35382. */
  35383. function clockwise(placement) {
  35384. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35385. var index = validPlacements.indexOf(placement);
  35386. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35387. return counter ? arr.reverse() : arr;
  35388. }
  35389. var BEHAVIORS = {
  35390. FLIP: 'flip',
  35391. CLOCKWISE: 'clockwise',
  35392. COUNTERCLOCKWISE: 'counterclockwise'
  35393. };
  35394. /**
  35395. * @function
  35396. * @memberof Modifiers
  35397. * @argument {Object} data - The data object generated by update method
  35398. * @argument {Object} options - Modifiers configuration and options
  35399. * @returns {Object} The data object, properly modified
  35400. */
  35401. function flip(data, options) {
  35402. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35403. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35404. return data;
  35405. }
  35406. if (data.flipped && data.placement === data.originalPlacement) {
  35407. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35408. return data;
  35409. }
  35410. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35411. var placement = data.placement.split('-')[0];
  35412. var placementOpposite = getOppositePlacement(placement);
  35413. var variation = data.placement.split('-')[1] || '';
  35414. var flipOrder = [];
  35415. switch (options.behavior) {
  35416. case BEHAVIORS.FLIP:
  35417. flipOrder = [placement, placementOpposite];
  35418. break;
  35419. case BEHAVIORS.CLOCKWISE:
  35420. flipOrder = clockwise(placement);
  35421. break;
  35422. case BEHAVIORS.COUNTERCLOCKWISE:
  35423. flipOrder = clockwise(placement, true);
  35424. break;
  35425. default:
  35426. flipOrder = options.behavior;
  35427. }
  35428. flipOrder.forEach(function (step, index) {
  35429. if (placement !== step || flipOrder.length === index + 1) {
  35430. return data;
  35431. }
  35432. placement = data.placement.split('-')[0];
  35433. placementOpposite = getOppositePlacement(placement);
  35434. var popperOffsets = data.offsets.popper;
  35435. var refOffsets = data.offsets.reference;
  35436. // using floor because the reference offsets may contain decimals we are not going to consider here
  35437. var floor = Math.floor;
  35438. 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);
  35439. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35440. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35441. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35442. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35443. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35444. // flip the variation if required
  35445. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35446. // flips variation if reference element overflows boundaries
  35447. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35448. // flips variation if popper content overflows boundaries
  35449. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35450. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35451. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35452. // this boolean to detect any flip loop
  35453. data.flipped = true;
  35454. if (overlapsRef || overflowsBoundaries) {
  35455. placement = flipOrder[index + 1];
  35456. }
  35457. if (flippedVariation) {
  35458. variation = getOppositeVariation(variation);
  35459. }
  35460. data.placement = placement + (variation ? '-' + variation : '');
  35461. // this object contains `position`, we want to preserve it along with
  35462. // any additional property we may add in the future
  35463. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35464. data = runModifiers(data.instance.modifiers, data, 'flip');
  35465. }
  35466. });
  35467. return data;
  35468. }
  35469. /**
  35470. * @function
  35471. * @memberof Modifiers
  35472. * @argument {Object} data - The data object generated by update method
  35473. * @argument {Object} options - Modifiers configuration and options
  35474. * @returns {Object} The data object, properly modified
  35475. */
  35476. function keepTogether(data) {
  35477. var _data$offsets = data.offsets,
  35478. popper = _data$offsets.popper,
  35479. reference = _data$offsets.reference;
  35480. var placement = data.placement.split('-')[0];
  35481. var floor = Math.floor;
  35482. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35483. var side = isVertical ? 'right' : 'bottom';
  35484. var opSide = isVertical ? 'left' : 'top';
  35485. var measurement = isVertical ? 'width' : 'height';
  35486. if (popper[side] < floor(reference[opSide])) {
  35487. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35488. }
  35489. if (popper[opSide] > floor(reference[side])) {
  35490. data.offsets.popper[opSide] = floor(reference[side]);
  35491. }
  35492. return data;
  35493. }
  35494. /**
  35495. * Converts a string containing value + unit into a px value number
  35496. * @function
  35497. * @memberof {modifiers~offset}
  35498. * @private
  35499. * @argument {String} str - Value + unit string
  35500. * @argument {String} measurement - `height` or `width`
  35501. * @argument {Object} popperOffsets
  35502. * @argument {Object} referenceOffsets
  35503. * @returns {Number|String}
  35504. * Value in pixels, or original string if no values were extracted
  35505. */
  35506. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35507. // separate value from unit
  35508. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35509. var value = +split[1];
  35510. var unit = split[2];
  35511. // If it's not a number it's an operator, I guess
  35512. if (!value) {
  35513. return str;
  35514. }
  35515. if (unit.indexOf('%') === 0) {
  35516. var element = void 0;
  35517. switch (unit) {
  35518. case '%p':
  35519. element = popperOffsets;
  35520. break;
  35521. case '%':
  35522. case '%r':
  35523. default:
  35524. element = referenceOffsets;
  35525. }
  35526. var rect = getClientRect(element);
  35527. return rect[measurement] / 100 * value;
  35528. } else if (unit === 'vh' || unit === 'vw') {
  35529. // if is a vh or vw, we calculate the size based on the viewport
  35530. var size = void 0;
  35531. if (unit === 'vh') {
  35532. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35533. } else {
  35534. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35535. }
  35536. return size / 100 * value;
  35537. } else {
  35538. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35539. // if is an implicit unit, it's px, and we return just the value
  35540. return value;
  35541. }
  35542. }
  35543. /**
  35544. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35545. * @function
  35546. * @memberof {modifiers~offset}
  35547. * @private
  35548. * @argument {String} offset
  35549. * @argument {Object} popperOffsets
  35550. * @argument {Object} referenceOffsets
  35551. * @argument {String} basePlacement
  35552. * @returns {Array} a two cells array with x and y offsets in numbers
  35553. */
  35554. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35555. var offsets = [0, 0];
  35556. // Use height if placement is left or right and index is 0 otherwise use width
  35557. // in this way the first offset will use an axis and the second one
  35558. // will use the other one
  35559. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35560. // Split the offset string to obtain a list of values and operands
  35561. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35562. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35563. return frag.trim();
  35564. });
  35565. // Detect if the offset string contains a pair of values or a single one
  35566. // they could be separated by comma or space
  35567. var divider = fragments.indexOf(find(fragments, function (frag) {
  35568. return frag.search(/,|\s/) !== -1;
  35569. }));
  35570. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35571. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35572. }
  35573. // If divider is found, we divide the list of values and operands to divide
  35574. // them by ofset X and Y.
  35575. var splitRegex = /\s*,\s*|\s+/;
  35576. 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];
  35577. // Convert the values with units to absolute pixels to allow our computations
  35578. ops = ops.map(function (op, index) {
  35579. // Most of the units rely on the orientation of the popper
  35580. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35581. var mergeWithPrevious = false;
  35582. return op
  35583. // This aggregates any `+` or `-` sign that aren't considered operators
  35584. // e.g.: 10 + +5 => [10, +, +5]
  35585. .reduce(function (a, b) {
  35586. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35587. a[a.length - 1] = b;
  35588. mergeWithPrevious = true;
  35589. return a;
  35590. } else if (mergeWithPrevious) {
  35591. a[a.length - 1] += b;
  35592. mergeWithPrevious = false;
  35593. return a;
  35594. } else {
  35595. return a.concat(b);
  35596. }
  35597. }, [])
  35598. // Here we convert the string values into number values (in px)
  35599. .map(function (str) {
  35600. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35601. });
  35602. });
  35603. // Loop trough the offsets arrays and execute the operations
  35604. ops.forEach(function (op, index) {
  35605. op.forEach(function (frag, index2) {
  35606. if (isNumeric(frag)) {
  35607. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35608. }
  35609. });
  35610. });
  35611. return offsets;
  35612. }
  35613. /**
  35614. * @function
  35615. * @memberof Modifiers
  35616. * @argument {Object} data - The data object generated by update method
  35617. * @argument {Object} options - Modifiers configuration and options
  35618. * @argument {Number|String} options.offset=0
  35619. * The offset value as described in the modifier description
  35620. * @returns {Object} The data object, properly modified
  35621. */
  35622. function offset(data, _ref) {
  35623. var offset = _ref.offset;
  35624. var placement = data.placement,
  35625. _data$offsets = data.offsets,
  35626. popper = _data$offsets.popper,
  35627. reference = _data$offsets.reference;
  35628. var basePlacement = placement.split('-')[0];
  35629. var offsets = void 0;
  35630. if (isNumeric(+offset)) {
  35631. offsets = [+offset, 0];
  35632. } else {
  35633. offsets = parseOffset(offset, popper, reference, basePlacement);
  35634. }
  35635. if (basePlacement === 'left') {
  35636. popper.top += offsets[0];
  35637. popper.left -= offsets[1];
  35638. } else if (basePlacement === 'right') {
  35639. popper.top += offsets[0];
  35640. popper.left += offsets[1];
  35641. } else if (basePlacement === 'top') {
  35642. popper.left += offsets[0];
  35643. popper.top -= offsets[1];
  35644. } else if (basePlacement === 'bottom') {
  35645. popper.left += offsets[0];
  35646. popper.top += offsets[1];
  35647. }
  35648. data.popper = popper;
  35649. return data;
  35650. }
  35651. /**
  35652. * @function
  35653. * @memberof Modifiers
  35654. * @argument {Object} data - The data object generated by `update` method
  35655. * @argument {Object} options - Modifiers configuration and options
  35656. * @returns {Object} The data object, properly modified
  35657. */
  35658. function preventOverflow(data, options) {
  35659. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35660. // If offsetParent is the reference element, we really want to
  35661. // go one step up and use the next offsetParent as reference to
  35662. // avoid to make this modifier completely useless and look like broken
  35663. if (data.instance.reference === boundariesElement) {
  35664. boundariesElement = getOffsetParent(boundariesElement);
  35665. }
  35666. // NOTE: DOM access here
  35667. // resets the popper's position so that the document size can be calculated excluding
  35668. // the size of the popper element itself
  35669. var transformProp = getSupportedPropertyName('transform');
  35670. var popperStyles = data.instance.popper.style; // assignment to help minification
  35671. var top = popperStyles.top,
  35672. left = popperStyles.left,
  35673. transform = popperStyles[transformProp];
  35674. popperStyles.top = '';
  35675. popperStyles.left = '';
  35676. popperStyles[transformProp] = '';
  35677. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35678. // NOTE: DOM access here
  35679. // restores the original style properties after the offsets have been computed
  35680. popperStyles.top = top;
  35681. popperStyles.left = left;
  35682. popperStyles[transformProp] = transform;
  35683. options.boundaries = boundaries;
  35684. var order = options.priority;
  35685. var popper = data.offsets.popper;
  35686. var check = {
  35687. primary: function primary(placement) {
  35688. var value = popper[placement];
  35689. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35690. value = Math.max(popper[placement], boundaries[placement]);
  35691. }
  35692. return defineProperty({}, placement, value);
  35693. },
  35694. secondary: function secondary(placement) {
  35695. var mainSide = placement === 'right' ? 'left' : 'top';
  35696. var value = popper[mainSide];
  35697. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35698. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35699. }
  35700. return defineProperty({}, mainSide, value);
  35701. }
  35702. };
  35703. order.forEach(function (placement) {
  35704. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35705. popper = _extends({}, popper, check[side](placement));
  35706. });
  35707. data.offsets.popper = popper;
  35708. return data;
  35709. }
  35710. /**
  35711. * @function
  35712. * @memberof Modifiers
  35713. * @argument {Object} data - The data object generated by `update` method
  35714. * @argument {Object} options - Modifiers configuration and options
  35715. * @returns {Object} The data object, properly modified
  35716. */
  35717. function shift(data) {
  35718. var placement = data.placement;
  35719. var basePlacement = placement.split('-')[0];
  35720. var shiftvariation = placement.split('-')[1];
  35721. // if shift shiftvariation is specified, run the modifier
  35722. if (shiftvariation) {
  35723. var _data$offsets = data.offsets,
  35724. reference = _data$offsets.reference,
  35725. popper = _data$offsets.popper;
  35726. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  35727. var side = isVertical ? 'left' : 'top';
  35728. var measurement = isVertical ? 'width' : 'height';
  35729. var shiftOffsets = {
  35730. start: defineProperty({}, side, reference[side]),
  35731. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  35732. };
  35733. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  35734. }
  35735. return data;
  35736. }
  35737. /**
  35738. * @function
  35739. * @memberof Modifiers
  35740. * @argument {Object} data - The data object generated by update method
  35741. * @argument {Object} options - Modifiers configuration and options
  35742. * @returns {Object} The data object, properly modified
  35743. */
  35744. function hide(data) {
  35745. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  35746. return data;
  35747. }
  35748. var refRect = data.offsets.reference;
  35749. var bound = find(data.instance.modifiers, function (modifier) {
  35750. return modifier.name === 'preventOverflow';
  35751. }).boundaries;
  35752. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  35753. // Avoid unnecessary DOM access if visibility hasn't changed
  35754. if (data.hide === true) {
  35755. return data;
  35756. }
  35757. data.hide = true;
  35758. data.attributes['x-out-of-boundaries'] = '';
  35759. } else {
  35760. // Avoid unnecessary DOM access if visibility hasn't changed
  35761. if (data.hide === false) {
  35762. return data;
  35763. }
  35764. data.hide = false;
  35765. data.attributes['x-out-of-boundaries'] = false;
  35766. }
  35767. return data;
  35768. }
  35769. /**
  35770. * @function
  35771. * @memberof Modifiers
  35772. * @argument {Object} data - The data object generated by `update` method
  35773. * @argument {Object} options - Modifiers configuration and options
  35774. * @returns {Object} The data object, properly modified
  35775. */
  35776. function inner(data) {
  35777. var placement = data.placement;
  35778. var basePlacement = placement.split('-')[0];
  35779. var _data$offsets = data.offsets,
  35780. popper = _data$offsets.popper,
  35781. reference = _data$offsets.reference;
  35782. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  35783. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  35784. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  35785. data.placement = getOppositePlacement(placement);
  35786. data.offsets.popper = getClientRect(popper);
  35787. return data;
  35788. }
  35789. /**
  35790. * Modifier function, each modifier can have a function of this type assigned
  35791. * to its `fn` property.<br />
  35792. * These functions will be called on each update, this means that you must
  35793. * make sure they are performant enough to avoid performance bottlenecks.
  35794. *
  35795. * @function ModifierFn
  35796. * @argument {dataObject} data - The data object generated by `update` method
  35797. * @argument {Object} options - Modifiers configuration and options
  35798. * @returns {dataObject} The data object, properly modified
  35799. */
  35800. /**
  35801. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  35802. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  35803. * needed by the library.
  35804. *
  35805. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  35806. * All the other properties are configurations that could be tweaked.
  35807. * @namespace modifiers
  35808. */
  35809. var modifiers = {
  35810. /**
  35811. * Modifier used to shift the popper on the start or end of its reference
  35812. * element.<br />
  35813. * It will read the variation of the `placement` property.<br />
  35814. * It can be one either `-end` or `-start`.
  35815. * @memberof modifiers
  35816. * @inner
  35817. */
  35818. shift: {
  35819. /** @prop {number} order=100 - Index used to define the order of execution */
  35820. order: 100,
  35821. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35822. enabled: true,
  35823. /** @prop {ModifierFn} */
  35824. fn: shift
  35825. },
  35826. /**
  35827. * The `offset` modifier can shift your popper on both its axis.
  35828. *
  35829. * It accepts the following units:
  35830. * - `px` or unit-less, interpreted as pixels
  35831. * - `%` or `%r`, percentage relative to the length of the reference element
  35832. * - `%p`, percentage relative to the length of the popper element
  35833. * - `vw`, CSS viewport width unit
  35834. * - `vh`, CSS viewport height unit
  35835. *
  35836. * For length is intended the main axis relative to the placement of the popper.<br />
  35837. * This means that if the placement is `top` or `bottom`, the length will be the
  35838. * `width`. In case of `left` or `right`, it will be the `height`.
  35839. *
  35840. * You can provide a single value (as `Number` or `String`), or a pair of values
  35841. * as `String` divided by a comma or one (or more) white spaces.<br />
  35842. * The latter is a deprecated method because it leads to confusion and will be
  35843. * removed in v2.<br />
  35844. * Additionally, it accepts additions and subtractions between different units.
  35845. * Note that multiplications and divisions aren't supported.
  35846. *
  35847. * Valid examples are:
  35848. * ```
  35849. * 10
  35850. * '10%'
  35851. * '10, 10'
  35852. * '10%, 10'
  35853. * '10 + 10%'
  35854. * '10 - 5vh + 3%'
  35855. * '-10px + 5vh, 5px - 6%'
  35856. * ```
  35857. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  35858. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  35859. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  35860. *
  35861. * @memberof modifiers
  35862. * @inner
  35863. */
  35864. offset: {
  35865. /** @prop {number} order=200 - Index used to define the order of execution */
  35866. order: 200,
  35867. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35868. enabled: true,
  35869. /** @prop {ModifierFn} */
  35870. fn: offset,
  35871. /** @prop {Number|String} offset=0
  35872. * The offset value as described in the modifier description
  35873. */
  35874. offset: 0
  35875. },
  35876. /**
  35877. * Modifier used to prevent the popper from being positioned outside the boundary.
  35878. *
  35879. * A scenario exists where the reference itself is not within the boundaries.<br />
  35880. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  35881. * In this case we need to decide whether the popper should either:
  35882. *
  35883. * - detach from the reference and remain "trapped" in the boundaries, or
  35884. * - if it should ignore the boundary and "escape with its reference"
  35885. *
  35886. * When `escapeWithReference` is set to`true` and reference is completely
  35887. * outside its boundaries, the popper will overflow (or completely leave)
  35888. * the boundaries in order to remain attached to the edge of the reference.
  35889. *
  35890. * @memberof modifiers
  35891. * @inner
  35892. */
  35893. preventOverflow: {
  35894. /** @prop {number} order=300 - Index used to define the order of execution */
  35895. order: 300,
  35896. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35897. enabled: true,
  35898. /** @prop {ModifierFn} */
  35899. fn: preventOverflow,
  35900. /**
  35901. * @prop {Array} [priority=['left','right','top','bottom']]
  35902. * Popper will try to prevent overflow following these priorities by default,
  35903. * then, it could overflow on the left and on top of the `boundariesElement`
  35904. */
  35905. priority: ['left', 'right', 'top', 'bottom'],
  35906. /**
  35907. * @prop {number} padding=5
  35908. * Amount of pixel used to define a minimum distance between the boundaries
  35909. * and the popper. This makes sure the popper always has a little padding
  35910. * between the edges of its container
  35911. */
  35912. padding: 5,
  35913. /**
  35914. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  35915. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  35916. * `viewport` or any DOM element.
  35917. */
  35918. boundariesElement: 'scrollParent'
  35919. },
  35920. /**
  35921. * Modifier used to make sure the reference and its popper stay near each other
  35922. * without leaving any gap between the two. Especially useful when the arrow is
  35923. * enabled and you want to ensure that it points to its reference element.
  35924. * It cares only about the first axis. You can still have poppers with margin
  35925. * between the popper and its reference element.
  35926. * @memberof modifiers
  35927. * @inner
  35928. */
  35929. keepTogether: {
  35930. /** @prop {number} order=400 - Index used to define the order of execution */
  35931. order: 400,
  35932. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35933. enabled: true,
  35934. /** @prop {ModifierFn} */
  35935. fn: keepTogether
  35936. },
  35937. /**
  35938. * This modifier is used to move the `arrowElement` of the popper to make
  35939. * sure it is positioned between the reference element and its popper element.
  35940. * It will read the outer size of the `arrowElement` node to detect how many
  35941. * pixels of conjunction are needed.
  35942. *
  35943. * It has no effect if no `arrowElement` is provided.
  35944. * @memberof modifiers
  35945. * @inner
  35946. */
  35947. arrow: {
  35948. /** @prop {number} order=500 - Index used to define the order of execution */
  35949. order: 500,
  35950. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35951. enabled: true,
  35952. /** @prop {ModifierFn} */
  35953. fn: arrow,
  35954. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  35955. element: '[x-arrow]'
  35956. },
  35957. /**
  35958. * Modifier used to flip the popper's placement when it starts to overlap its
  35959. * reference element.
  35960. *
  35961. * Requires the `preventOverflow` modifier before it in order to work.
  35962. *
  35963. * **NOTE:** this modifier will interrupt the current update cycle and will
  35964. * restart it if it detects the need to flip the placement.
  35965. * @memberof modifiers
  35966. * @inner
  35967. */
  35968. flip: {
  35969. /** @prop {number} order=600 - Index used to define the order of execution */
  35970. order: 600,
  35971. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35972. enabled: true,
  35973. /** @prop {ModifierFn} */
  35974. fn: flip,
  35975. /**
  35976. * @prop {String|Array} behavior='flip'
  35977. * The behavior used to change the popper's placement. It can be one of
  35978. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  35979. * placements (with optional variations)
  35980. */
  35981. behavior: 'flip',
  35982. /**
  35983. * @prop {number} padding=5
  35984. * The popper will flip if it hits the edges of the `boundariesElement`
  35985. */
  35986. padding: 5,
  35987. /**
  35988. * @prop {String|HTMLElement} boundariesElement='viewport'
  35989. * The element which will define the boundaries of the popper position.
  35990. * The popper will never be placed outside of the defined boundaries
  35991. * (except if `keepTogether` is enabled)
  35992. */
  35993. boundariesElement: 'viewport',
  35994. /**
  35995. * @prop {Boolean} flipVariations=false
  35996. * The popper will switch placement variation between `-start` and `-end` when
  35997. * the reference element overlaps its boundaries.
  35998. *
  35999. * The original placement should have a set variation.
  36000. */
  36001. flipVariations: false,
  36002. /**
  36003. * @prop {Boolean} flipVariationsByContent=false
  36004. * The popper will switch placement variation between `-start` and `-end` when
  36005. * the popper element overlaps its reference boundaries.
  36006. *
  36007. * The original placement should have a set variation.
  36008. */
  36009. flipVariationsByContent: false
  36010. },
  36011. /**
  36012. * Modifier used to make the popper flow toward the inner of the reference element.
  36013. * By default, when this modifier is disabled, the popper will be placed outside
  36014. * the reference element.
  36015. * @memberof modifiers
  36016. * @inner
  36017. */
  36018. inner: {
  36019. /** @prop {number} order=700 - Index used to define the order of execution */
  36020. order: 700,
  36021. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36022. enabled: false,
  36023. /** @prop {ModifierFn} */
  36024. fn: inner
  36025. },
  36026. /**
  36027. * Modifier used to hide the popper when its reference element is outside of the
  36028. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36029. * be used to hide with a CSS selector the popper when its reference is
  36030. * out of boundaries.
  36031. *
  36032. * Requires the `preventOverflow` modifier before it in order to work.
  36033. * @memberof modifiers
  36034. * @inner
  36035. */
  36036. hide: {
  36037. /** @prop {number} order=800 - Index used to define the order of execution */
  36038. order: 800,
  36039. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36040. enabled: true,
  36041. /** @prop {ModifierFn} */
  36042. fn: hide
  36043. },
  36044. /**
  36045. * Computes the style that will be applied to the popper element to gets
  36046. * properly positioned.
  36047. *
  36048. * Note that this modifier will not touch the DOM, it just prepares the styles
  36049. * so that `applyStyle` modifier can apply it. This separation is useful
  36050. * in case you need to replace `applyStyle` with a custom implementation.
  36051. *
  36052. * This modifier has `850` as `order` value to maintain backward compatibility
  36053. * with previous versions of Popper.js. Expect the modifiers ordering method
  36054. * to change in future major versions of the library.
  36055. *
  36056. * @memberof modifiers
  36057. * @inner
  36058. */
  36059. computeStyle: {
  36060. /** @prop {number} order=850 - Index used to define the order of execution */
  36061. order: 850,
  36062. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36063. enabled: true,
  36064. /** @prop {ModifierFn} */
  36065. fn: computeStyle,
  36066. /**
  36067. * @prop {Boolean} gpuAcceleration=true
  36068. * If true, it uses the CSS 3D transformation to position the popper.
  36069. * Otherwise, it will use the `top` and `left` properties
  36070. */
  36071. gpuAcceleration: true,
  36072. /**
  36073. * @prop {string} [x='bottom']
  36074. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36075. * Change this if your popper should grow in a direction different from `bottom`
  36076. */
  36077. x: 'bottom',
  36078. /**
  36079. * @prop {string} [x='left']
  36080. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36081. * Change this if your popper should grow in a direction different from `right`
  36082. */
  36083. y: 'right'
  36084. },
  36085. /**
  36086. * Applies the computed styles to the popper element.
  36087. *
  36088. * All the DOM manipulations are limited to this modifier. This is useful in case
  36089. * you want to integrate Popper.js inside a framework or view library and you
  36090. * want to delegate all the DOM manipulations to it.
  36091. *
  36092. * Note that if you disable this modifier, you must make sure the popper element
  36093. * has its position set to `absolute` before Popper.js can do its work!
  36094. *
  36095. * Just disable this modifier and define your own to achieve the desired effect.
  36096. *
  36097. * @memberof modifiers
  36098. * @inner
  36099. */
  36100. applyStyle: {
  36101. /** @prop {number} order=900 - Index used to define the order of execution */
  36102. order: 900,
  36103. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36104. enabled: true,
  36105. /** @prop {ModifierFn} */
  36106. fn: applyStyle,
  36107. /** @prop {Function} */
  36108. onLoad: applyStyleOnLoad,
  36109. /**
  36110. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36111. * @prop {Boolean} gpuAcceleration=true
  36112. * If true, it uses the CSS 3D transformation to position the popper.
  36113. * Otherwise, it will use the `top` and `left` properties
  36114. */
  36115. gpuAcceleration: undefined
  36116. }
  36117. };
  36118. /**
  36119. * The `dataObject` is an object containing all the information used by Popper.js.
  36120. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36121. * @name dataObject
  36122. * @property {Object} data.instance The Popper.js instance
  36123. * @property {String} data.placement Placement applied to popper
  36124. * @property {String} data.originalPlacement Placement originally defined on init
  36125. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36126. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36127. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36128. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36129. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36130. * @property {Object} data.boundaries Offsets of the popper boundaries
  36131. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36132. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36133. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36134. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36135. */
  36136. /**
  36137. * Default options provided to Popper.js constructor.<br />
  36138. * These can be overridden using the `options` argument of Popper.js.<br />
  36139. * To override an option, simply pass an object with the same
  36140. * structure of the `options` object, as the 3rd argument. For example:
  36141. * ```
  36142. * new Popper(ref, pop, {
  36143. * modifiers: {
  36144. * preventOverflow: { enabled: false }
  36145. * }
  36146. * })
  36147. * ```
  36148. * @type {Object}
  36149. * @static
  36150. * @memberof Popper
  36151. */
  36152. var Defaults = {
  36153. /**
  36154. * Popper's placement.
  36155. * @prop {Popper.placements} placement='bottom'
  36156. */
  36157. placement: 'bottom',
  36158. /**
  36159. * Set this to true if you want popper to position it self in 'fixed' mode
  36160. * @prop {Boolean} positionFixed=false
  36161. */
  36162. positionFixed: false,
  36163. /**
  36164. * Whether events (resize, scroll) are initially enabled.
  36165. * @prop {Boolean} eventsEnabled=true
  36166. */
  36167. eventsEnabled: true,
  36168. /**
  36169. * Set to true if you want to automatically remove the popper when
  36170. * you call the `destroy` method.
  36171. * @prop {Boolean} removeOnDestroy=false
  36172. */
  36173. removeOnDestroy: false,
  36174. /**
  36175. * Callback called when the popper is created.<br />
  36176. * By default, it is set to no-op.<br />
  36177. * Access Popper.js instance with `data.instance`.
  36178. * @prop {onCreate}
  36179. */
  36180. onCreate: function onCreate() {},
  36181. /**
  36182. * Callback called when the popper is updated. This callback is not called
  36183. * on the initialization/creation of the popper, but only on subsequent
  36184. * updates.<br />
  36185. * By default, it is set to no-op.<br />
  36186. * Access Popper.js instance with `data.instance`.
  36187. * @prop {onUpdate}
  36188. */
  36189. onUpdate: function onUpdate() {},
  36190. /**
  36191. * List of modifiers used to modify the offsets before they are applied to the popper.
  36192. * They provide most of the functionalities of Popper.js.
  36193. * @prop {modifiers}
  36194. */
  36195. modifiers: modifiers
  36196. };
  36197. /**
  36198. * @callback onCreate
  36199. * @param {dataObject} data
  36200. */
  36201. /**
  36202. * @callback onUpdate
  36203. * @param {dataObject} data
  36204. */
  36205. // Utils
  36206. // Methods
  36207. var Popper = function () {
  36208. /**
  36209. * Creates a new Popper.js instance.
  36210. * @class Popper
  36211. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36212. * @param {Element} popper - The HTML / XML element used as the popper
  36213. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36214. * @return {Object} instance - The generated Popper.js instance
  36215. */
  36216. function Popper(reference, popper) {
  36217. var _this = this;
  36218. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36219. classCallCheck(this, Popper);
  36220. this.scheduleUpdate = function () {
  36221. return requestAnimationFrame(_this.update);
  36222. };
  36223. // make update() debounced, so that it only runs at most once-per-tick
  36224. this.update = debounce(this.update.bind(this));
  36225. // with {} we create a new object with the options inside it
  36226. this.options = _extends({}, Popper.Defaults, options);
  36227. // init state
  36228. this.state = {
  36229. isDestroyed: false,
  36230. isCreated: false,
  36231. scrollParents: []
  36232. };
  36233. // get reference and popper elements (allow jQuery wrappers)
  36234. this.reference = reference && reference.jquery ? reference[0] : reference;
  36235. this.popper = popper && popper.jquery ? popper[0] : popper;
  36236. // Deep merge modifiers options
  36237. this.options.modifiers = {};
  36238. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36239. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36240. });
  36241. // Refactoring modifiers' list (Object => Array)
  36242. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36243. return _extends({
  36244. name: name
  36245. }, _this.options.modifiers[name]);
  36246. })
  36247. // sort the modifiers by order
  36248. .sort(function (a, b) {
  36249. return a.order - b.order;
  36250. });
  36251. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36252. // such code is executed in the same order of its modifier
  36253. // they could add new properties to their options configuration
  36254. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36255. this.modifiers.forEach(function (modifierOptions) {
  36256. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36257. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36258. }
  36259. });
  36260. // fire the first update to position the popper in the right place
  36261. this.update();
  36262. var eventsEnabled = this.options.eventsEnabled;
  36263. if (eventsEnabled) {
  36264. // setup event listeners, they will take care of update the position in specific situations
  36265. this.enableEventListeners();
  36266. }
  36267. this.state.eventsEnabled = eventsEnabled;
  36268. }
  36269. // We can't use class properties because they don't get listed in the
  36270. // class prototype and break stuff like Sinon stubs
  36271. createClass(Popper, [{
  36272. key: 'update',
  36273. value: function update$$1() {
  36274. return update.call(this);
  36275. }
  36276. }, {
  36277. key: 'destroy',
  36278. value: function destroy$$1() {
  36279. return destroy.call(this);
  36280. }
  36281. }, {
  36282. key: 'enableEventListeners',
  36283. value: function enableEventListeners$$1() {
  36284. return enableEventListeners.call(this);
  36285. }
  36286. }, {
  36287. key: 'disableEventListeners',
  36288. value: function disableEventListeners$$1() {
  36289. return disableEventListeners.call(this);
  36290. }
  36291. /**
  36292. * Schedules an update. It will run on the next UI update available.
  36293. * @method scheduleUpdate
  36294. * @memberof Popper
  36295. */
  36296. /**
  36297. * Collection of utilities useful when writing custom modifiers.
  36298. * Starting from version 1.7, this method is available only if you
  36299. * include `popper-utils.js` before `popper.js`.
  36300. *
  36301. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36302. * and will be removed in v2! Use the PopperUtils module directly instead.
  36303. * Due to the high instability of the methods contained in Utils, we can't
  36304. * guarantee them to follow semver. Use them at your own risk!
  36305. * @static
  36306. * @private
  36307. * @type {Object}
  36308. * @deprecated since version 1.8
  36309. * @member Utils
  36310. * @memberof Popper
  36311. */
  36312. }]);
  36313. return Popper;
  36314. }();
  36315. /**
  36316. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36317. * and lets you use it as replacement of a real DOM node.<br />
  36318. * You can use this method to position a popper relatively to a set of coordinates
  36319. * in case you don't have a DOM node to use as reference.
  36320. *
  36321. * ```
  36322. * new Popper(referenceObject, popperNode);
  36323. * ```
  36324. *
  36325. * NB: This feature isn't supported in Internet Explorer 10.
  36326. * @name referenceObject
  36327. * @property {Function} data.getBoundingClientRect
  36328. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36329. * @property {number} data.clientWidth
  36330. * An ES6 getter that will return the width of the virtual reference element.
  36331. * @property {number} data.clientHeight
  36332. * An ES6 getter that will return the height of the virtual reference element.
  36333. */
  36334. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36335. Popper.placements = placements;
  36336. Popper.Defaults = Defaults;
  36337. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36338. //# sourceMappingURL=popper.js.map
  36339. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36340. /***/ }),
  36341. /***/ "./node_modules/process/browser.js":
  36342. /*!*****************************************!*\
  36343. !*** ./node_modules/process/browser.js ***!
  36344. \*****************************************/
  36345. /*! no static exports found */
  36346. /***/ (function(module, exports) {
  36347. // shim for using process in browser
  36348. var process = module.exports = {};
  36349. // cached from whatever global is present so that test runners that stub it
  36350. // don't break things. But we need to wrap it in a try catch in case it is
  36351. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36352. // function because try/catches deoptimize in certain engines.
  36353. var cachedSetTimeout;
  36354. var cachedClearTimeout;
  36355. function defaultSetTimout() {
  36356. throw new Error('setTimeout has not been defined');
  36357. }
  36358. function defaultClearTimeout () {
  36359. throw new Error('clearTimeout has not been defined');
  36360. }
  36361. (function () {
  36362. try {
  36363. if (typeof setTimeout === 'function') {
  36364. cachedSetTimeout = setTimeout;
  36365. } else {
  36366. cachedSetTimeout = defaultSetTimout;
  36367. }
  36368. } catch (e) {
  36369. cachedSetTimeout = defaultSetTimout;
  36370. }
  36371. try {
  36372. if (typeof clearTimeout === 'function') {
  36373. cachedClearTimeout = clearTimeout;
  36374. } else {
  36375. cachedClearTimeout = defaultClearTimeout;
  36376. }
  36377. } catch (e) {
  36378. cachedClearTimeout = defaultClearTimeout;
  36379. }
  36380. } ())
  36381. function runTimeout(fun) {
  36382. if (cachedSetTimeout === setTimeout) {
  36383. //normal enviroments in sane situations
  36384. return setTimeout(fun, 0);
  36385. }
  36386. // if setTimeout wasn't available but was latter defined
  36387. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36388. cachedSetTimeout = setTimeout;
  36389. return setTimeout(fun, 0);
  36390. }
  36391. try {
  36392. // when when somebody has screwed with setTimeout but no I.E. maddness
  36393. return cachedSetTimeout(fun, 0);
  36394. } catch(e){
  36395. try {
  36396. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36397. return cachedSetTimeout.call(null, fun, 0);
  36398. } catch(e){
  36399. // 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
  36400. return cachedSetTimeout.call(this, fun, 0);
  36401. }
  36402. }
  36403. }
  36404. function runClearTimeout(marker) {
  36405. if (cachedClearTimeout === clearTimeout) {
  36406. //normal enviroments in sane situations
  36407. return clearTimeout(marker);
  36408. }
  36409. // if clearTimeout wasn't available but was latter defined
  36410. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36411. cachedClearTimeout = clearTimeout;
  36412. return clearTimeout(marker);
  36413. }
  36414. try {
  36415. // when when somebody has screwed with setTimeout but no I.E. maddness
  36416. return cachedClearTimeout(marker);
  36417. } catch (e){
  36418. try {
  36419. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36420. return cachedClearTimeout.call(null, marker);
  36421. } catch (e){
  36422. // 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.
  36423. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36424. return cachedClearTimeout.call(this, marker);
  36425. }
  36426. }
  36427. }
  36428. var queue = [];
  36429. var draining = false;
  36430. var currentQueue;
  36431. var queueIndex = -1;
  36432. function cleanUpNextTick() {
  36433. if (!draining || !currentQueue) {
  36434. return;
  36435. }
  36436. draining = false;
  36437. if (currentQueue.length) {
  36438. queue = currentQueue.concat(queue);
  36439. } else {
  36440. queueIndex = -1;
  36441. }
  36442. if (queue.length) {
  36443. drainQueue();
  36444. }
  36445. }
  36446. function drainQueue() {
  36447. if (draining) {
  36448. return;
  36449. }
  36450. var timeout = runTimeout(cleanUpNextTick);
  36451. draining = true;
  36452. var len = queue.length;
  36453. while(len) {
  36454. currentQueue = queue;
  36455. queue = [];
  36456. while (++queueIndex < len) {
  36457. if (currentQueue) {
  36458. currentQueue[queueIndex].run();
  36459. }
  36460. }
  36461. queueIndex = -1;
  36462. len = queue.length;
  36463. }
  36464. currentQueue = null;
  36465. draining = false;
  36466. runClearTimeout(timeout);
  36467. }
  36468. process.nextTick = function (fun) {
  36469. var args = new Array(arguments.length - 1);
  36470. if (arguments.length > 1) {
  36471. for (var i = 1; i < arguments.length; i++) {
  36472. args[i - 1] = arguments[i];
  36473. }
  36474. }
  36475. queue.push(new Item(fun, args));
  36476. if (queue.length === 1 && !draining) {
  36477. runTimeout(drainQueue);
  36478. }
  36479. };
  36480. // v8 likes predictible objects
  36481. function Item(fun, array) {
  36482. this.fun = fun;
  36483. this.array = array;
  36484. }
  36485. Item.prototype.run = function () {
  36486. this.fun.apply(null, this.array);
  36487. };
  36488. process.title = 'browser';
  36489. process.browser = true;
  36490. process.env = {};
  36491. process.argv = [];
  36492. process.version = ''; // empty string to avoid regexp issues
  36493. process.versions = {};
  36494. function noop() {}
  36495. process.on = noop;
  36496. process.addListener = noop;
  36497. process.once = noop;
  36498. process.off = noop;
  36499. process.removeListener = noop;
  36500. process.removeAllListeners = noop;
  36501. process.emit = noop;
  36502. process.prependListener = noop;
  36503. process.prependOnceListener = noop;
  36504. process.listeners = function (name) { return [] }
  36505. process.binding = function (name) {
  36506. throw new Error('process.binding is not supported');
  36507. };
  36508. process.cwd = function () { return '/' };
  36509. process.chdir = function (dir) {
  36510. throw new Error('process.chdir is not supported');
  36511. };
  36512. process.umask = function() { return 0; };
  36513. /***/ }),
  36514. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36515. /*!***************************************************!*\
  36516. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36517. \***************************************************/
  36518. /*! no static exports found */
  36519. /***/ (function(module, exports, __webpack_require__) {
  36520. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36521. * Pusher JavaScript Library v5.0.3
  36522. * https://pusher.com/
  36523. *
  36524. * Copyright 2017, Pusher
  36525. * Released under the MIT licence.
  36526. */
  36527. (function webpackUniversalModuleDefinition(root, factory) {
  36528. if(true)
  36529. module.exports = factory();
  36530. else {}
  36531. })(window, function() {
  36532. return /******/ (function(modules) { // webpackBootstrap
  36533. /******/ // The module cache
  36534. /******/ var installedModules = {};
  36535. /******/
  36536. /******/ // The require function
  36537. /******/ function __webpack_require__(moduleId) {
  36538. /******/
  36539. /******/ // Check if module is in cache
  36540. /******/ if(installedModules[moduleId]) {
  36541. /******/ return installedModules[moduleId].exports;
  36542. /******/ }
  36543. /******/ // Create a new module (and put it into the cache)
  36544. /******/ var module = installedModules[moduleId] = {
  36545. /******/ i: moduleId,
  36546. /******/ l: false,
  36547. /******/ exports: {}
  36548. /******/ };
  36549. /******/
  36550. /******/ // Execute the module function
  36551. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36552. /******/
  36553. /******/ // Flag the module as loaded
  36554. /******/ module.l = true;
  36555. /******/
  36556. /******/ // Return the exports of the module
  36557. /******/ return module.exports;
  36558. /******/ }
  36559. /******/
  36560. /******/
  36561. /******/ // expose the modules object (__webpack_modules__)
  36562. /******/ __webpack_require__.m = modules;
  36563. /******/
  36564. /******/ // expose the module cache
  36565. /******/ __webpack_require__.c = installedModules;
  36566. /******/
  36567. /******/ // define getter function for harmony exports
  36568. /******/ __webpack_require__.d = function(exports, name, getter) {
  36569. /******/ if(!__webpack_require__.o(exports, name)) {
  36570. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36571. /******/ }
  36572. /******/ };
  36573. /******/
  36574. /******/ // define __esModule on exports
  36575. /******/ __webpack_require__.r = function(exports) {
  36576. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36577. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36578. /******/ }
  36579. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36580. /******/ };
  36581. /******/
  36582. /******/ // create a fake namespace object
  36583. /******/ // mode & 1: value is a module id, require it
  36584. /******/ // mode & 2: merge all properties of value into the ns
  36585. /******/ // mode & 4: return value when already ns object
  36586. /******/ // mode & 8|1: behave like require
  36587. /******/ __webpack_require__.t = function(value, mode) {
  36588. /******/ if(mode & 1) value = __webpack_require__(value);
  36589. /******/ if(mode & 8) return value;
  36590. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36591. /******/ var ns = Object.create(null);
  36592. /******/ __webpack_require__.r(ns);
  36593. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36594. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36595. /******/ return ns;
  36596. /******/ };
  36597. /******/
  36598. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36599. /******/ __webpack_require__.n = function(module) {
  36600. /******/ var getter = module && module.__esModule ?
  36601. /******/ function getDefault() { return module['default']; } :
  36602. /******/ function getModuleExports() { return module; };
  36603. /******/ __webpack_require__.d(getter, 'a', getter);
  36604. /******/ return getter;
  36605. /******/ };
  36606. /******/
  36607. /******/ // Object.prototype.hasOwnProperty.call
  36608. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36609. /******/
  36610. /******/ // __webpack_public_path__
  36611. /******/ __webpack_require__.p = "";
  36612. /******/
  36613. /******/
  36614. /******/ // Load entry module and return exports
  36615. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36616. /******/ })
  36617. /************************************************************************/
  36618. /******/ ([
  36619. /* 0 */
  36620. /***/ (function(module, exports, __webpack_require__) {
  36621. (function(nacl) {
  36622. 'use strict';
  36623. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36624. // Public domain.
  36625. //
  36626. // Implementation derived from TweetNaCl version 20140427.
  36627. // See for details: http://tweetnacl.cr.yp.to/
  36628. var gf = function(init) {
  36629. var i, r = new Float64Array(16);
  36630. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36631. return r;
  36632. };
  36633. // Pluggable, initialized in high-level API below.
  36634. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36635. var _0 = new Uint8Array(16);
  36636. var _9 = new Uint8Array(32); _9[0] = 9;
  36637. var gf0 = gf(),
  36638. gf1 = gf([1]),
  36639. _121665 = gf([0xdb41, 1]),
  36640. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36641. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36642. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36643. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36644. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36645. function ts64(x, i, h, l) {
  36646. x[i] = (h >> 24) & 0xff;
  36647. x[i+1] = (h >> 16) & 0xff;
  36648. x[i+2] = (h >> 8) & 0xff;
  36649. x[i+3] = h & 0xff;
  36650. x[i+4] = (l >> 24) & 0xff;
  36651. x[i+5] = (l >> 16) & 0xff;
  36652. x[i+6] = (l >> 8) & 0xff;
  36653. x[i+7] = l & 0xff;
  36654. }
  36655. function vn(x, xi, y, yi, n) {
  36656. var i,d = 0;
  36657. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36658. return (1 & ((d - 1) >>> 8)) - 1;
  36659. }
  36660. function crypto_verify_16(x, xi, y, yi) {
  36661. return vn(x,xi,y,yi,16);
  36662. }
  36663. function crypto_verify_32(x, xi, y, yi) {
  36664. return vn(x,xi,y,yi,32);
  36665. }
  36666. function core_salsa20(o, p, k, c) {
  36667. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36668. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36669. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36670. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36671. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36672. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36673. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36674. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36675. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36676. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36677. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36678. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36679. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36680. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36681. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36682. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36683. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36684. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36685. x15 = j15, u;
  36686. for (var i = 0; i < 20; i += 2) {
  36687. u = x0 + x12 | 0;
  36688. x4 ^= u<<7 | u>>>(32-7);
  36689. u = x4 + x0 | 0;
  36690. x8 ^= u<<9 | u>>>(32-9);
  36691. u = x8 + x4 | 0;
  36692. x12 ^= u<<13 | u>>>(32-13);
  36693. u = x12 + x8 | 0;
  36694. x0 ^= u<<18 | u>>>(32-18);
  36695. u = x5 + x1 | 0;
  36696. x9 ^= u<<7 | u>>>(32-7);
  36697. u = x9 + x5 | 0;
  36698. x13 ^= u<<9 | u>>>(32-9);
  36699. u = x13 + x9 | 0;
  36700. x1 ^= u<<13 | u>>>(32-13);
  36701. u = x1 + x13 | 0;
  36702. x5 ^= u<<18 | u>>>(32-18);
  36703. u = x10 + x6 | 0;
  36704. x14 ^= u<<7 | u>>>(32-7);
  36705. u = x14 + x10 | 0;
  36706. x2 ^= u<<9 | u>>>(32-9);
  36707. u = x2 + x14 | 0;
  36708. x6 ^= u<<13 | u>>>(32-13);
  36709. u = x6 + x2 | 0;
  36710. x10 ^= u<<18 | u>>>(32-18);
  36711. u = x15 + x11 | 0;
  36712. x3 ^= u<<7 | u>>>(32-7);
  36713. u = x3 + x15 | 0;
  36714. x7 ^= u<<9 | u>>>(32-9);
  36715. u = x7 + x3 | 0;
  36716. x11 ^= u<<13 | u>>>(32-13);
  36717. u = x11 + x7 | 0;
  36718. x15 ^= u<<18 | u>>>(32-18);
  36719. u = x0 + x3 | 0;
  36720. x1 ^= u<<7 | u>>>(32-7);
  36721. u = x1 + x0 | 0;
  36722. x2 ^= u<<9 | u>>>(32-9);
  36723. u = x2 + x1 | 0;
  36724. x3 ^= u<<13 | u>>>(32-13);
  36725. u = x3 + x2 | 0;
  36726. x0 ^= u<<18 | u>>>(32-18);
  36727. u = x5 + x4 | 0;
  36728. x6 ^= u<<7 | u>>>(32-7);
  36729. u = x6 + x5 | 0;
  36730. x7 ^= u<<9 | u>>>(32-9);
  36731. u = x7 + x6 | 0;
  36732. x4 ^= u<<13 | u>>>(32-13);
  36733. u = x4 + x7 | 0;
  36734. x5 ^= u<<18 | u>>>(32-18);
  36735. u = x10 + x9 | 0;
  36736. x11 ^= u<<7 | u>>>(32-7);
  36737. u = x11 + x10 | 0;
  36738. x8 ^= u<<9 | u>>>(32-9);
  36739. u = x8 + x11 | 0;
  36740. x9 ^= u<<13 | u>>>(32-13);
  36741. u = x9 + x8 | 0;
  36742. x10 ^= u<<18 | u>>>(32-18);
  36743. u = x15 + x14 | 0;
  36744. x12 ^= u<<7 | u>>>(32-7);
  36745. u = x12 + x15 | 0;
  36746. x13 ^= u<<9 | u>>>(32-9);
  36747. u = x13 + x12 | 0;
  36748. x14 ^= u<<13 | u>>>(32-13);
  36749. u = x14 + x13 | 0;
  36750. x15 ^= u<<18 | u>>>(32-18);
  36751. }
  36752. x0 = x0 + j0 | 0;
  36753. x1 = x1 + j1 | 0;
  36754. x2 = x2 + j2 | 0;
  36755. x3 = x3 + j3 | 0;
  36756. x4 = x4 + j4 | 0;
  36757. x5 = x5 + j5 | 0;
  36758. x6 = x6 + j6 | 0;
  36759. x7 = x7 + j7 | 0;
  36760. x8 = x8 + j8 | 0;
  36761. x9 = x9 + j9 | 0;
  36762. x10 = x10 + j10 | 0;
  36763. x11 = x11 + j11 | 0;
  36764. x12 = x12 + j12 | 0;
  36765. x13 = x13 + j13 | 0;
  36766. x14 = x14 + j14 | 0;
  36767. x15 = x15 + j15 | 0;
  36768. o[ 0] = x0 >>> 0 & 0xff;
  36769. o[ 1] = x0 >>> 8 & 0xff;
  36770. o[ 2] = x0 >>> 16 & 0xff;
  36771. o[ 3] = x0 >>> 24 & 0xff;
  36772. o[ 4] = x1 >>> 0 & 0xff;
  36773. o[ 5] = x1 >>> 8 & 0xff;
  36774. o[ 6] = x1 >>> 16 & 0xff;
  36775. o[ 7] = x1 >>> 24 & 0xff;
  36776. o[ 8] = x2 >>> 0 & 0xff;
  36777. o[ 9] = x2 >>> 8 & 0xff;
  36778. o[10] = x2 >>> 16 & 0xff;
  36779. o[11] = x2 >>> 24 & 0xff;
  36780. o[12] = x3 >>> 0 & 0xff;
  36781. o[13] = x3 >>> 8 & 0xff;
  36782. o[14] = x3 >>> 16 & 0xff;
  36783. o[15] = x3 >>> 24 & 0xff;
  36784. o[16] = x4 >>> 0 & 0xff;
  36785. o[17] = x4 >>> 8 & 0xff;
  36786. o[18] = x4 >>> 16 & 0xff;
  36787. o[19] = x4 >>> 24 & 0xff;
  36788. o[20] = x5 >>> 0 & 0xff;
  36789. o[21] = x5 >>> 8 & 0xff;
  36790. o[22] = x5 >>> 16 & 0xff;
  36791. o[23] = x5 >>> 24 & 0xff;
  36792. o[24] = x6 >>> 0 & 0xff;
  36793. o[25] = x6 >>> 8 & 0xff;
  36794. o[26] = x6 >>> 16 & 0xff;
  36795. o[27] = x6 >>> 24 & 0xff;
  36796. o[28] = x7 >>> 0 & 0xff;
  36797. o[29] = x7 >>> 8 & 0xff;
  36798. o[30] = x7 >>> 16 & 0xff;
  36799. o[31] = x7 >>> 24 & 0xff;
  36800. o[32] = x8 >>> 0 & 0xff;
  36801. o[33] = x8 >>> 8 & 0xff;
  36802. o[34] = x8 >>> 16 & 0xff;
  36803. o[35] = x8 >>> 24 & 0xff;
  36804. o[36] = x9 >>> 0 & 0xff;
  36805. o[37] = x9 >>> 8 & 0xff;
  36806. o[38] = x9 >>> 16 & 0xff;
  36807. o[39] = x9 >>> 24 & 0xff;
  36808. o[40] = x10 >>> 0 & 0xff;
  36809. o[41] = x10 >>> 8 & 0xff;
  36810. o[42] = x10 >>> 16 & 0xff;
  36811. o[43] = x10 >>> 24 & 0xff;
  36812. o[44] = x11 >>> 0 & 0xff;
  36813. o[45] = x11 >>> 8 & 0xff;
  36814. o[46] = x11 >>> 16 & 0xff;
  36815. o[47] = x11 >>> 24 & 0xff;
  36816. o[48] = x12 >>> 0 & 0xff;
  36817. o[49] = x12 >>> 8 & 0xff;
  36818. o[50] = x12 >>> 16 & 0xff;
  36819. o[51] = x12 >>> 24 & 0xff;
  36820. o[52] = x13 >>> 0 & 0xff;
  36821. o[53] = x13 >>> 8 & 0xff;
  36822. o[54] = x13 >>> 16 & 0xff;
  36823. o[55] = x13 >>> 24 & 0xff;
  36824. o[56] = x14 >>> 0 & 0xff;
  36825. o[57] = x14 >>> 8 & 0xff;
  36826. o[58] = x14 >>> 16 & 0xff;
  36827. o[59] = x14 >>> 24 & 0xff;
  36828. o[60] = x15 >>> 0 & 0xff;
  36829. o[61] = x15 >>> 8 & 0xff;
  36830. o[62] = x15 >>> 16 & 0xff;
  36831. o[63] = x15 >>> 24 & 0xff;
  36832. }
  36833. function core_hsalsa20(o,p,k,c) {
  36834. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36835. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36836. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36837. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36838. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36839. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36840. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36841. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36842. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36843. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36844. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36845. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36846. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36847. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36848. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36849. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36850. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36851. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36852. x15 = j15, u;
  36853. for (var i = 0; i < 20; i += 2) {
  36854. u = x0 + x12 | 0;
  36855. x4 ^= u<<7 | u>>>(32-7);
  36856. u = x4 + x0 | 0;
  36857. x8 ^= u<<9 | u>>>(32-9);
  36858. u = x8 + x4 | 0;
  36859. x12 ^= u<<13 | u>>>(32-13);
  36860. u = x12 + x8 | 0;
  36861. x0 ^= u<<18 | u>>>(32-18);
  36862. u = x5 + x1 | 0;
  36863. x9 ^= u<<7 | u>>>(32-7);
  36864. u = x9 + x5 | 0;
  36865. x13 ^= u<<9 | u>>>(32-9);
  36866. u = x13 + x9 | 0;
  36867. x1 ^= u<<13 | u>>>(32-13);
  36868. u = x1 + x13 | 0;
  36869. x5 ^= u<<18 | u>>>(32-18);
  36870. u = x10 + x6 | 0;
  36871. x14 ^= u<<7 | u>>>(32-7);
  36872. u = x14 + x10 | 0;
  36873. x2 ^= u<<9 | u>>>(32-9);
  36874. u = x2 + x14 | 0;
  36875. x6 ^= u<<13 | u>>>(32-13);
  36876. u = x6 + x2 | 0;
  36877. x10 ^= u<<18 | u>>>(32-18);
  36878. u = x15 + x11 | 0;
  36879. x3 ^= u<<7 | u>>>(32-7);
  36880. u = x3 + x15 | 0;
  36881. x7 ^= u<<9 | u>>>(32-9);
  36882. u = x7 + x3 | 0;
  36883. x11 ^= u<<13 | u>>>(32-13);
  36884. u = x11 + x7 | 0;
  36885. x15 ^= u<<18 | u>>>(32-18);
  36886. u = x0 + x3 | 0;
  36887. x1 ^= u<<7 | u>>>(32-7);
  36888. u = x1 + x0 | 0;
  36889. x2 ^= u<<9 | u>>>(32-9);
  36890. u = x2 + x1 | 0;
  36891. x3 ^= u<<13 | u>>>(32-13);
  36892. u = x3 + x2 | 0;
  36893. x0 ^= u<<18 | u>>>(32-18);
  36894. u = x5 + x4 | 0;
  36895. x6 ^= u<<7 | u>>>(32-7);
  36896. u = x6 + x5 | 0;
  36897. x7 ^= u<<9 | u>>>(32-9);
  36898. u = x7 + x6 | 0;
  36899. x4 ^= u<<13 | u>>>(32-13);
  36900. u = x4 + x7 | 0;
  36901. x5 ^= u<<18 | u>>>(32-18);
  36902. u = x10 + x9 | 0;
  36903. x11 ^= u<<7 | u>>>(32-7);
  36904. u = x11 + x10 | 0;
  36905. x8 ^= u<<9 | u>>>(32-9);
  36906. u = x8 + x11 | 0;
  36907. x9 ^= u<<13 | u>>>(32-13);
  36908. u = x9 + x8 | 0;
  36909. x10 ^= u<<18 | u>>>(32-18);
  36910. u = x15 + x14 | 0;
  36911. x12 ^= u<<7 | u>>>(32-7);
  36912. u = x12 + x15 | 0;
  36913. x13 ^= u<<9 | u>>>(32-9);
  36914. u = x13 + x12 | 0;
  36915. x14 ^= u<<13 | u>>>(32-13);
  36916. u = x14 + x13 | 0;
  36917. x15 ^= u<<18 | u>>>(32-18);
  36918. }
  36919. o[ 0] = x0 >>> 0 & 0xff;
  36920. o[ 1] = x0 >>> 8 & 0xff;
  36921. o[ 2] = x0 >>> 16 & 0xff;
  36922. o[ 3] = x0 >>> 24 & 0xff;
  36923. o[ 4] = x5 >>> 0 & 0xff;
  36924. o[ 5] = x5 >>> 8 & 0xff;
  36925. o[ 6] = x5 >>> 16 & 0xff;
  36926. o[ 7] = x5 >>> 24 & 0xff;
  36927. o[ 8] = x10 >>> 0 & 0xff;
  36928. o[ 9] = x10 >>> 8 & 0xff;
  36929. o[10] = x10 >>> 16 & 0xff;
  36930. o[11] = x10 >>> 24 & 0xff;
  36931. o[12] = x15 >>> 0 & 0xff;
  36932. o[13] = x15 >>> 8 & 0xff;
  36933. o[14] = x15 >>> 16 & 0xff;
  36934. o[15] = x15 >>> 24 & 0xff;
  36935. o[16] = x6 >>> 0 & 0xff;
  36936. o[17] = x6 >>> 8 & 0xff;
  36937. o[18] = x6 >>> 16 & 0xff;
  36938. o[19] = x6 >>> 24 & 0xff;
  36939. o[20] = x7 >>> 0 & 0xff;
  36940. o[21] = x7 >>> 8 & 0xff;
  36941. o[22] = x7 >>> 16 & 0xff;
  36942. o[23] = x7 >>> 24 & 0xff;
  36943. o[24] = x8 >>> 0 & 0xff;
  36944. o[25] = x8 >>> 8 & 0xff;
  36945. o[26] = x8 >>> 16 & 0xff;
  36946. o[27] = x8 >>> 24 & 0xff;
  36947. o[28] = x9 >>> 0 & 0xff;
  36948. o[29] = x9 >>> 8 & 0xff;
  36949. o[30] = x9 >>> 16 & 0xff;
  36950. o[31] = x9 >>> 24 & 0xff;
  36951. }
  36952. function crypto_core_salsa20(out,inp,k,c) {
  36953. core_salsa20(out,inp,k,c);
  36954. }
  36955. function crypto_core_hsalsa20(out,inp,k,c) {
  36956. core_hsalsa20(out,inp,k,c);
  36957. }
  36958. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  36959. // "expand 32-byte k"
  36960. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  36961. var z = new Uint8Array(16), x = new Uint8Array(64);
  36962. var u, i;
  36963. for (i = 0; i < 16; i++) z[i] = 0;
  36964. for (i = 0; i < 8; i++) z[i] = n[i];
  36965. while (b >= 64) {
  36966. crypto_core_salsa20(x,z,k,sigma);
  36967. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36968. u = 1;
  36969. for (i = 8; i < 16; i++) {
  36970. u = u + (z[i] & 0xff) | 0;
  36971. z[i] = u & 0xff;
  36972. u >>>= 8;
  36973. }
  36974. b -= 64;
  36975. cpos += 64;
  36976. mpos += 64;
  36977. }
  36978. if (b > 0) {
  36979. crypto_core_salsa20(x,z,k,sigma);
  36980. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36981. }
  36982. return 0;
  36983. }
  36984. function crypto_stream_salsa20(c,cpos,b,n,k) {
  36985. var z = new Uint8Array(16), x = new Uint8Array(64);
  36986. var u, i;
  36987. for (i = 0; i < 16; i++) z[i] = 0;
  36988. for (i = 0; i < 8; i++) z[i] = n[i];
  36989. while (b >= 64) {
  36990. crypto_core_salsa20(x,z,k,sigma);
  36991. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  36992. u = 1;
  36993. for (i = 8; i < 16; i++) {
  36994. u = u + (z[i] & 0xff) | 0;
  36995. z[i] = u & 0xff;
  36996. u >>>= 8;
  36997. }
  36998. b -= 64;
  36999. cpos += 64;
  37000. }
  37001. if (b > 0) {
  37002. crypto_core_salsa20(x,z,k,sigma);
  37003. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37004. }
  37005. return 0;
  37006. }
  37007. function crypto_stream(c,cpos,d,n,k) {
  37008. var s = new Uint8Array(32);
  37009. crypto_core_hsalsa20(s,n,k,sigma);
  37010. var sn = new Uint8Array(8);
  37011. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37012. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37013. }
  37014. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37015. var s = new Uint8Array(32);
  37016. crypto_core_hsalsa20(s,n,k,sigma);
  37017. var sn = new Uint8Array(8);
  37018. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37019. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37020. }
  37021. /*
  37022. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37023. * https://github.com/floodyberry/poly1305-donna
  37024. */
  37025. var poly1305 = function(key) {
  37026. this.buffer = new Uint8Array(16);
  37027. this.r = new Uint16Array(10);
  37028. this.h = new Uint16Array(10);
  37029. this.pad = new Uint16Array(8);
  37030. this.leftover = 0;
  37031. this.fin = 0;
  37032. var t0, t1, t2, t3, t4, t5, t6, t7;
  37033. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37034. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37035. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37036. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37037. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37038. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37039. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37040. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37041. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37042. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37043. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37044. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37045. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37046. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37047. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37048. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37049. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37050. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37051. };
  37052. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37053. var hibit = this.fin ? 0 : (1 << 11);
  37054. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37055. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37056. var h0 = this.h[0],
  37057. h1 = this.h[1],
  37058. h2 = this.h[2],
  37059. h3 = this.h[3],
  37060. h4 = this.h[4],
  37061. h5 = this.h[5],
  37062. h6 = this.h[6],
  37063. h7 = this.h[7],
  37064. h8 = this.h[8],
  37065. h9 = this.h[9];
  37066. var r0 = this.r[0],
  37067. r1 = this.r[1],
  37068. r2 = this.r[2],
  37069. r3 = this.r[3],
  37070. r4 = this.r[4],
  37071. r5 = this.r[5],
  37072. r6 = this.r[6],
  37073. r7 = this.r[7],
  37074. r8 = this.r[8],
  37075. r9 = this.r[9];
  37076. while (bytes >= 16) {
  37077. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37078. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37079. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37080. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37081. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37082. h5 += ((t4 >>> 1)) & 0x1fff;
  37083. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37084. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37085. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37086. h9 += ((t7 >>> 5)) | hibit;
  37087. c = 0;
  37088. d0 = c;
  37089. d0 += h0 * r0;
  37090. d0 += h1 * (5 * r9);
  37091. d0 += h2 * (5 * r8);
  37092. d0 += h3 * (5 * r7);
  37093. d0 += h4 * (5 * r6);
  37094. c = (d0 >>> 13); d0 &= 0x1fff;
  37095. d0 += h5 * (5 * r5);
  37096. d0 += h6 * (5 * r4);
  37097. d0 += h7 * (5 * r3);
  37098. d0 += h8 * (5 * r2);
  37099. d0 += h9 * (5 * r1);
  37100. c += (d0 >>> 13); d0 &= 0x1fff;
  37101. d1 = c;
  37102. d1 += h0 * r1;
  37103. d1 += h1 * r0;
  37104. d1 += h2 * (5 * r9);
  37105. d1 += h3 * (5 * r8);
  37106. d1 += h4 * (5 * r7);
  37107. c = (d1 >>> 13); d1 &= 0x1fff;
  37108. d1 += h5 * (5 * r6);
  37109. d1 += h6 * (5 * r5);
  37110. d1 += h7 * (5 * r4);
  37111. d1 += h8 * (5 * r3);
  37112. d1 += h9 * (5 * r2);
  37113. c += (d1 >>> 13); d1 &= 0x1fff;
  37114. d2 = c;
  37115. d2 += h0 * r2;
  37116. d2 += h1 * r1;
  37117. d2 += h2 * r0;
  37118. d2 += h3 * (5 * r9);
  37119. d2 += h4 * (5 * r8);
  37120. c = (d2 >>> 13); d2 &= 0x1fff;
  37121. d2 += h5 * (5 * r7);
  37122. d2 += h6 * (5 * r6);
  37123. d2 += h7 * (5 * r5);
  37124. d2 += h8 * (5 * r4);
  37125. d2 += h9 * (5 * r3);
  37126. c += (d2 >>> 13); d2 &= 0x1fff;
  37127. d3 = c;
  37128. d3 += h0 * r3;
  37129. d3 += h1 * r2;
  37130. d3 += h2 * r1;
  37131. d3 += h3 * r0;
  37132. d3 += h4 * (5 * r9);
  37133. c = (d3 >>> 13); d3 &= 0x1fff;
  37134. d3 += h5 * (5 * r8);
  37135. d3 += h6 * (5 * r7);
  37136. d3 += h7 * (5 * r6);
  37137. d3 += h8 * (5 * r5);
  37138. d3 += h9 * (5 * r4);
  37139. c += (d3 >>> 13); d3 &= 0x1fff;
  37140. d4 = c;
  37141. d4 += h0 * r4;
  37142. d4 += h1 * r3;
  37143. d4 += h2 * r2;
  37144. d4 += h3 * r1;
  37145. d4 += h4 * r0;
  37146. c = (d4 >>> 13); d4 &= 0x1fff;
  37147. d4 += h5 * (5 * r9);
  37148. d4 += h6 * (5 * r8);
  37149. d4 += h7 * (5 * r7);
  37150. d4 += h8 * (5 * r6);
  37151. d4 += h9 * (5 * r5);
  37152. c += (d4 >>> 13); d4 &= 0x1fff;
  37153. d5 = c;
  37154. d5 += h0 * r5;
  37155. d5 += h1 * r4;
  37156. d5 += h2 * r3;
  37157. d5 += h3 * r2;
  37158. d5 += h4 * r1;
  37159. c = (d5 >>> 13); d5 &= 0x1fff;
  37160. d5 += h5 * r0;
  37161. d5 += h6 * (5 * r9);
  37162. d5 += h7 * (5 * r8);
  37163. d5 += h8 * (5 * r7);
  37164. d5 += h9 * (5 * r6);
  37165. c += (d5 >>> 13); d5 &= 0x1fff;
  37166. d6 = c;
  37167. d6 += h0 * r6;
  37168. d6 += h1 * r5;
  37169. d6 += h2 * r4;
  37170. d6 += h3 * r3;
  37171. d6 += h4 * r2;
  37172. c = (d6 >>> 13); d6 &= 0x1fff;
  37173. d6 += h5 * r1;
  37174. d6 += h6 * r0;
  37175. d6 += h7 * (5 * r9);
  37176. d6 += h8 * (5 * r8);
  37177. d6 += h9 * (5 * r7);
  37178. c += (d6 >>> 13); d6 &= 0x1fff;
  37179. d7 = c;
  37180. d7 += h0 * r7;
  37181. d7 += h1 * r6;
  37182. d7 += h2 * r5;
  37183. d7 += h3 * r4;
  37184. d7 += h4 * r3;
  37185. c = (d7 >>> 13); d7 &= 0x1fff;
  37186. d7 += h5 * r2;
  37187. d7 += h6 * r1;
  37188. d7 += h7 * r0;
  37189. d7 += h8 * (5 * r9);
  37190. d7 += h9 * (5 * r8);
  37191. c += (d7 >>> 13); d7 &= 0x1fff;
  37192. d8 = c;
  37193. d8 += h0 * r8;
  37194. d8 += h1 * r7;
  37195. d8 += h2 * r6;
  37196. d8 += h3 * r5;
  37197. d8 += h4 * r4;
  37198. c = (d8 >>> 13); d8 &= 0x1fff;
  37199. d8 += h5 * r3;
  37200. d8 += h6 * r2;
  37201. d8 += h7 * r1;
  37202. d8 += h8 * r0;
  37203. d8 += h9 * (5 * r9);
  37204. c += (d8 >>> 13); d8 &= 0x1fff;
  37205. d9 = c;
  37206. d9 += h0 * r9;
  37207. d9 += h1 * r8;
  37208. d9 += h2 * r7;
  37209. d9 += h3 * r6;
  37210. d9 += h4 * r5;
  37211. c = (d9 >>> 13); d9 &= 0x1fff;
  37212. d9 += h5 * r4;
  37213. d9 += h6 * r3;
  37214. d9 += h7 * r2;
  37215. d9 += h8 * r1;
  37216. d9 += h9 * r0;
  37217. c += (d9 >>> 13); d9 &= 0x1fff;
  37218. c = (((c << 2) + c)) | 0;
  37219. c = (c + d0) | 0;
  37220. d0 = c & 0x1fff;
  37221. c = (c >>> 13);
  37222. d1 += c;
  37223. h0 = d0;
  37224. h1 = d1;
  37225. h2 = d2;
  37226. h3 = d3;
  37227. h4 = d4;
  37228. h5 = d5;
  37229. h6 = d6;
  37230. h7 = d7;
  37231. h8 = d8;
  37232. h9 = d9;
  37233. mpos += 16;
  37234. bytes -= 16;
  37235. }
  37236. this.h[0] = h0;
  37237. this.h[1] = h1;
  37238. this.h[2] = h2;
  37239. this.h[3] = h3;
  37240. this.h[4] = h4;
  37241. this.h[5] = h5;
  37242. this.h[6] = h6;
  37243. this.h[7] = h7;
  37244. this.h[8] = h8;
  37245. this.h[9] = h9;
  37246. };
  37247. poly1305.prototype.finish = function(mac, macpos) {
  37248. var g = new Uint16Array(10);
  37249. var c, mask, f, i;
  37250. if (this.leftover) {
  37251. i = this.leftover;
  37252. this.buffer[i++] = 1;
  37253. for (; i < 16; i++) this.buffer[i] = 0;
  37254. this.fin = 1;
  37255. this.blocks(this.buffer, 0, 16);
  37256. }
  37257. c = this.h[1] >>> 13;
  37258. this.h[1] &= 0x1fff;
  37259. for (i = 2; i < 10; i++) {
  37260. this.h[i] += c;
  37261. c = this.h[i] >>> 13;
  37262. this.h[i] &= 0x1fff;
  37263. }
  37264. this.h[0] += (c * 5);
  37265. c = this.h[0] >>> 13;
  37266. this.h[0] &= 0x1fff;
  37267. this.h[1] += c;
  37268. c = this.h[1] >>> 13;
  37269. this.h[1] &= 0x1fff;
  37270. this.h[2] += c;
  37271. g[0] = this.h[0] + 5;
  37272. c = g[0] >>> 13;
  37273. g[0] &= 0x1fff;
  37274. for (i = 1; i < 10; i++) {
  37275. g[i] = this.h[i] + c;
  37276. c = g[i] >>> 13;
  37277. g[i] &= 0x1fff;
  37278. }
  37279. g[9] -= (1 << 13);
  37280. mask = (c ^ 1) - 1;
  37281. for (i = 0; i < 10; i++) g[i] &= mask;
  37282. mask = ~mask;
  37283. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37284. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37285. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37286. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37287. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37288. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37289. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37290. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37291. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37292. f = this.h[0] + this.pad[0];
  37293. this.h[0] = f & 0xffff;
  37294. for (i = 1; i < 8; i++) {
  37295. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37296. this.h[i] = f & 0xffff;
  37297. }
  37298. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37299. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37300. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37301. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37302. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37303. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37304. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37305. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37306. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37307. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37308. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37309. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37310. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37311. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37312. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37313. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37314. };
  37315. poly1305.prototype.update = function(m, mpos, bytes) {
  37316. var i, want;
  37317. if (this.leftover) {
  37318. want = (16 - this.leftover);
  37319. if (want > bytes)
  37320. want = bytes;
  37321. for (i = 0; i < want; i++)
  37322. this.buffer[this.leftover + i] = m[mpos+i];
  37323. bytes -= want;
  37324. mpos += want;
  37325. this.leftover += want;
  37326. if (this.leftover < 16)
  37327. return;
  37328. this.blocks(this.buffer, 0, 16);
  37329. this.leftover = 0;
  37330. }
  37331. if (bytes >= 16) {
  37332. want = bytes - (bytes % 16);
  37333. this.blocks(m, mpos, want);
  37334. mpos += want;
  37335. bytes -= want;
  37336. }
  37337. if (bytes) {
  37338. for (i = 0; i < bytes; i++)
  37339. this.buffer[this.leftover + i] = m[mpos+i];
  37340. this.leftover += bytes;
  37341. }
  37342. };
  37343. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37344. var s = new poly1305(k);
  37345. s.update(m, mpos, n);
  37346. s.finish(out, outpos);
  37347. return 0;
  37348. }
  37349. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37350. var x = new Uint8Array(16);
  37351. crypto_onetimeauth(x,0,m,mpos,n,k);
  37352. return crypto_verify_16(h,hpos,x,0);
  37353. }
  37354. function crypto_secretbox(c,m,d,n,k) {
  37355. var i;
  37356. if (d < 32) return -1;
  37357. crypto_stream_xor(c,0,m,0,d,n,k);
  37358. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37359. for (i = 0; i < 16; i++) c[i] = 0;
  37360. return 0;
  37361. }
  37362. function crypto_secretbox_open(m,c,d,n,k) {
  37363. var i;
  37364. var x = new Uint8Array(32);
  37365. if (d < 32) return -1;
  37366. crypto_stream(x,0,32,n,k);
  37367. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37368. crypto_stream_xor(m,0,c,0,d,n,k);
  37369. for (i = 0; i < 32; i++) m[i] = 0;
  37370. return 0;
  37371. }
  37372. function set25519(r, a) {
  37373. var i;
  37374. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37375. }
  37376. function car25519(o) {
  37377. var i, v, c = 1;
  37378. for (i = 0; i < 16; i++) {
  37379. v = o[i] + c + 65535;
  37380. c = Math.floor(v / 65536);
  37381. o[i] = v - c * 65536;
  37382. }
  37383. o[0] += c-1 + 37 * (c-1);
  37384. }
  37385. function sel25519(p, q, b) {
  37386. var t, c = ~(b-1);
  37387. for (var i = 0; i < 16; i++) {
  37388. t = c & (p[i] ^ q[i]);
  37389. p[i] ^= t;
  37390. q[i] ^= t;
  37391. }
  37392. }
  37393. function pack25519(o, n) {
  37394. var i, j, b;
  37395. var m = gf(), t = gf();
  37396. for (i = 0; i < 16; i++) t[i] = n[i];
  37397. car25519(t);
  37398. car25519(t);
  37399. car25519(t);
  37400. for (j = 0; j < 2; j++) {
  37401. m[0] = t[0] - 0xffed;
  37402. for (i = 1; i < 15; i++) {
  37403. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37404. m[i-1] &= 0xffff;
  37405. }
  37406. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37407. b = (m[15]>>16) & 1;
  37408. m[14] &= 0xffff;
  37409. sel25519(t, m, 1-b);
  37410. }
  37411. for (i = 0; i < 16; i++) {
  37412. o[2*i] = t[i] & 0xff;
  37413. o[2*i+1] = t[i]>>8;
  37414. }
  37415. }
  37416. function neq25519(a, b) {
  37417. var c = new Uint8Array(32), d = new Uint8Array(32);
  37418. pack25519(c, a);
  37419. pack25519(d, b);
  37420. return crypto_verify_32(c, 0, d, 0);
  37421. }
  37422. function par25519(a) {
  37423. var d = new Uint8Array(32);
  37424. pack25519(d, a);
  37425. return d[0] & 1;
  37426. }
  37427. function unpack25519(o, n) {
  37428. var i;
  37429. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37430. o[15] &= 0x7fff;
  37431. }
  37432. function A(o, a, b) {
  37433. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37434. }
  37435. function Z(o, a, b) {
  37436. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37437. }
  37438. function M(o, a, b) {
  37439. var v, c,
  37440. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37441. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37442. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37443. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37444. b0 = b[0],
  37445. b1 = b[1],
  37446. b2 = b[2],
  37447. b3 = b[3],
  37448. b4 = b[4],
  37449. b5 = b[5],
  37450. b6 = b[6],
  37451. b7 = b[7],
  37452. b8 = b[8],
  37453. b9 = b[9],
  37454. b10 = b[10],
  37455. b11 = b[11],
  37456. b12 = b[12],
  37457. b13 = b[13],
  37458. b14 = b[14],
  37459. b15 = b[15];
  37460. v = a[0];
  37461. t0 += v * b0;
  37462. t1 += v * b1;
  37463. t2 += v * b2;
  37464. t3 += v * b3;
  37465. t4 += v * b4;
  37466. t5 += v * b5;
  37467. t6 += v * b6;
  37468. t7 += v * b7;
  37469. t8 += v * b8;
  37470. t9 += v * b9;
  37471. t10 += v * b10;
  37472. t11 += v * b11;
  37473. t12 += v * b12;
  37474. t13 += v * b13;
  37475. t14 += v * b14;
  37476. t15 += v * b15;
  37477. v = a[1];
  37478. t1 += v * b0;
  37479. t2 += v * b1;
  37480. t3 += v * b2;
  37481. t4 += v * b3;
  37482. t5 += v * b4;
  37483. t6 += v * b5;
  37484. t7 += v * b6;
  37485. t8 += v * b7;
  37486. t9 += v * b8;
  37487. t10 += v * b9;
  37488. t11 += v * b10;
  37489. t12 += v * b11;
  37490. t13 += v * b12;
  37491. t14 += v * b13;
  37492. t15 += v * b14;
  37493. t16 += v * b15;
  37494. v = a[2];
  37495. t2 += v * b0;
  37496. t3 += v * b1;
  37497. t4 += v * b2;
  37498. t5 += v * b3;
  37499. t6 += v * b4;
  37500. t7 += v * b5;
  37501. t8 += v * b6;
  37502. t9 += v * b7;
  37503. t10 += v * b8;
  37504. t11 += v * b9;
  37505. t12 += v * b10;
  37506. t13 += v * b11;
  37507. t14 += v * b12;
  37508. t15 += v * b13;
  37509. t16 += v * b14;
  37510. t17 += v * b15;
  37511. v = a[3];
  37512. t3 += v * b0;
  37513. t4 += v * b1;
  37514. t5 += v * b2;
  37515. t6 += v * b3;
  37516. t7 += v * b4;
  37517. t8 += v * b5;
  37518. t9 += v * b6;
  37519. t10 += v * b7;
  37520. t11 += v * b8;
  37521. t12 += v * b9;
  37522. t13 += v * b10;
  37523. t14 += v * b11;
  37524. t15 += v * b12;
  37525. t16 += v * b13;
  37526. t17 += v * b14;
  37527. t18 += v * b15;
  37528. v = a[4];
  37529. t4 += v * b0;
  37530. t5 += v * b1;
  37531. t6 += v * b2;
  37532. t7 += v * b3;
  37533. t8 += v * b4;
  37534. t9 += v * b5;
  37535. t10 += v * b6;
  37536. t11 += v * b7;
  37537. t12 += v * b8;
  37538. t13 += v * b9;
  37539. t14 += v * b10;
  37540. t15 += v * b11;
  37541. t16 += v * b12;
  37542. t17 += v * b13;
  37543. t18 += v * b14;
  37544. t19 += v * b15;
  37545. v = a[5];
  37546. t5 += v * b0;
  37547. t6 += v * b1;
  37548. t7 += v * b2;
  37549. t8 += v * b3;
  37550. t9 += v * b4;
  37551. t10 += v * b5;
  37552. t11 += v * b6;
  37553. t12 += v * b7;
  37554. t13 += v * b8;
  37555. t14 += v * b9;
  37556. t15 += v * b10;
  37557. t16 += v * b11;
  37558. t17 += v * b12;
  37559. t18 += v * b13;
  37560. t19 += v * b14;
  37561. t20 += v * b15;
  37562. v = a[6];
  37563. t6 += v * b0;
  37564. t7 += v * b1;
  37565. t8 += v * b2;
  37566. t9 += v * b3;
  37567. t10 += v * b4;
  37568. t11 += v * b5;
  37569. t12 += v * b6;
  37570. t13 += v * b7;
  37571. t14 += v * b8;
  37572. t15 += v * b9;
  37573. t16 += v * b10;
  37574. t17 += v * b11;
  37575. t18 += v * b12;
  37576. t19 += v * b13;
  37577. t20 += v * b14;
  37578. t21 += v * b15;
  37579. v = a[7];
  37580. t7 += v * b0;
  37581. t8 += v * b1;
  37582. t9 += v * b2;
  37583. t10 += v * b3;
  37584. t11 += v * b4;
  37585. t12 += v * b5;
  37586. t13 += v * b6;
  37587. t14 += v * b7;
  37588. t15 += v * b8;
  37589. t16 += v * b9;
  37590. t17 += v * b10;
  37591. t18 += v * b11;
  37592. t19 += v * b12;
  37593. t20 += v * b13;
  37594. t21 += v * b14;
  37595. t22 += v * b15;
  37596. v = a[8];
  37597. t8 += v * b0;
  37598. t9 += v * b1;
  37599. t10 += v * b2;
  37600. t11 += v * b3;
  37601. t12 += v * b4;
  37602. t13 += v * b5;
  37603. t14 += v * b6;
  37604. t15 += v * b7;
  37605. t16 += v * b8;
  37606. t17 += v * b9;
  37607. t18 += v * b10;
  37608. t19 += v * b11;
  37609. t20 += v * b12;
  37610. t21 += v * b13;
  37611. t22 += v * b14;
  37612. t23 += v * b15;
  37613. v = a[9];
  37614. t9 += v * b0;
  37615. t10 += v * b1;
  37616. t11 += v * b2;
  37617. t12 += v * b3;
  37618. t13 += v * b4;
  37619. t14 += v * b5;
  37620. t15 += v * b6;
  37621. t16 += v * b7;
  37622. t17 += v * b8;
  37623. t18 += v * b9;
  37624. t19 += v * b10;
  37625. t20 += v * b11;
  37626. t21 += v * b12;
  37627. t22 += v * b13;
  37628. t23 += v * b14;
  37629. t24 += v * b15;
  37630. v = a[10];
  37631. t10 += v * b0;
  37632. t11 += v * b1;
  37633. t12 += v * b2;
  37634. t13 += v * b3;
  37635. t14 += v * b4;
  37636. t15 += v * b5;
  37637. t16 += v * b6;
  37638. t17 += v * b7;
  37639. t18 += v * b8;
  37640. t19 += v * b9;
  37641. t20 += v * b10;
  37642. t21 += v * b11;
  37643. t22 += v * b12;
  37644. t23 += v * b13;
  37645. t24 += v * b14;
  37646. t25 += v * b15;
  37647. v = a[11];
  37648. t11 += v * b0;
  37649. t12 += v * b1;
  37650. t13 += v * b2;
  37651. t14 += v * b3;
  37652. t15 += v * b4;
  37653. t16 += v * b5;
  37654. t17 += v * b6;
  37655. t18 += v * b7;
  37656. t19 += v * b8;
  37657. t20 += v * b9;
  37658. t21 += v * b10;
  37659. t22 += v * b11;
  37660. t23 += v * b12;
  37661. t24 += v * b13;
  37662. t25 += v * b14;
  37663. t26 += v * b15;
  37664. v = a[12];
  37665. t12 += v * b0;
  37666. t13 += v * b1;
  37667. t14 += v * b2;
  37668. t15 += v * b3;
  37669. t16 += v * b4;
  37670. t17 += v * b5;
  37671. t18 += v * b6;
  37672. t19 += v * b7;
  37673. t20 += v * b8;
  37674. t21 += v * b9;
  37675. t22 += v * b10;
  37676. t23 += v * b11;
  37677. t24 += v * b12;
  37678. t25 += v * b13;
  37679. t26 += v * b14;
  37680. t27 += v * b15;
  37681. v = a[13];
  37682. t13 += v * b0;
  37683. t14 += v * b1;
  37684. t15 += v * b2;
  37685. t16 += v * b3;
  37686. t17 += v * b4;
  37687. t18 += v * b5;
  37688. t19 += v * b6;
  37689. t20 += v * b7;
  37690. t21 += v * b8;
  37691. t22 += v * b9;
  37692. t23 += v * b10;
  37693. t24 += v * b11;
  37694. t25 += v * b12;
  37695. t26 += v * b13;
  37696. t27 += v * b14;
  37697. t28 += v * b15;
  37698. v = a[14];
  37699. t14 += v * b0;
  37700. t15 += v * b1;
  37701. t16 += v * b2;
  37702. t17 += v * b3;
  37703. t18 += v * b4;
  37704. t19 += v * b5;
  37705. t20 += v * b6;
  37706. t21 += v * b7;
  37707. t22 += v * b8;
  37708. t23 += v * b9;
  37709. t24 += v * b10;
  37710. t25 += v * b11;
  37711. t26 += v * b12;
  37712. t27 += v * b13;
  37713. t28 += v * b14;
  37714. t29 += v * b15;
  37715. v = a[15];
  37716. t15 += v * b0;
  37717. t16 += v * b1;
  37718. t17 += v * b2;
  37719. t18 += v * b3;
  37720. t19 += v * b4;
  37721. t20 += v * b5;
  37722. t21 += v * b6;
  37723. t22 += v * b7;
  37724. t23 += v * b8;
  37725. t24 += v * b9;
  37726. t25 += v * b10;
  37727. t26 += v * b11;
  37728. t27 += v * b12;
  37729. t28 += v * b13;
  37730. t29 += v * b14;
  37731. t30 += v * b15;
  37732. t0 += 38 * t16;
  37733. t1 += 38 * t17;
  37734. t2 += 38 * t18;
  37735. t3 += 38 * t19;
  37736. t4 += 38 * t20;
  37737. t5 += 38 * t21;
  37738. t6 += 38 * t22;
  37739. t7 += 38 * t23;
  37740. t8 += 38 * t24;
  37741. t9 += 38 * t25;
  37742. t10 += 38 * t26;
  37743. t11 += 38 * t27;
  37744. t12 += 38 * t28;
  37745. t13 += 38 * t29;
  37746. t14 += 38 * t30;
  37747. // t15 left as is
  37748. // first car
  37749. c = 1;
  37750. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37751. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37752. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37753. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37754. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37755. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37756. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37757. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37758. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37759. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37760. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37761. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37762. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37763. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37764. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37765. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37766. t0 += c-1 + 37 * (c-1);
  37767. // second car
  37768. c = 1;
  37769. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37770. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37771. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37772. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37773. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37774. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37775. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37776. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37777. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37778. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37779. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37780. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37781. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37782. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37783. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37784. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37785. t0 += c-1 + 37 * (c-1);
  37786. o[ 0] = t0;
  37787. o[ 1] = t1;
  37788. o[ 2] = t2;
  37789. o[ 3] = t3;
  37790. o[ 4] = t4;
  37791. o[ 5] = t5;
  37792. o[ 6] = t6;
  37793. o[ 7] = t7;
  37794. o[ 8] = t8;
  37795. o[ 9] = t9;
  37796. o[10] = t10;
  37797. o[11] = t11;
  37798. o[12] = t12;
  37799. o[13] = t13;
  37800. o[14] = t14;
  37801. o[15] = t15;
  37802. }
  37803. function S(o, a) {
  37804. M(o, a, a);
  37805. }
  37806. function inv25519(o, i) {
  37807. var c = gf();
  37808. var a;
  37809. for (a = 0; a < 16; a++) c[a] = i[a];
  37810. for (a = 253; a >= 0; a--) {
  37811. S(c, c);
  37812. if(a !== 2 && a !== 4) M(c, c, i);
  37813. }
  37814. for (a = 0; a < 16; a++) o[a] = c[a];
  37815. }
  37816. function pow2523(o, i) {
  37817. var c = gf();
  37818. var a;
  37819. for (a = 0; a < 16; a++) c[a] = i[a];
  37820. for (a = 250; a >= 0; a--) {
  37821. S(c, c);
  37822. if(a !== 1) M(c, c, i);
  37823. }
  37824. for (a = 0; a < 16; a++) o[a] = c[a];
  37825. }
  37826. function crypto_scalarmult(q, n, p) {
  37827. var z = new Uint8Array(32);
  37828. var x = new Float64Array(80), r, i;
  37829. var a = gf(), b = gf(), c = gf(),
  37830. d = gf(), e = gf(), f = gf();
  37831. for (i = 0; i < 31; i++) z[i] = n[i];
  37832. z[31]=(n[31]&127)|64;
  37833. z[0]&=248;
  37834. unpack25519(x,p);
  37835. for (i = 0; i < 16; i++) {
  37836. b[i]=x[i];
  37837. d[i]=a[i]=c[i]=0;
  37838. }
  37839. a[0]=d[0]=1;
  37840. for (i=254; i>=0; --i) {
  37841. r=(z[i>>>3]>>>(i&7))&1;
  37842. sel25519(a,b,r);
  37843. sel25519(c,d,r);
  37844. A(e,a,c);
  37845. Z(a,a,c);
  37846. A(c,b,d);
  37847. Z(b,b,d);
  37848. S(d,e);
  37849. S(f,a);
  37850. M(a,c,a);
  37851. M(c,b,e);
  37852. A(e,a,c);
  37853. Z(a,a,c);
  37854. S(b,a);
  37855. Z(c,d,f);
  37856. M(a,c,_121665);
  37857. A(a,a,d);
  37858. M(c,c,a);
  37859. M(a,d,f);
  37860. M(d,b,x);
  37861. S(b,e);
  37862. sel25519(a,b,r);
  37863. sel25519(c,d,r);
  37864. }
  37865. for (i = 0; i < 16; i++) {
  37866. x[i+16]=a[i];
  37867. x[i+32]=c[i];
  37868. x[i+48]=b[i];
  37869. x[i+64]=d[i];
  37870. }
  37871. var x32 = x.subarray(32);
  37872. var x16 = x.subarray(16);
  37873. inv25519(x32,x32);
  37874. M(x16,x16,x32);
  37875. pack25519(q,x16);
  37876. return 0;
  37877. }
  37878. function crypto_scalarmult_base(q, n) {
  37879. return crypto_scalarmult(q, n, _9);
  37880. }
  37881. function crypto_box_keypair(y, x) {
  37882. randombytes(x, 32);
  37883. return crypto_scalarmult_base(y, x);
  37884. }
  37885. function crypto_box_beforenm(k, y, x) {
  37886. var s = new Uint8Array(32);
  37887. crypto_scalarmult(s, x, y);
  37888. return crypto_core_hsalsa20(k, _0, s, sigma);
  37889. }
  37890. var crypto_box_afternm = crypto_secretbox;
  37891. var crypto_box_open_afternm = crypto_secretbox_open;
  37892. function crypto_box(c, m, d, n, y, x) {
  37893. var k = new Uint8Array(32);
  37894. crypto_box_beforenm(k, y, x);
  37895. return crypto_box_afternm(c, m, d, n, k);
  37896. }
  37897. function crypto_box_open(m, c, d, n, y, x) {
  37898. var k = new Uint8Array(32);
  37899. crypto_box_beforenm(k, y, x);
  37900. return crypto_box_open_afternm(m, c, d, n, k);
  37901. }
  37902. var K = [
  37903. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  37904. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  37905. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  37906. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  37907. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  37908. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  37909. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  37910. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  37911. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  37912. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  37913. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  37914. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  37915. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  37916. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  37917. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  37918. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  37919. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  37920. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  37921. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  37922. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  37923. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  37924. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  37925. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  37926. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  37927. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  37928. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  37929. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  37930. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  37931. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  37932. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  37933. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  37934. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  37935. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  37936. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  37937. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  37938. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  37939. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  37940. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  37941. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  37942. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  37943. ];
  37944. function crypto_hashblocks_hl(hh, hl, m, n) {
  37945. var wh = new Int32Array(16), wl = new Int32Array(16),
  37946. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  37947. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  37948. th, tl, i, j, h, l, a, b, c, d;
  37949. var ah0 = hh[0],
  37950. ah1 = hh[1],
  37951. ah2 = hh[2],
  37952. ah3 = hh[3],
  37953. ah4 = hh[4],
  37954. ah5 = hh[5],
  37955. ah6 = hh[6],
  37956. ah7 = hh[7],
  37957. al0 = hl[0],
  37958. al1 = hl[1],
  37959. al2 = hl[2],
  37960. al3 = hl[3],
  37961. al4 = hl[4],
  37962. al5 = hl[5],
  37963. al6 = hl[6],
  37964. al7 = hl[7];
  37965. var pos = 0;
  37966. while (n >= 128) {
  37967. for (i = 0; i < 16; i++) {
  37968. j = 8 * i + pos;
  37969. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  37970. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  37971. }
  37972. for (i = 0; i < 80; i++) {
  37973. bh0 = ah0;
  37974. bh1 = ah1;
  37975. bh2 = ah2;
  37976. bh3 = ah3;
  37977. bh4 = ah4;
  37978. bh5 = ah5;
  37979. bh6 = ah6;
  37980. bh7 = ah7;
  37981. bl0 = al0;
  37982. bl1 = al1;
  37983. bl2 = al2;
  37984. bl3 = al3;
  37985. bl4 = al4;
  37986. bl5 = al5;
  37987. bl6 = al6;
  37988. bl7 = al7;
  37989. // add
  37990. h = ah7;
  37991. l = al7;
  37992. a = l & 0xffff; b = l >>> 16;
  37993. c = h & 0xffff; d = h >>> 16;
  37994. // Sigma1
  37995. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  37996. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  37997. a += l & 0xffff; b += l >>> 16;
  37998. c += h & 0xffff; d += h >>> 16;
  37999. // Ch
  38000. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38001. l = (al4 & al5) ^ (~al4 & al6);
  38002. a += l & 0xffff; b += l >>> 16;
  38003. c += h & 0xffff; d += h >>> 16;
  38004. // K
  38005. h = K[i*2];
  38006. l = K[i*2+1];
  38007. a += l & 0xffff; b += l >>> 16;
  38008. c += h & 0xffff; d += h >>> 16;
  38009. // w
  38010. h = wh[i%16];
  38011. l = wl[i%16];
  38012. a += l & 0xffff; b += l >>> 16;
  38013. c += h & 0xffff; d += h >>> 16;
  38014. b += a >>> 16;
  38015. c += b >>> 16;
  38016. d += c >>> 16;
  38017. th = c & 0xffff | d << 16;
  38018. tl = a & 0xffff | b << 16;
  38019. // add
  38020. h = th;
  38021. l = tl;
  38022. a = l & 0xffff; b = l >>> 16;
  38023. c = h & 0xffff; d = h >>> 16;
  38024. // Sigma0
  38025. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38026. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38027. a += l & 0xffff; b += l >>> 16;
  38028. c += h & 0xffff; d += h >>> 16;
  38029. // Maj
  38030. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38031. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  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. bh7 = (c & 0xffff) | (d << 16);
  38038. bl7 = (a & 0xffff) | (b << 16);
  38039. // add
  38040. h = bh3;
  38041. l = bl3;
  38042. a = l & 0xffff; b = l >>> 16;
  38043. c = h & 0xffff; d = h >>> 16;
  38044. h = th;
  38045. l = tl;
  38046. a += l & 0xffff; b += l >>> 16;
  38047. c += h & 0xffff; d += h >>> 16;
  38048. b += a >>> 16;
  38049. c += b >>> 16;
  38050. d += c >>> 16;
  38051. bh3 = (c & 0xffff) | (d << 16);
  38052. bl3 = (a & 0xffff) | (b << 16);
  38053. ah1 = bh0;
  38054. ah2 = bh1;
  38055. ah3 = bh2;
  38056. ah4 = bh3;
  38057. ah5 = bh4;
  38058. ah6 = bh5;
  38059. ah7 = bh6;
  38060. ah0 = bh7;
  38061. al1 = bl0;
  38062. al2 = bl1;
  38063. al3 = bl2;
  38064. al4 = bl3;
  38065. al5 = bl4;
  38066. al6 = bl5;
  38067. al7 = bl6;
  38068. al0 = bl7;
  38069. if (i%16 === 15) {
  38070. for (j = 0; j < 16; j++) {
  38071. // add
  38072. h = wh[j];
  38073. l = wl[j];
  38074. a = l & 0xffff; b = l >>> 16;
  38075. c = h & 0xffff; d = h >>> 16;
  38076. h = wh[(j+9)%16];
  38077. l = wl[(j+9)%16];
  38078. a += l & 0xffff; b += l >>> 16;
  38079. c += h & 0xffff; d += h >>> 16;
  38080. // sigma0
  38081. th = wh[(j+1)%16];
  38082. tl = wl[(j+1)%16];
  38083. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38084. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38085. a += l & 0xffff; b += l >>> 16;
  38086. c += h & 0xffff; d += h >>> 16;
  38087. // sigma1
  38088. th = wh[(j+14)%16];
  38089. tl = wl[(j+14)%16];
  38090. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38091. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38092. a += l & 0xffff; b += l >>> 16;
  38093. c += h & 0xffff; d += h >>> 16;
  38094. b += a >>> 16;
  38095. c += b >>> 16;
  38096. d += c >>> 16;
  38097. wh[j] = (c & 0xffff) | (d << 16);
  38098. wl[j] = (a & 0xffff) | (b << 16);
  38099. }
  38100. }
  38101. }
  38102. // add
  38103. h = ah0;
  38104. l = al0;
  38105. a = l & 0xffff; b = l >>> 16;
  38106. c = h & 0xffff; d = h >>> 16;
  38107. h = hh[0];
  38108. l = hl[0];
  38109. a += l & 0xffff; b += l >>> 16;
  38110. c += h & 0xffff; d += h >>> 16;
  38111. b += a >>> 16;
  38112. c += b >>> 16;
  38113. d += c >>> 16;
  38114. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38115. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38116. h = ah1;
  38117. l = al1;
  38118. a = l & 0xffff; b = l >>> 16;
  38119. c = h & 0xffff; d = h >>> 16;
  38120. h = hh[1];
  38121. l = hl[1];
  38122. a += l & 0xffff; b += l >>> 16;
  38123. c += h & 0xffff; d += h >>> 16;
  38124. b += a >>> 16;
  38125. c += b >>> 16;
  38126. d += c >>> 16;
  38127. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38128. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38129. h = ah2;
  38130. l = al2;
  38131. a = l & 0xffff; b = l >>> 16;
  38132. c = h & 0xffff; d = h >>> 16;
  38133. h = hh[2];
  38134. l = hl[2];
  38135. a += l & 0xffff; b += l >>> 16;
  38136. c += h & 0xffff; d += h >>> 16;
  38137. b += a >>> 16;
  38138. c += b >>> 16;
  38139. d += c >>> 16;
  38140. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38141. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38142. h = ah3;
  38143. l = al3;
  38144. a = l & 0xffff; b = l >>> 16;
  38145. c = h & 0xffff; d = h >>> 16;
  38146. h = hh[3];
  38147. l = hl[3];
  38148. a += l & 0xffff; b += l >>> 16;
  38149. c += h & 0xffff; d += h >>> 16;
  38150. b += a >>> 16;
  38151. c += b >>> 16;
  38152. d += c >>> 16;
  38153. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38154. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38155. h = ah4;
  38156. l = al4;
  38157. a = l & 0xffff; b = l >>> 16;
  38158. c = h & 0xffff; d = h >>> 16;
  38159. h = hh[4];
  38160. l = hl[4];
  38161. a += l & 0xffff; b += l >>> 16;
  38162. c += h & 0xffff; d += h >>> 16;
  38163. b += a >>> 16;
  38164. c += b >>> 16;
  38165. d += c >>> 16;
  38166. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38167. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38168. h = ah5;
  38169. l = al5;
  38170. a = l & 0xffff; b = l >>> 16;
  38171. c = h & 0xffff; d = h >>> 16;
  38172. h = hh[5];
  38173. l = hl[5];
  38174. a += l & 0xffff; b += l >>> 16;
  38175. c += h & 0xffff; d += h >>> 16;
  38176. b += a >>> 16;
  38177. c += b >>> 16;
  38178. d += c >>> 16;
  38179. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38180. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38181. h = ah6;
  38182. l = al6;
  38183. a = l & 0xffff; b = l >>> 16;
  38184. c = h & 0xffff; d = h >>> 16;
  38185. h = hh[6];
  38186. l = hl[6];
  38187. a += l & 0xffff; b += l >>> 16;
  38188. c += h & 0xffff; d += h >>> 16;
  38189. b += a >>> 16;
  38190. c += b >>> 16;
  38191. d += c >>> 16;
  38192. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38193. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38194. h = ah7;
  38195. l = al7;
  38196. a = l & 0xffff; b = l >>> 16;
  38197. c = h & 0xffff; d = h >>> 16;
  38198. h = hh[7];
  38199. l = hl[7];
  38200. a += l & 0xffff; b += l >>> 16;
  38201. c += h & 0xffff; d += h >>> 16;
  38202. b += a >>> 16;
  38203. c += b >>> 16;
  38204. d += c >>> 16;
  38205. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38206. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38207. pos += 128;
  38208. n -= 128;
  38209. }
  38210. return n;
  38211. }
  38212. function crypto_hash(out, m, n) {
  38213. var hh = new Int32Array(8),
  38214. hl = new Int32Array(8),
  38215. x = new Uint8Array(256),
  38216. i, b = n;
  38217. hh[0] = 0x6a09e667;
  38218. hh[1] = 0xbb67ae85;
  38219. hh[2] = 0x3c6ef372;
  38220. hh[3] = 0xa54ff53a;
  38221. hh[4] = 0x510e527f;
  38222. hh[5] = 0x9b05688c;
  38223. hh[6] = 0x1f83d9ab;
  38224. hh[7] = 0x5be0cd19;
  38225. hl[0] = 0xf3bcc908;
  38226. hl[1] = 0x84caa73b;
  38227. hl[2] = 0xfe94f82b;
  38228. hl[3] = 0x5f1d36f1;
  38229. hl[4] = 0xade682d1;
  38230. hl[5] = 0x2b3e6c1f;
  38231. hl[6] = 0xfb41bd6b;
  38232. hl[7] = 0x137e2179;
  38233. crypto_hashblocks_hl(hh, hl, m, n);
  38234. n %= 128;
  38235. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38236. x[n] = 128;
  38237. n = 256-128*(n<112?1:0);
  38238. x[n-9] = 0;
  38239. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38240. crypto_hashblocks_hl(hh, hl, x, n);
  38241. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38242. return 0;
  38243. }
  38244. function add(p, q) {
  38245. var a = gf(), b = gf(), c = gf(),
  38246. d = gf(), e = gf(), f = gf(),
  38247. g = gf(), h = gf(), t = gf();
  38248. Z(a, p[1], p[0]);
  38249. Z(t, q[1], q[0]);
  38250. M(a, a, t);
  38251. A(b, p[0], p[1]);
  38252. A(t, q[0], q[1]);
  38253. M(b, b, t);
  38254. M(c, p[3], q[3]);
  38255. M(c, c, D2);
  38256. M(d, p[2], q[2]);
  38257. A(d, d, d);
  38258. Z(e, b, a);
  38259. Z(f, d, c);
  38260. A(g, d, c);
  38261. A(h, b, a);
  38262. M(p[0], e, f);
  38263. M(p[1], h, g);
  38264. M(p[2], g, f);
  38265. M(p[3], e, h);
  38266. }
  38267. function cswap(p, q, b) {
  38268. var i;
  38269. for (i = 0; i < 4; i++) {
  38270. sel25519(p[i], q[i], b);
  38271. }
  38272. }
  38273. function pack(r, p) {
  38274. var tx = gf(), ty = gf(), zi = gf();
  38275. inv25519(zi, p[2]);
  38276. M(tx, p[0], zi);
  38277. M(ty, p[1], zi);
  38278. pack25519(r, ty);
  38279. r[31] ^= par25519(tx) << 7;
  38280. }
  38281. function scalarmult(p, q, s) {
  38282. var b, i;
  38283. set25519(p[0], gf0);
  38284. set25519(p[1], gf1);
  38285. set25519(p[2], gf1);
  38286. set25519(p[3], gf0);
  38287. for (i = 255; i >= 0; --i) {
  38288. b = (s[(i/8)|0] >> (i&7)) & 1;
  38289. cswap(p, q, b);
  38290. add(q, p);
  38291. add(p, p);
  38292. cswap(p, q, b);
  38293. }
  38294. }
  38295. function scalarbase(p, s) {
  38296. var q = [gf(), gf(), gf(), gf()];
  38297. set25519(q[0], X);
  38298. set25519(q[1], Y);
  38299. set25519(q[2], gf1);
  38300. M(q[3], X, Y);
  38301. scalarmult(p, q, s);
  38302. }
  38303. function crypto_sign_keypair(pk, sk, seeded) {
  38304. var d = new Uint8Array(64);
  38305. var p = [gf(), gf(), gf(), gf()];
  38306. var i;
  38307. if (!seeded) randombytes(sk, 32);
  38308. crypto_hash(d, sk, 32);
  38309. d[0] &= 248;
  38310. d[31] &= 127;
  38311. d[31] |= 64;
  38312. scalarbase(p, d);
  38313. pack(pk, p);
  38314. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38315. return 0;
  38316. }
  38317. 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]);
  38318. function modL(r, x) {
  38319. var carry, i, j, k;
  38320. for (i = 63; i >= 32; --i) {
  38321. carry = 0;
  38322. for (j = i - 32, k = i - 12; j < k; ++j) {
  38323. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38324. carry = (x[j] + 128) >> 8;
  38325. x[j] -= carry * 256;
  38326. }
  38327. x[j] += carry;
  38328. x[i] = 0;
  38329. }
  38330. carry = 0;
  38331. for (j = 0; j < 32; j++) {
  38332. x[j] += carry - (x[31] >> 4) * L[j];
  38333. carry = x[j] >> 8;
  38334. x[j] &= 255;
  38335. }
  38336. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38337. for (i = 0; i < 32; i++) {
  38338. x[i+1] += x[i] >> 8;
  38339. r[i] = x[i] & 255;
  38340. }
  38341. }
  38342. function reduce(r) {
  38343. var x = new Float64Array(64), i;
  38344. for (i = 0; i < 64; i++) x[i] = r[i];
  38345. for (i = 0; i < 64; i++) r[i] = 0;
  38346. modL(r, x);
  38347. }
  38348. // Note: difference from C - smlen returned, not passed as argument.
  38349. function crypto_sign(sm, m, n, sk) {
  38350. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38351. var i, j, x = new Float64Array(64);
  38352. var p = [gf(), gf(), gf(), gf()];
  38353. crypto_hash(d, sk, 32);
  38354. d[0] &= 248;
  38355. d[31] &= 127;
  38356. d[31] |= 64;
  38357. var smlen = n + 64;
  38358. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38359. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38360. crypto_hash(r, sm.subarray(32), n+32);
  38361. reduce(r);
  38362. scalarbase(p, r);
  38363. pack(sm, p);
  38364. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38365. crypto_hash(h, sm, n + 64);
  38366. reduce(h);
  38367. for (i = 0; i < 64; i++) x[i] = 0;
  38368. for (i = 0; i < 32; i++) x[i] = r[i];
  38369. for (i = 0; i < 32; i++) {
  38370. for (j = 0; j < 32; j++) {
  38371. x[i+j] += h[i] * d[j];
  38372. }
  38373. }
  38374. modL(sm.subarray(32), x);
  38375. return smlen;
  38376. }
  38377. function unpackneg(r, p) {
  38378. var t = gf(), chk = gf(), num = gf(),
  38379. den = gf(), den2 = gf(), den4 = gf(),
  38380. den6 = gf();
  38381. set25519(r[2], gf1);
  38382. unpack25519(r[1], p);
  38383. S(num, r[1]);
  38384. M(den, num, D);
  38385. Z(num, num, r[2]);
  38386. A(den, r[2], den);
  38387. S(den2, den);
  38388. S(den4, den2);
  38389. M(den6, den4, den2);
  38390. M(t, den6, num);
  38391. M(t, t, den);
  38392. pow2523(t, t);
  38393. M(t, t, num);
  38394. M(t, t, den);
  38395. M(t, t, den);
  38396. M(r[0], t, den);
  38397. S(chk, r[0]);
  38398. M(chk, chk, den);
  38399. if (neq25519(chk, num)) M(r[0], r[0], I);
  38400. S(chk, r[0]);
  38401. M(chk, chk, den);
  38402. if (neq25519(chk, num)) return -1;
  38403. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38404. M(r[3], r[0], r[1]);
  38405. return 0;
  38406. }
  38407. function crypto_sign_open(m, sm, n, pk) {
  38408. var i, mlen;
  38409. var t = new Uint8Array(32), h = new Uint8Array(64);
  38410. var p = [gf(), gf(), gf(), gf()],
  38411. q = [gf(), gf(), gf(), gf()];
  38412. mlen = -1;
  38413. if (n < 64) return -1;
  38414. if (unpackneg(q, pk)) return -1;
  38415. for (i = 0; i < n; i++) m[i] = sm[i];
  38416. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38417. crypto_hash(h, m, n);
  38418. reduce(h);
  38419. scalarmult(p, q, h);
  38420. scalarbase(q, sm.subarray(32));
  38421. add(p, q);
  38422. pack(t, p);
  38423. n -= 64;
  38424. if (crypto_verify_32(sm, 0, t, 0)) {
  38425. for (i = 0; i < n; i++) m[i] = 0;
  38426. return -1;
  38427. }
  38428. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38429. mlen = n;
  38430. return mlen;
  38431. }
  38432. var crypto_secretbox_KEYBYTES = 32,
  38433. crypto_secretbox_NONCEBYTES = 24,
  38434. crypto_secretbox_ZEROBYTES = 32,
  38435. crypto_secretbox_BOXZEROBYTES = 16,
  38436. crypto_scalarmult_BYTES = 32,
  38437. crypto_scalarmult_SCALARBYTES = 32,
  38438. crypto_box_PUBLICKEYBYTES = 32,
  38439. crypto_box_SECRETKEYBYTES = 32,
  38440. crypto_box_BEFORENMBYTES = 32,
  38441. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38442. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38443. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38444. crypto_sign_BYTES = 64,
  38445. crypto_sign_PUBLICKEYBYTES = 32,
  38446. crypto_sign_SECRETKEYBYTES = 64,
  38447. crypto_sign_SEEDBYTES = 32,
  38448. crypto_hash_BYTES = 64;
  38449. nacl.lowlevel = {
  38450. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38451. crypto_stream_xor: crypto_stream_xor,
  38452. crypto_stream: crypto_stream,
  38453. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38454. crypto_stream_salsa20: crypto_stream_salsa20,
  38455. crypto_onetimeauth: crypto_onetimeauth,
  38456. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38457. crypto_verify_16: crypto_verify_16,
  38458. crypto_verify_32: crypto_verify_32,
  38459. crypto_secretbox: crypto_secretbox,
  38460. crypto_secretbox_open: crypto_secretbox_open,
  38461. crypto_scalarmult: crypto_scalarmult,
  38462. crypto_scalarmult_base: crypto_scalarmult_base,
  38463. crypto_box_beforenm: crypto_box_beforenm,
  38464. crypto_box_afternm: crypto_box_afternm,
  38465. crypto_box: crypto_box,
  38466. crypto_box_open: crypto_box_open,
  38467. crypto_box_keypair: crypto_box_keypair,
  38468. crypto_hash: crypto_hash,
  38469. crypto_sign: crypto_sign,
  38470. crypto_sign_keypair: crypto_sign_keypair,
  38471. crypto_sign_open: crypto_sign_open,
  38472. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38473. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38474. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38475. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38476. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38477. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38478. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38479. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38480. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38481. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38482. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38483. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38484. crypto_sign_BYTES: crypto_sign_BYTES,
  38485. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38486. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38487. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38488. crypto_hash_BYTES: crypto_hash_BYTES
  38489. };
  38490. /* High-level API */
  38491. function checkLengths(k, n) {
  38492. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38493. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38494. }
  38495. function checkBoxLengths(pk, sk) {
  38496. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38497. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38498. }
  38499. function checkArrayTypes() {
  38500. for (var i = 0; i < arguments.length; i++) {
  38501. if (!(arguments[i] instanceof Uint8Array))
  38502. throw new TypeError('unexpected type, use Uint8Array');
  38503. }
  38504. }
  38505. function cleanup(arr) {
  38506. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38507. }
  38508. nacl.randomBytes = function(n) {
  38509. var b = new Uint8Array(n);
  38510. randombytes(b, n);
  38511. return b;
  38512. };
  38513. nacl.secretbox = function(msg, nonce, key) {
  38514. checkArrayTypes(msg, nonce, key);
  38515. checkLengths(key, nonce);
  38516. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38517. var c = new Uint8Array(m.length);
  38518. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38519. crypto_secretbox(c, m, m.length, nonce, key);
  38520. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38521. };
  38522. nacl.secretbox.open = function(box, nonce, key) {
  38523. checkArrayTypes(box, nonce, key);
  38524. checkLengths(key, nonce);
  38525. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38526. var m = new Uint8Array(c.length);
  38527. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38528. if (c.length < 32) return null;
  38529. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38530. return m.subarray(crypto_secretbox_ZEROBYTES);
  38531. };
  38532. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38533. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38534. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38535. nacl.scalarMult = function(n, p) {
  38536. checkArrayTypes(n, p);
  38537. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38538. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38539. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38540. crypto_scalarmult(q, n, p);
  38541. return q;
  38542. };
  38543. nacl.scalarMult.base = function(n) {
  38544. checkArrayTypes(n);
  38545. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38546. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38547. crypto_scalarmult_base(q, n);
  38548. return q;
  38549. };
  38550. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38551. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38552. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38553. var k = nacl.box.before(publicKey, secretKey);
  38554. return nacl.secretbox(msg, nonce, k);
  38555. };
  38556. nacl.box.before = function(publicKey, secretKey) {
  38557. checkArrayTypes(publicKey, secretKey);
  38558. checkBoxLengths(publicKey, secretKey);
  38559. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38560. crypto_box_beforenm(k, publicKey, secretKey);
  38561. return k;
  38562. };
  38563. nacl.box.after = nacl.secretbox;
  38564. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38565. var k = nacl.box.before(publicKey, secretKey);
  38566. return nacl.secretbox.open(msg, nonce, k);
  38567. };
  38568. nacl.box.open.after = nacl.secretbox.open;
  38569. nacl.box.keyPair = function() {
  38570. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38571. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38572. crypto_box_keypair(pk, sk);
  38573. return {publicKey: pk, secretKey: sk};
  38574. };
  38575. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38576. checkArrayTypes(secretKey);
  38577. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38578. throw new Error('bad secret key size');
  38579. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38580. crypto_scalarmult_base(pk, secretKey);
  38581. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38582. };
  38583. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38584. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38585. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38586. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38587. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38588. nacl.sign = function(msg, secretKey) {
  38589. checkArrayTypes(msg, secretKey);
  38590. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38591. throw new Error('bad secret key size');
  38592. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38593. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38594. return signedMsg;
  38595. };
  38596. nacl.sign.open = function(signedMsg, publicKey) {
  38597. checkArrayTypes(signedMsg, publicKey);
  38598. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38599. throw new Error('bad public key size');
  38600. var tmp = new Uint8Array(signedMsg.length);
  38601. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38602. if (mlen < 0) return null;
  38603. var m = new Uint8Array(mlen);
  38604. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38605. return m;
  38606. };
  38607. nacl.sign.detached = function(msg, secretKey) {
  38608. var signedMsg = nacl.sign(msg, secretKey);
  38609. var sig = new Uint8Array(crypto_sign_BYTES);
  38610. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38611. return sig;
  38612. };
  38613. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38614. checkArrayTypes(msg, sig, publicKey);
  38615. if (sig.length !== crypto_sign_BYTES)
  38616. throw new Error('bad signature size');
  38617. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38618. throw new Error('bad public key size');
  38619. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38620. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38621. var i;
  38622. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38623. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38624. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38625. };
  38626. nacl.sign.keyPair = function() {
  38627. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38628. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38629. crypto_sign_keypair(pk, sk);
  38630. return {publicKey: pk, secretKey: sk};
  38631. };
  38632. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38633. checkArrayTypes(secretKey);
  38634. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38635. throw new Error('bad secret key size');
  38636. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38637. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38638. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38639. };
  38640. nacl.sign.keyPair.fromSeed = function(seed) {
  38641. checkArrayTypes(seed);
  38642. if (seed.length !== crypto_sign_SEEDBYTES)
  38643. throw new Error('bad seed size');
  38644. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38645. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38646. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38647. crypto_sign_keypair(pk, sk, true);
  38648. return {publicKey: pk, secretKey: sk};
  38649. };
  38650. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38651. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38652. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38653. nacl.sign.signatureLength = crypto_sign_BYTES;
  38654. nacl.hash = function(msg) {
  38655. checkArrayTypes(msg);
  38656. var h = new Uint8Array(crypto_hash_BYTES);
  38657. crypto_hash(h, msg, msg.length);
  38658. return h;
  38659. };
  38660. nacl.hash.hashLength = crypto_hash_BYTES;
  38661. nacl.verify = function(x, y) {
  38662. checkArrayTypes(x, y);
  38663. // Zero length arguments are considered not equal.
  38664. if (x.length === 0 || y.length === 0) return false;
  38665. if (x.length !== y.length) return false;
  38666. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38667. };
  38668. nacl.setPRNG = function(fn) {
  38669. randombytes = fn;
  38670. };
  38671. (function() {
  38672. // Initialize PRNG if environment provides CSPRNG.
  38673. // If not, methods calling randombytes will throw.
  38674. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38675. if (crypto && crypto.getRandomValues) {
  38676. // Browsers.
  38677. var QUOTA = 65536;
  38678. nacl.setPRNG(function(x, n) {
  38679. var i, v = new Uint8Array(n);
  38680. for (i = 0; i < n; i += QUOTA) {
  38681. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38682. }
  38683. for (i = 0; i < n; i++) x[i] = v[i];
  38684. cleanup(v);
  38685. });
  38686. } else if (true) {
  38687. // Node.js.
  38688. crypto = __webpack_require__(3);
  38689. if (crypto && crypto.randomBytes) {
  38690. nacl.setPRNG(function(x, n) {
  38691. var i, v = crypto.randomBytes(n);
  38692. for (i = 0; i < n; i++) x[i] = v[i];
  38693. cleanup(v);
  38694. });
  38695. }
  38696. }
  38697. })();
  38698. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38699. /***/ }),
  38700. /* 1 */
  38701. /***/ (function(module, exports, __webpack_require__) {
  38702. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38703. // Public domain.
  38704. (function(root, f) {
  38705. 'use strict';
  38706. if ( true && module.exports) module.exports = f();
  38707. else if (root.nacl) root.nacl.util = f();
  38708. else {
  38709. root.nacl = {};
  38710. root.nacl.util = f();
  38711. }
  38712. }(this, function() {
  38713. 'use strict';
  38714. var util = {};
  38715. function validateBase64(s) {
  38716. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  38717. throw new TypeError('invalid encoding');
  38718. }
  38719. }
  38720. util.decodeUTF8 = function(s) {
  38721. if (typeof s !== 'string') throw new TypeError('expected string');
  38722. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  38723. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38724. return b;
  38725. };
  38726. util.encodeUTF8 = function(arr) {
  38727. var i, s = [];
  38728. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  38729. return decodeURIComponent(escape(s.join('')));
  38730. };
  38731. if (typeof atob === 'undefined') {
  38732. // Node.js
  38733. if (typeof Buffer.from !== 'undefined') {
  38734. // Node v6 and later
  38735. util.encodeBase64 = function (arr) { // v6 and later
  38736. return Buffer.from(arr).toString('base64');
  38737. };
  38738. util.decodeBase64 = function (s) {
  38739. validateBase64(s);
  38740. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  38741. };
  38742. } else {
  38743. // Node earlier than v6
  38744. util.encodeBase64 = function (arr) { // v6 and later
  38745. return (new Buffer(arr)).toString('base64');
  38746. };
  38747. util.decodeBase64 = function(s) {
  38748. validateBase64(s);
  38749. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  38750. };
  38751. }
  38752. } else {
  38753. // Browsers
  38754. util.encodeBase64 = function(arr) {
  38755. var i, s = [], len = arr.length;
  38756. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  38757. return btoa(s.join(''));
  38758. };
  38759. util.decodeBase64 = function(s) {
  38760. validateBase64(s);
  38761. var i, d = atob(s), b = new Uint8Array(d.length);
  38762. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38763. return b;
  38764. };
  38765. }
  38766. return util;
  38767. }));
  38768. /***/ }),
  38769. /* 2 */
  38770. /***/ (function(module, exports, __webpack_require__) {
  38771. // required so we don't have to do require('pusher').default etc.
  38772. module.exports = __webpack_require__(4).default;
  38773. /***/ }),
  38774. /* 3 */
  38775. /***/ (function(module, exports) {
  38776. /* (ignored) */
  38777. /***/ }),
  38778. /* 4 */
  38779. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38780. "use strict";
  38781. __webpack_require__.r(__webpack_exports__);
  38782. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  38783. var ScriptReceiverFactory = (function () {
  38784. function ScriptReceiverFactory(prefix, name) {
  38785. this.lastId = 0;
  38786. this.prefix = prefix;
  38787. this.name = name;
  38788. }
  38789. ScriptReceiverFactory.prototype.create = function (callback) {
  38790. this.lastId++;
  38791. var number = this.lastId;
  38792. var id = this.prefix + number;
  38793. var name = this.name + "[" + number + "]";
  38794. var called = false;
  38795. var callbackWrapper = function () {
  38796. if (!called) {
  38797. callback.apply(null, arguments);
  38798. called = true;
  38799. }
  38800. };
  38801. this[number] = callbackWrapper;
  38802. return { number: number, id: id, name: name, callback: callbackWrapper };
  38803. };
  38804. ScriptReceiverFactory.prototype.remove = function (receiver) {
  38805. delete this[receiver.number];
  38806. };
  38807. return ScriptReceiverFactory;
  38808. }());
  38809. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  38810. // CONCATENATED MODULE: ./src/core/defaults.ts
  38811. var Defaults = {
  38812. VERSION: "5.0.3",
  38813. PROTOCOL: 7,
  38814. host: 'ws.pusherapp.com',
  38815. ws_port: 80,
  38816. wss_port: 443,
  38817. ws_path: '',
  38818. sockjs_host: 'sockjs.pusher.com',
  38819. sockjs_http_port: 80,
  38820. sockjs_https_port: 443,
  38821. sockjs_path: '/pusher',
  38822. stats_host: 'stats.pusher.com',
  38823. channel_auth_endpoint: '/pusher/auth',
  38824. channel_auth_transport: 'ajax',
  38825. activity_timeout: 120000,
  38826. pong_timeout: 30000,
  38827. unavailable_timeout: 10000,
  38828. cdn_http: "http://js.pusher.com",
  38829. cdn_https: "https://js.pusher.com",
  38830. dependency_suffix: ""
  38831. };
  38832. /* harmony default export */ var defaults = (Defaults);
  38833. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  38834. var dependency_loader_DependencyLoader = (function () {
  38835. function DependencyLoader(options) {
  38836. this.options = options;
  38837. this.receivers = options.receivers || ScriptReceivers;
  38838. this.loading = {};
  38839. }
  38840. DependencyLoader.prototype.load = function (name, options, callback) {
  38841. var self = this;
  38842. if (self.loading[name] && self.loading[name].length > 0) {
  38843. self.loading[name].push(callback);
  38844. }
  38845. else {
  38846. self.loading[name] = [callback];
  38847. var request = runtime.createScriptRequest(self.getPath(name, options));
  38848. var receiver = self.receivers.create(function (error) {
  38849. self.receivers.remove(receiver);
  38850. if (self.loading[name]) {
  38851. var callbacks = self.loading[name];
  38852. delete self.loading[name];
  38853. var successCallback = function (wasSuccessful) {
  38854. if (!wasSuccessful) {
  38855. request.cleanup();
  38856. }
  38857. };
  38858. for (var i = 0; i < callbacks.length; i++) {
  38859. callbacks[i](error, successCallback);
  38860. }
  38861. }
  38862. });
  38863. request.send(receiver);
  38864. }
  38865. };
  38866. DependencyLoader.prototype.getRoot = function (options) {
  38867. var cdn;
  38868. var protocol = runtime.getDocument().location.protocol;
  38869. if ((options && options.useTLS) || protocol === "https:") {
  38870. cdn = this.options.cdn_https;
  38871. }
  38872. else {
  38873. cdn = this.options.cdn_http;
  38874. }
  38875. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  38876. };
  38877. DependencyLoader.prototype.getPath = function (name, options) {
  38878. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  38879. };
  38880. ;
  38881. return DependencyLoader;
  38882. }());
  38883. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  38884. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  38885. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  38886. var Dependencies = new dependency_loader({
  38887. cdn_http: defaults.cdn_http,
  38888. cdn_https: defaults.cdn_https,
  38889. version: defaults.VERSION,
  38890. suffix: defaults.dependency_suffix,
  38891. receivers: DependenciesReceivers
  38892. });
  38893. // CONCATENATED MODULE: ./src/core/base64.ts
  38894. function encode(s) {
  38895. return btoa(utob(s));
  38896. }
  38897. var fromCharCode = String.fromCharCode;
  38898. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  38899. var b64tab = {};
  38900. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  38901. b64tab[b64chars.charAt(base64_i)] = base64_i;
  38902. }
  38903. var cb_utob = function (c) {
  38904. var cc = c.charCodeAt(0);
  38905. return cc < 0x80
  38906. ? c
  38907. : cc < 0x800
  38908. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  38909. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  38910. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  38911. fromCharCode(0x80 | (cc & 0x3f));
  38912. };
  38913. var utob = function (u) {
  38914. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  38915. };
  38916. var cb_encode = function (ccc) {
  38917. var padlen = [0, 2, 1][ccc.length % 3];
  38918. var ord = (ccc.charCodeAt(0) << 16) |
  38919. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  38920. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  38921. var chars = [
  38922. b64chars.charAt(ord >>> 18),
  38923. b64chars.charAt((ord >>> 12) & 63),
  38924. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  38925. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  38926. ];
  38927. return chars.join('');
  38928. };
  38929. var btoa = window.btoa ||
  38930. function (b) {
  38931. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  38932. };
  38933. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  38934. var Timer = (function () {
  38935. function Timer(set, clear, delay, callback) {
  38936. var _this = this;
  38937. this.clear = clear;
  38938. this.timer = set(function () {
  38939. if (_this.timer) {
  38940. _this.timer = callback(_this.timer);
  38941. }
  38942. }, delay);
  38943. }
  38944. Timer.prototype.isRunning = function () {
  38945. return this.timer !== null;
  38946. };
  38947. Timer.prototype.ensureAborted = function () {
  38948. if (this.timer) {
  38949. this.clear(this.timer);
  38950. this.timer = null;
  38951. }
  38952. };
  38953. return Timer;
  38954. }());
  38955. /* harmony default export */ var abstract_timer = (Timer);
  38956. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  38957. var __extends = (undefined && undefined.__extends) || (function () {
  38958. var extendStatics = function (d, b) {
  38959. extendStatics = Object.setPrototypeOf ||
  38960. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  38961. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  38962. return extendStatics(d, b);
  38963. };
  38964. return function (d, b) {
  38965. extendStatics(d, b);
  38966. function __() { this.constructor = d; }
  38967. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  38968. };
  38969. })();
  38970. function timers_clearTimeout(timer) {
  38971. window.clearTimeout(timer);
  38972. }
  38973. function timers_clearInterval(timer) {
  38974. window.clearInterval(timer);
  38975. }
  38976. var OneOffTimer = (function (_super) {
  38977. __extends(OneOffTimer, _super);
  38978. function OneOffTimer(delay, callback) {
  38979. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  38980. callback();
  38981. return null;
  38982. }) || this;
  38983. }
  38984. return OneOffTimer;
  38985. }(abstract_timer));
  38986. var PeriodicTimer = (function (_super) {
  38987. __extends(PeriodicTimer, _super);
  38988. function PeriodicTimer(delay, callback) {
  38989. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  38990. callback();
  38991. return timer;
  38992. }) || this;
  38993. }
  38994. return PeriodicTimer;
  38995. }(abstract_timer));
  38996. // CONCATENATED MODULE: ./src/core/util.ts
  38997. var Util = {
  38998. now: function () {
  38999. if (Date.now) {
  39000. return Date.now();
  39001. }
  39002. else {
  39003. return new Date().valueOf();
  39004. }
  39005. },
  39006. defer: function (callback) {
  39007. return new OneOffTimer(0, callback);
  39008. },
  39009. method: function (name) {
  39010. var args = [];
  39011. for (var _i = 1; _i < arguments.length; _i++) {
  39012. args[_i - 1] = arguments[_i];
  39013. }
  39014. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39015. return function (object) {
  39016. return object[name].apply(object, boundArguments.concat(arguments));
  39017. };
  39018. }
  39019. };
  39020. /* harmony default export */ var util = (Util);
  39021. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39022. function extend(target) {
  39023. var sources = [];
  39024. for (var _i = 1; _i < arguments.length; _i++) {
  39025. sources[_i - 1] = arguments[_i];
  39026. }
  39027. for (var i = 0; i < sources.length; i++) {
  39028. var extensions = sources[i];
  39029. for (var property in extensions) {
  39030. if (extensions[property] && extensions[property].constructor &&
  39031. extensions[property].constructor === Object) {
  39032. target[property] = extend(target[property] || {}, extensions[property]);
  39033. }
  39034. else {
  39035. target[property] = extensions[property];
  39036. }
  39037. }
  39038. }
  39039. return target;
  39040. }
  39041. function stringify() {
  39042. var m = ["Pusher"];
  39043. for (var i = 0; i < arguments.length; i++) {
  39044. if (typeof arguments[i] === "string") {
  39045. m.push(arguments[i]);
  39046. }
  39047. else {
  39048. m.push(safeJSONStringify(arguments[i]));
  39049. }
  39050. }
  39051. return m.join(" : ");
  39052. }
  39053. function arrayIndexOf(array, item) {
  39054. var nativeIndexOf = Array.prototype.indexOf;
  39055. if (array === null) {
  39056. return -1;
  39057. }
  39058. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39059. return array.indexOf(item);
  39060. }
  39061. for (var i = 0, l = array.length; i < l; i++) {
  39062. if (array[i] === item) {
  39063. return i;
  39064. }
  39065. }
  39066. return -1;
  39067. }
  39068. function objectApply(object, f) {
  39069. for (var key in object) {
  39070. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39071. f(object[key], key, object);
  39072. }
  39073. }
  39074. }
  39075. function keys(object) {
  39076. var keys = [];
  39077. objectApply(object, function (_, key) {
  39078. keys.push(key);
  39079. });
  39080. return keys;
  39081. }
  39082. function values(object) {
  39083. var values = [];
  39084. objectApply(object, function (value) {
  39085. values.push(value);
  39086. });
  39087. return values;
  39088. }
  39089. function apply(array, f, context) {
  39090. for (var i = 0; i < array.length; i++) {
  39091. f.call(context || window, array[i], i, array);
  39092. }
  39093. }
  39094. function map(array, f) {
  39095. var result = [];
  39096. for (var i = 0; i < array.length; i++) {
  39097. result.push(f(array[i], i, array, result));
  39098. }
  39099. return result;
  39100. }
  39101. function mapObject(object, f) {
  39102. var result = {};
  39103. objectApply(object, function (value, key) {
  39104. result[key] = f(value);
  39105. });
  39106. return result;
  39107. }
  39108. function filter(array, test) {
  39109. test = test || function (value) { return !!value; };
  39110. var result = [];
  39111. for (var i = 0; i < array.length; i++) {
  39112. if (test(array[i], i, array, result)) {
  39113. result.push(array[i]);
  39114. }
  39115. }
  39116. return result;
  39117. }
  39118. function filterObject(object, test) {
  39119. var result = {};
  39120. objectApply(object, function (value, key) {
  39121. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39122. result[key] = value;
  39123. }
  39124. });
  39125. return result;
  39126. }
  39127. function flatten(object) {
  39128. var result = [];
  39129. objectApply(object, function (value, key) {
  39130. result.push([key, value]);
  39131. });
  39132. return result;
  39133. }
  39134. function any(array, test) {
  39135. for (var i = 0; i < array.length; i++) {
  39136. if (test(array[i], i, array)) {
  39137. return true;
  39138. }
  39139. }
  39140. return false;
  39141. }
  39142. function collections_all(array, test) {
  39143. for (var i = 0; i < array.length; i++) {
  39144. if (!test(array[i], i, array)) {
  39145. return false;
  39146. }
  39147. }
  39148. return true;
  39149. }
  39150. function encodeParamsObject(data) {
  39151. return mapObject(data, function (value) {
  39152. if (typeof value === "object") {
  39153. value = safeJSONStringify(value);
  39154. }
  39155. return encodeURIComponent(encode(value.toString()));
  39156. });
  39157. }
  39158. function buildQueryString(data) {
  39159. var params = filterObject(data, function (value) {
  39160. return value !== undefined;
  39161. });
  39162. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39163. return query;
  39164. }
  39165. function decycleObject(object) {
  39166. var objects = [], paths = [];
  39167. return (function derez(value, path) {
  39168. var i, name, nu;
  39169. switch (typeof value) {
  39170. case 'object':
  39171. if (!value) {
  39172. return null;
  39173. }
  39174. for (i = 0; i < objects.length; i += 1) {
  39175. if (objects[i] === value) {
  39176. return { $ref: paths[i] };
  39177. }
  39178. }
  39179. objects.push(value);
  39180. paths.push(path);
  39181. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39182. nu = [];
  39183. for (i = 0; i < value.length; i += 1) {
  39184. nu[i] = derez(value[i], path + '[' + i + ']');
  39185. }
  39186. }
  39187. else {
  39188. nu = {};
  39189. for (name in value) {
  39190. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39191. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39192. }
  39193. }
  39194. }
  39195. return nu;
  39196. case 'number':
  39197. case 'string':
  39198. case 'boolean':
  39199. return value;
  39200. }
  39201. }(object, '$'));
  39202. }
  39203. function safeJSONStringify(source) {
  39204. try {
  39205. return JSON.stringify(source);
  39206. }
  39207. catch (e) {
  39208. return JSON.stringify(decycleObject(source));
  39209. }
  39210. }
  39211. // CONCATENATED MODULE: ./src/core/logger.ts
  39212. var logger_Logger = (function () {
  39213. function Logger() {
  39214. this.globalLog = function (message) {
  39215. if (window.console && window.console.log) {
  39216. window.console.log(message);
  39217. }
  39218. };
  39219. }
  39220. Logger.prototype.debug = function () {
  39221. var args = [];
  39222. for (var _i = 0; _i < arguments.length; _i++) {
  39223. args[_i] = arguments[_i];
  39224. }
  39225. this.log(this.globalLog, args);
  39226. };
  39227. Logger.prototype.warn = function () {
  39228. var args = [];
  39229. for (var _i = 0; _i < arguments.length; _i++) {
  39230. args[_i] = arguments[_i];
  39231. }
  39232. this.log(this.globalLogWarn, args);
  39233. };
  39234. Logger.prototype.error = function () {
  39235. var args = [];
  39236. for (var _i = 0; _i < arguments.length; _i++) {
  39237. args[_i] = arguments[_i];
  39238. }
  39239. this.log(this.globalLogError, args);
  39240. };
  39241. Logger.prototype.globalLogWarn = function (message) {
  39242. if (window.console && window.console.warn) {
  39243. window.console.warn(message);
  39244. }
  39245. else {
  39246. this.globalLog(message);
  39247. }
  39248. };
  39249. Logger.prototype.globalLogError = function (message) {
  39250. if (window.console && window.console.error) {
  39251. window.console.error(message);
  39252. }
  39253. else {
  39254. this.globalLogWarn(message);
  39255. }
  39256. };
  39257. Logger.prototype.log = function (defaultLoggingFunction) {
  39258. var args = [];
  39259. for (var _i = 1; _i < arguments.length; _i++) {
  39260. args[_i - 1] = arguments[_i];
  39261. }
  39262. var message = stringify.apply(this, arguments);
  39263. if (core_pusher.log) {
  39264. core_pusher.log(message);
  39265. }
  39266. else if (core_pusher.logToConsole) {
  39267. var log = defaultLoggingFunction.bind(this);
  39268. log(message);
  39269. }
  39270. };
  39271. return Logger;
  39272. }());
  39273. /* harmony default export */ var logger = (new logger_Logger());
  39274. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39275. var urlStore = {
  39276. baseUrl: "https://pusher.com",
  39277. urls: {
  39278. authenticationEndpoint: {
  39279. path: "/docs/authenticating_users",
  39280. },
  39281. javascriptQuickStart: {
  39282. path: "/docs/javascript_quick_start"
  39283. },
  39284. triggeringClientEvents: {
  39285. path: "/docs/client_api_guide/client_events#trigger-events"
  39286. }
  39287. }
  39288. };
  39289. var buildLogSuffix = function (key) {
  39290. var urlPrefix = "See:";
  39291. var urlObj = urlStore.urls[key];
  39292. if (!urlObj)
  39293. return "";
  39294. var url;
  39295. if (urlObj.fullUrl) {
  39296. url = urlObj.fullUrl;
  39297. }
  39298. else if (urlObj.path) {
  39299. url = urlStore.baseUrl + urlObj.path;
  39300. }
  39301. if (!url)
  39302. return "";
  39303. return urlPrefix + " " + url;
  39304. };
  39305. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39306. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39307. var ajax = function (context, socketId, callback) {
  39308. var self = this, xhr;
  39309. xhr = runtime.createXHR();
  39310. xhr.open("POST", self.options.authEndpoint, true);
  39311. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39312. for (var headerName in this.authOptions.headers) {
  39313. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39314. }
  39315. xhr.onreadystatechange = function () {
  39316. if (xhr.readyState === 4) {
  39317. if (xhr.status === 200) {
  39318. var data, parsed = false;
  39319. try {
  39320. data = JSON.parse(xhr.responseText);
  39321. parsed = true;
  39322. }
  39323. catch (e) {
  39324. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39325. }
  39326. if (parsed) {
  39327. callback(false, data);
  39328. }
  39329. }
  39330. else {
  39331. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39332. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39333. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39334. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39335. callback(true, xhr.status);
  39336. }
  39337. }
  39338. };
  39339. xhr.send(this.composeQuery(socketId));
  39340. return xhr;
  39341. };
  39342. /* harmony default export */ var xhr_auth = (ajax);
  39343. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39344. var jsonp = function (context, socketId, callback) {
  39345. if (this.authOptions.headers !== undefined) {
  39346. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39347. }
  39348. var callbackName = context.nextAuthCallbackID.toString();
  39349. context.nextAuthCallbackID++;
  39350. var document = context.getDocument();
  39351. var script = document.createElement("script");
  39352. context.auth_callbacks[callbackName] = function (data) {
  39353. callback(false, data);
  39354. };
  39355. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39356. script.src = this.options.authEndpoint +
  39357. '?callback=' +
  39358. encodeURIComponent(callback_name) +
  39359. '&' +
  39360. this.composeQuery(socketId);
  39361. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39362. head.insertBefore(script, head.firstChild);
  39363. };
  39364. /* harmony default export */ var jsonp_auth = (jsonp);
  39365. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39366. var ScriptRequest = (function () {
  39367. function ScriptRequest(src) {
  39368. this.src = src;
  39369. }
  39370. ScriptRequest.prototype.send = function (receiver) {
  39371. var self = this;
  39372. var errorString = "Error loading " + self.src;
  39373. self.script = document.createElement("script");
  39374. self.script.id = receiver.id;
  39375. self.script.src = self.src;
  39376. self.script.type = "text/javascript";
  39377. self.script.charset = "UTF-8";
  39378. if (self.script.addEventListener) {
  39379. self.script.onerror = function () {
  39380. receiver.callback(errorString);
  39381. };
  39382. self.script.onload = function () {
  39383. receiver.callback(null);
  39384. };
  39385. }
  39386. else {
  39387. self.script.onreadystatechange = function () {
  39388. if (self.script.readyState === 'loaded' ||
  39389. self.script.readyState === 'complete') {
  39390. receiver.callback(null);
  39391. }
  39392. };
  39393. }
  39394. if (self.script.async === undefined && document.attachEvent &&
  39395. /opera/i.test(navigator.userAgent)) {
  39396. self.errorScript = document.createElement("script");
  39397. self.errorScript.id = receiver.id + "_error";
  39398. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39399. self.script.async = self.errorScript.async = false;
  39400. }
  39401. else {
  39402. self.script.async = true;
  39403. }
  39404. var head = document.getElementsByTagName('head')[0];
  39405. head.insertBefore(self.script, head.firstChild);
  39406. if (self.errorScript) {
  39407. head.insertBefore(self.errorScript, self.script.nextSibling);
  39408. }
  39409. };
  39410. ScriptRequest.prototype.cleanup = function () {
  39411. if (this.script) {
  39412. this.script.onload = this.script.onerror = null;
  39413. this.script.onreadystatechange = null;
  39414. }
  39415. if (this.script && this.script.parentNode) {
  39416. this.script.parentNode.removeChild(this.script);
  39417. }
  39418. if (this.errorScript && this.errorScript.parentNode) {
  39419. this.errorScript.parentNode.removeChild(this.errorScript);
  39420. }
  39421. this.script = null;
  39422. this.errorScript = null;
  39423. };
  39424. return ScriptRequest;
  39425. }());
  39426. /* harmony default export */ var script_request = (ScriptRequest);
  39427. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39428. var jsonp_request_JSONPRequest = (function () {
  39429. function JSONPRequest(url, data) {
  39430. this.url = url;
  39431. this.data = data;
  39432. }
  39433. JSONPRequest.prototype.send = function (receiver) {
  39434. if (this.request) {
  39435. return;
  39436. }
  39437. var query = buildQueryString(this.data);
  39438. var url = this.url + "/" + receiver.number + "?" + query;
  39439. this.request = runtime.createScriptRequest(url);
  39440. this.request.send(receiver);
  39441. };
  39442. JSONPRequest.prototype.cleanup = function () {
  39443. if (this.request) {
  39444. this.request.cleanup();
  39445. }
  39446. };
  39447. return JSONPRequest;
  39448. }());
  39449. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39450. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39451. var getAgent = function (sender, useTLS) {
  39452. return function (data, callback) {
  39453. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39454. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39455. var request = runtime.createJSONPRequest(url, data);
  39456. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39457. ScriptReceivers.remove(receiver);
  39458. request.cleanup();
  39459. if (result && result.host) {
  39460. sender.host = result.host;
  39461. }
  39462. if (callback) {
  39463. callback(error, result);
  39464. }
  39465. });
  39466. request.send(receiver);
  39467. };
  39468. };
  39469. var jsonp_timeline_jsonp = {
  39470. name: 'jsonp',
  39471. getAgent: getAgent
  39472. };
  39473. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39474. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39475. function getGenericURL(baseScheme, params, path) {
  39476. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39477. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39478. return scheme + "://" + host + path;
  39479. }
  39480. function getGenericPath(key, queryString) {
  39481. var path = "/app/" + key;
  39482. var query = "?protocol=" + defaults.PROTOCOL +
  39483. "&client=js" +
  39484. "&version=" + defaults.VERSION +
  39485. (queryString ? ("&" + queryString) : "");
  39486. return path + query;
  39487. }
  39488. var ws = {
  39489. getInitial: function (key, params) {
  39490. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39491. return getGenericURL("ws", params, path);
  39492. }
  39493. };
  39494. var http = {
  39495. getInitial: function (key, params) {
  39496. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39497. return getGenericURL("http", params, path);
  39498. }
  39499. };
  39500. var sockjs = {
  39501. getInitial: function (key, params) {
  39502. return getGenericURL("http", params, params.httpPath || "/pusher");
  39503. },
  39504. getPath: function (key, params) {
  39505. return getGenericPath(key);
  39506. }
  39507. };
  39508. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39509. var callback_registry_CallbackRegistry = (function () {
  39510. function CallbackRegistry() {
  39511. this._callbacks = {};
  39512. }
  39513. CallbackRegistry.prototype.get = function (name) {
  39514. return this._callbacks[prefix(name)];
  39515. };
  39516. CallbackRegistry.prototype.add = function (name, callback, context) {
  39517. var prefixedEventName = prefix(name);
  39518. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39519. this._callbacks[prefixedEventName].push({
  39520. fn: callback,
  39521. context: context
  39522. });
  39523. };
  39524. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39525. if (!name && !callback && !context) {
  39526. this._callbacks = {};
  39527. return;
  39528. }
  39529. var names = name ? [prefix(name)] : keys(this._callbacks);
  39530. if (callback || context) {
  39531. this.removeCallback(names, callback, context);
  39532. }
  39533. else {
  39534. this.removeAllCallbacks(names);
  39535. }
  39536. };
  39537. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39538. apply(names, function (name) {
  39539. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39540. return (callback && callback !== binding.fn) ||
  39541. (context && context !== binding.context);
  39542. });
  39543. if (this._callbacks[name].length === 0) {
  39544. delete this._callbacks[name];
  39545. }
  39546. }, this);
  39547. };
  39548. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39549. apply(names, function (name) {
  39550. delete this._callbacks[name];
  39551. }, this);
  39552. };
  39553. return CallbackRegistry;
  39554. }());
  39555. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39556. function prefix(name) {
  39557. return "_" + name;
  39558. }
  39559. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39560. var dispatcher_Dispatcher = (function () {
  39561. function Dispatcher(failThrough) {
  39562. this.callbacks = new callback_registry();
  39563. this.global_callbacks = [];
  39564. this.failThrough = failThrough;
  39565. }
  39566. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39567. this.callbacks.add(eventName, callback, context);
  39568. return this;
  39569. };
  39570. Dispatcher.prototype.bind_global = function (callback) {
  39571. this.global_callbacks.push(callback);
  39572. return this;
  39573. };
  39574. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39575. this.callbacks.remove(eventName, callback, context);
  39576. return this;
  39577. };
  39578. Dispatcher.prototype.unbind_global = function (callback) {
  39579. if (!callback) {
  39580. this.global_callbacks = [];
  39581. return this;
  39582. }
  39583. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39584. return this;
  39585. };
  39586. Dispatcher.prototype.unbind_all = function () {
  39587. this.unbind();
  39588. this.unbind_global();
  39589. return this;
  39590. };
  39591. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39592. for (var i = 0; i < this.global_callbacks.length; i++) {
  39593. this.global_callbacks[i](eventName, data);
  39594. }
  39595. var callbacks = this.callbacks.get(eventName);
  39596. var args = [];
  39597. if (metadata) {
  39598. args.push(data, metadata);
  39599. }
  39600. else if (data) {
  39601. args.push(data);
  39602. }
  39603. if (callbacks && callbacks.length > 0) {
  39604. for (var i = 0; i < callbacks.length; i++) {
  39605. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39606. }
  39607. }
  39608. else if (this.failThrough) {
  39609. this.failThrough(eventName, data);
  39610. }
  39611. return this;
  39612. };
  39613. return Dispatcher;
  39614. }());
  39615. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39616. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39617. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39618. var extendStatics = function (d, b) {
  39619. extendStatics = Object.setPrototypeOf ||
  39620. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39621. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39622. return extendStatics(d, b);
  39623. };
  39624. return function (d, b) {
  39625. extendStatics(d, b);
  39626. function __() { this.constructor = d; }
  39627. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39628. };
  39629. })();
  39630. var transport_connection_TransportConnection = (function (_super) {
  39631. transport_connection_extends(TransportConnection, _super);
  39632. function TransportConnection(hooks, name, priority, key, options) {
  39633. var _this = _super.call(this) || this;
  39634. _this.initialize = runtime.transportConnectionInitializer;
  39635. _this.hooks = hooks;
  39636. _this.name = name;
  39637. _this.priority = priority;
  39638. _this.key = key;
  39639. _this.options = options;
  39640. _this.state = "new";
  39641. _this.timeline = options.timeline;
  39642. _this.activityTimeout = options.activityTimeout;
  39643. _this.id = _this.timeline.generateUniqueID();
  39644. return _this;
  39645. }
  39646. TransportConnection.prototype.handlesActivityChecks = function () {
  39647. return Boolean(this.hooks.handlesActivityChecks);
  39648. };
  39649. TransportConnection.prototype.supportsPing = function () {
  39650. return Boolean(this.hooks.supportsPing);
  39651. };
  39652. TransportConnection.prototype.connect = function () {
  39653. var _this = this;
  39654. if (this.socket || this.state !== "initialized") {
  39655. return false;
  39656. }
  39657. var url = this.hooks.urls.getInitial(this.key, this.options);
  39658. try {
  39659. this.socket = this.hooks.getSocket(url, this.options);
  39660. }
  39661. catch (e) {
  39662. util.defer(function () {
  39663. _this.onError(e);
  39664. _this.changeState("closed");
  39665. });
  39666. return false;
  39667. }
  39668. this.bindListeners();
  39669. logger.debug("Connecting", { transport: this.name, url: url });
  39670. this.changeState("connecting");
  39671. return true;
  39672. };
  39673. TransportConnection.prototype.close = function () {
  39674. if (this.socket) {
  39675. this.socket.close();
  39676. return true;
  39677. }
  39678. else {
  39679. return false;
  39680. }
  39681. };
  39682. TransportConnection.prototype.send = function (data) {
  39683. var _this = this;
  39684. if (this.state === "open") {
  39685. util.defer(function () {
  39686. if (_this.socket) {
  39687. _this.socket.send(data);
  39688. }
  39689. });
  39690. return true;
  39691. }
  39692. else {
  39693. return false;
  39694. }
  39695. };
  39696. TransportConnection.prototype.ping = function () {
  39697. if (this.state === "open" && this.supportsPing()) {
  39698. this.socket.ping();
  39699. }
  39700. };
  39701. TransportConnection.prototype.onOpen = function () {
  39702. if (this.hooks.beforeOpen) {
  39703. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39704. }
  39705. this.changeState("open");
  39706. this.socket.onopen = undefined;
  39707. };
  39708. TransportConnection.prototype.onError = function (error) {
  39709. this.emit("error", { type: 'WebSocketError', error: error });
  39710. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39711. };
  39712. TransportConnection.prototype.onClose = function (closeEvent) {
  39713. if (closeEvent) {
  39714. this.changeState("closed", {
  39715. code: closeEvent.code,
  39716. reason: closeEvent.reason,
  39717. wasClean: closeEvent.wasClean
  39718. });
  39719. }
  39720. else {
  39721. this.changeState("closed");
  39722. }
  39723. this.unbindListeners();
  39724. this.socket = undefined;
  39725. };
  39726. TransportConnection.prototype.onMessage = function (message) {
  39727. this.emit("message", message);
  39728. };
  39729. TransportConnection.prototype.onActivity = function () {
  39730. this.emit("activity");
  39731. };
  39732. TransportConnection.prototype.bindListeners = function () {
  39733. var _this = this;
  39734. this.socket.onopen = function () {
  39735. _this.onOpen();
  39736. };
  39737. this.socket.onerror = function (error) {
  39738. _this.onError(error);
  39739. };
  39740. this.socket.onclose = function (closeEvent) {
  39741. _this.onClose(closeEvent);
  39742. };
  39743. this.socket.onmessage = function (message) {
  39744. _this.onMessage(message);
  39745. };
  39746. if (this.supportsPing()) {
  39747. this.socket.onactivity = function () { _this.onActivity(); };
  39748. }
  39749. };
  39750. TransportConnection.prototype.unbindListeners = function () {
  39751. if (this.socket) {
  39752. this.socket.onopen = undefined;
  39753. this.socket.onerror = undefined;
  39754. this.socket.onclose = undefined;
  39755. this.socket.onmessage = undefined;
  39756. if (this.supportsPing()) {
  39757. this.socket.onactivity = undefined;
  39758. }
  39759. }
  39760. };
  39761. TransportConnection.prototype.changeState = function (state, params) {
  39762. this.state = state;
  39763. this.timeline.info(this.buildTimelineMessage({
  39764. state: state,
  39765. params: params
  39766. }));
  39767. this.emit(state, params);
  39768. };
  39769. TransportConnection.prototype.buildTimelineMessage = function (message) {
  39770. return extend({ cid: this.id }, message);
  39771. };
  39772. return TransportConnection;
  39773. }(dispatcher));
  39774. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  39775. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  39776. var transport_Transport = (function () {
  39777. function Transport(hooks) {
  39778. this.hooks = hooks;
  39779. }
  39780. Transport.prototype.isSupported = function (environment) {
  39781. return this.hooks.isSupported(environment);
  39782. };
  39783. Transport.prototype.createConnection = function (name, priority, key, options) {
  39784. return new transport_connection(this.hooks, name, priority, key, options);
  39785. };
  39786. return Transport;
  39787. }());
  39788. /* harmony default export */ var transports_transport = (transport_Transport);
  39789. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  39790. var WSTransport = new transports_transport({
  39791. urls: ws,
  39792. handlesActivityChecks: false,
  39793. supportsPing: false,
  39794. isInitialized: function () {
  39795. return Boolean(runtime.getWebSocketAPI());
  39796. },
  39797. isSupported: function () {
  39798. return Boolean(runtime.getWebSocketAPI());
  39799. },
  39800. getSocket: function (url) {
  39801. return runtime.createWebSocket(url);
  39802. }
  39803. });
  39804. var httpConfiguration = {
  39805. urls: http,
  39806. handlesActivityChecks: false,
  39807. supportsPing: true,
  39808. isInitialized: function () {
  39809. return true;
  39810. }
  39811. };
  39812. var streamingConfiguration = extend({ getSocket: function (url) {
  39813. return runtime.HTTPFactory.createStreamingSocket(url);
  39814. }
  39815. }, httpConfiguration);
  39816. var pollingConfiguration = extend({ getSocket: function (url) {
  39817. return runtime.HTTPFactory.createPollingSocket(url);
  39818. }
  39819. }, httpConfiguration);
  39820. var xhrConfiguration = {
  39821. isSupported: function () {
  39822. return runtime.isXHRSupported();
  39823. }
  39824. };
  39825. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  39826. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  39827. var Transports = {
  39828. ws: WSTransport,
  39829. xhr_streaming: XHRStreamingTransport,
  39830. xhr_polling: XHRPollingTransport
  39831. };
  39832. /* harmony default export */ var transports = (Transports);
  39833. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  39834. var SockJSTransport = new transports_transport({
  39835. file: "sockjs",
  39836. urls: sockjs,
  39837. handlesActivityChecks: true,
  39838. supportsPing: false,
  39839. isSupported: function () {
  39840. return true;
  39841. },
  39842. isInitialized: function () {
  39843. return window.SockJS !== undefined;
  39844. },
  39845. getSocket: function (url, options) {
  39846. return new window.SockJS(url, null, {
  39847. js_path: Dependencies.getPath("sockjs", {
  39848. useTLS: options.useTLS
  39849. }),
  39850. ignore_null_origin: options.ignoreNullOrigin
  39851. });
  39852. },
  39853. beforeOpen: function (socket, path) {
  39854. socket.send(JSON.stringify({
  39855. path: path
  39856. }));
  39857. }
  39858. });
  39859. var xdrConfiguration = {
  39860. isSupported: function (environment) {
  39861. var yes = runtime.isXDRSupported(environment.useTLS);
  39862. return yes;
  39863. }
  39864. };
  39865. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  39866. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  39867. transports.xdr_streaming = XDRStreamingTransport;
  39868. transports.xdr_polling = XDRPollingTransport;
  39869. transports.sockjs = SockJSTransport;
  39870. /* harmony default export */ var transports_transports = (transports);
  39871. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  39872. var net_info_extends = (undefined && undefined.__extends) || (function () {
  39873. var extendStatics = function (d, b) {
  39874. extendStatics = Object.setPrototypeOf ||
  39875. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39876. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39877. return extendStatics(d, b);
  39878. };
  39879. return function (d, b) {
  39880. extendStatics(d, b);
  39881. function __() { this.constructor = d; }
  39882. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39883. };
  39884. })();
  39885. var NetInfo = (function (_super) {
  39886. net_info_extends(NetInfo, _super);
  39887. function NetInfo() {
  39888. var _this = _super.call(this) || this;
  39889. var self = _this;
  39890. if (window.addEventListener !== undefined) {
  39891. window.addEventListener("online", function () {
  39892. self.emit('online');
  39893. }, false);
  39894. window.addEventListener("offline", function () {
  39895. self.emit('offline');
  39896. }, false);
  39897. }
  39898. return _this;
  39899. }
  39900. NetInfo.prototype.isOnline = function () {
  39901. if (window.navigator.onLine === undefined) {
  39902. return true;
  39903. }
  39904. else {
  39905. return window.navigator.onLine;
  39906. }
  39907. };
  39908. return NetInfo;
  39909. }(dispatcher));
  39910. var net_info_Network = new NetInfo();
  39911. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  39912. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  39913. function AssistantToTheTransportManager(manager, transport, options) {
  39914. this.manager = manager;
  39915. this.transport = transport;
  39916. this.minPingDelay = options.minPingDelay;
  39917. this.maxPingDelay = options.maxPingDelay;
  39918. this.pingDelay = undefined;
  39919. }
  39920. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  39921. var _this = this;
  39922. options = extend({}, options, {
  39923. activityTimeout: this.pingDelay
  39924. });
  39925. var connection = this.transport.createConnection(name, priority, key, options);
  39926. var openTimestamp = null;
  39927. var onOpen = function () {
  39928. connection.unbind("open", onOpen);
  39929. connection.bind("closed", onClosed);
  39930. openTimestamp = util.now();
  39931. };
  39932. var onClosed = function (closeEvent) {
  39933. connection.unbind("closed", onClosed);
  39934. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  39935. _this.manager.reportDeath();
  39936. }
  39937. else if (!closeEvent.wasClean && openTimestamp) {
  39938. var lifespan = util.now() - openTimestamp;
  39939. if (lifespan < 2 * _this.maxPingDelay) {
  39940. _this.manager.reportDeath();
  39941. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  39942. }
  39943. }
  39944. };
  39945. connection.bind("open", onOpen);
  39946. return connection;
  39947. };
  39948. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  39949. return this.manager.isAlive() && this.transport.isSupported(environment);
  39950. };
  39951. return AssistantToTheTransportManager;
  39952. }());
  39953. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  39954. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  39955. var Protocol = {
  39956. decodeMessage: function (messageEvent) {
  39957. try {
  39958. var messageData = JSON.parse(messageEvent.data);
  39959. var pusherEventData = messageData.data;
  39960. if (typeof pusherEventData === 'string') {
  39961. try {
  39962. pusherEventData = JSON.parse(messageData.data);
  39963. }
  39964. catch (e) { }
  39965. }
  39966. var pusherEvent = {
  39967. event: messageData.event,
  39968. channel: messageData.channel,
  39969. data: pusherEventData,
  39970. };
  39971. if (messageData.user_id) {
  39972. pusherEvent.user_id = messageData.user_id;
  39973. }
  39974. return pusherEvent;
  39975. }
  39976. catch (e) {
  39977. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  39978. }
  39979. },
  39980. encodeMessage: function (event) {
  39981. return JSON.stringify(event);
  39982. },
  39983. processHandshake: function (messageEvent) {
  39984. var message = Protocol.decodeMessage(messageEvent);
  39985. if (message.event === "pusher:connection_established") {
  39986. if (!message.data.activity_timeout) {
  39987. throw "No activity timeout specified in handshake";
  39988. }
  39989. return {
  39990. action: "connected",
  39991. id: message.data.socket_id,
  39992. activityTimeout: message.data.activity_timeout * 1000
  39993. };
  39994. }
  39995. else if (message.event === "pusher:error") {
  39996. return {
  39997. action: this.getCloseAction(message.data),
  39998. error: this.getCloseError(message.data)
  39999. };
  40000. }
  40001. else {
  40002. throw "Invalid handshake";
  40003. }
  40004. },
  40005. getCloseAction: function (closeEvent) {
  40006. if (closeEvent.code < 4000) {
  40007. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40008. return "backoff";
  40009. }
  40010. else {
  40011. return null;
  40012. }
  40013. }
  40014. else if (closeEvent.code === 4000) {
  40015. return "tls_only";
  40016. }
  40017. else if (closeEvent.code < 4100) {
  40018. return "refused";
  40019. }
  40020. else if (closeEvent.code < 4200) {
  40021. return "backoff";
  40022. }
  40023. else if (closeEvent.code < 4300) {
  40024. return "retry";
  40025. }
  40026. else {
  40027. return "refused";
  40028. }
  40029. },
  40030. getCloseError: function (closeEvent) {
  40031. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40032. return {
  40033. type: 'PusherError',
  40034. data: {
  40035. code: closeEvent.code,
  40036. message: closeEvent.reason || closeEvent.message
  40037. }
  40038. };
  40039. }
  40040. else {
  40041. return null;
  40042. }
  40043. }
  40044. };
  40045. /* harmony default export */ var protocol_protocol = (Protocol);
  40046. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40047. var connection_extends = (undefined && undefined.__extends) || (function () {
  40048. var extendStatics = function (d, b) {
  40049. extendStatics = Object.setPrototypeOf ||
  40050. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40051. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40052. return extendStatics(d, b);
  40053. };
  40054. return function (d, b) {
  40055. extendStatics(d, b);
  40056. function __() { this.constructor = d; }
  40057. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40058. };
  40059. })();
  40060. var connection_Connection = (function (_super) {
  40061. connection_extends(Connection, _super);
  40062. function Connection(id, transport) {
  40063. var _this = _super.call(this) || this;
  40064. _this.id = id;
  40065. _this.transport = transport;
  40066. _this.activityTimeout = transport.activityTimeout;
  40067. _this.bindListeners();
  40068. return _this;
  40069. }
  40070. Connection.prototype.handlesActivityChecks = function () {
  40071. return this.transport.handlesActivityChecks();
  40072. };
  40073. Connection.prototype.send = function (data) {
  40074. return this.transport.send(data);
  40075. };
  40076. Connection.prototype.send_event = function (name, data, channel) {
  40077. var event = { event: name, data: data };
  40078. if (channel) {
  40079. event.channel = channel;
  40080. }
  40081. logger.debug('Event sent', event);
  40082. return this.send(protocol_protocol.encodeMessage(event));
  40083. };
  40084. Connection.prototype.ping = function () {
  40085. if (this.transport.supportsPing()) {
  40086. this.transport.ping();
  40087. }
  40088. else {
  40089. this.send_event('pusher:ping', {});
  40090. }
  40091. };
  40092. Connection.prototype.close = function () {
  40093. this.transport.close();
  40094. };
  40095. Connection.prototype.bindListeners = function () {
  40096. var _this = this;
  40097. var listeners = {
  40098. message: function (messageEvent) {
  40099. var pusherEvent;
  40100. try {
  40101. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40102. }
  40103. catch (e) {
  40104. _this.emit('error', {
  40105. type: 'MessageParseError',
  40106. error: e,
  40107. data: messageEvent.data
  40108. });
  40109. }
  40110. if (pusherEvent !== undefined) {
  40111. logger.debug('Event recd', pusherEvent);
  40112. switch (pusherEvent.event) {
  40113. case 'pusher:error':
  40114. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40115. break;
  40116. case 'pusher:ping':
  40117. _this.emit("ping");
  40118. break;
  40119. case 'pusher:pong':
  40120. _this.emit("pong");
  40121. break;
  40122. }
  40123. _this.emit('message', pusherEvent);
  40124. }
  40125. },
  40126. activity: function () {
  40127. _this.emit("activity");
  40128. },
  40129. error: function (error) {
  40130. _this.emit("error", { type: "WebSocketError", error: error });
  40131. },
  40132. closed: function (closeEvent) {
  40133. unbindListeners();
  40134. if (closeEvent && closeEvent.code) {
  40135. _this.handleCloseEvent(closeEvent);
  40136. }
  40137. _this.transport = null;
  40138. _this.emit("closed");
  40139. }
  40140. };
  40141. var unbindListeners = function () {
  40142. objectApply(listeners, function (listener, event) {
  40143. _this.transport.unbind(event, listener);
  40144. });
  40145. };
  40146. objectApply(listeners, function (listener, event) {
  40147. _this.transport.bind(event, listener);
  40148. });
  40149. };
  40150. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40151. var action = protocol_protocol.getCloseAction(closeEvent);
  40152. var error = protocol_protocol.getCloseError(closeEvent);
  40153. if (error) {
  40154. this.emit('error', error);
  40155. }
  40156. if (action) {
  40157. this.emit(action, { action: action, error: error });
  40158. }
  40159. };
  40160. return Connection;
  40161. }(dispatcher));
  40162. /* harmony default export */ var connection_connection = (connection_Connection);
  40163. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40164. var handshake_Handshake = (function () {
  40165. function Handshake(transport, callback) {
  40166. this.transport = transport;
  40167. this.callback = callback;
  40168. this.bindListeners();
  40169. }
  40170. Handshake.prototype.close = function () {
  40171. this.unbindListeners();
  40172. this.transport.close();
  40173. };
  40174. Handshake.prototype.bindListeners = function () {
  40175. var _this = this;
  40176. this.onMessage = function (m) {
  40177. _this.unbindListeners();
  40178. var result;
  40179. try {
  40180. result = protocol_protocol.processHandshake(m);
  40181. }
  40182. catch (e) {
  40183. _this.finish("error", { error: e });
  40184. _this.transport.close();
  40185. return;
  40186. }
  40187. if (result.action === "connected") {
  40188. _this.finish("connected", {
  40189. connection: new connection_connection(result.id, _this.transport),
  40190. activityTimeout: result.activityTimeout
  40191. });
  40192. }
  40193. else {
  40194. _this.finish(result.action, { error: result.error });
  40195. _this.transport.close();
  40196. }
  40197. };
  40198. this.onClosed = function (closeEvent) {
  40199. _this.unbindListeners();
  40200. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40201. var error = protocol_protocol.getCloseError(closeEvent);
  40202. _this.finish(action, { error: error });
  40203. };
  40204. this.transport.bind("message", this.onMessage);
  40205. this.transport.bind("closed", this.onClosed);
  40206. };
  40207. Handshake.prototype.unbindListeners = function () {
  40208. this.transport.unbind("message", this.onMessage);
  40209. this.transport.unbind("closed", this.onClosed);
  40210. };
  40211. Handshake.prototype.finish = function (action, params) {
  40212. this.callback(extend({ transport: this.transport, action: action }, params));
  40213. };
  40214. return Handshake;
  40215. }());
  40216. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40217. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40218. var pusher_authorizer_PusherAuthorizer = (function () {
  40219. function PusherAuthorizer(channel, options) {
  40220. this.channel = channel;
  40221. var authTransport = options.authTransport;
  40222. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40223. throw "'" + authTransport + "' is not a recognized auth transport";
  40224. }
  40225. this.type = authTransport;
  40226. this.options = options;
  40227. this.authOptions = (options || {}).auth || {};
  40228. }
  40229. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40230. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40231. '&channel_name=' + encodeURIComponent(this.channel.name);
  40232. for (var i in this.authOptions.params) {
  40233. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40234. }
  40235. return query;
  40236. };
  40237. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40238. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40239. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40240. };
  40241. return PusherAuthorizer;
  40242. }());
  40243. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40244. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40245. var timeline_sender_TimelineSender = (function () {
  40246. function TimelineSender(timeline, options) {
  40247. this.timeline = timeline;
  40248. this.options = options || {};
  40249. }
  40250. TimelineSender.prototype.send = function (useTLS, callback) {
  40251. if (this.timeline.isEmpty()) {
  40252. return;
  40253. }
  40254. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40255. };
  40256. return TimelineSender;
  40257. }());
  40258. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40259. // CONCATENATED MODULE: ./src/core/errors.ts
  40260. var errors_extends = (undefined && undefined.__extends) || (function () {
  40261. var extendStatics = function (d, b) {
  40262. extendStatics = Object.setPrototypeOf ||
  40263. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40264. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40265. return extendStatics(d, b);
  40266. };
  40267. return function (d, b) {
  40268. extendStatics(d, b);
  40269. function __() { this.constructor = d; }
  40270. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40271. };
  40272. })();
  40273. var BadEventName = (function (_super) {
  40274. errors_extends(BadEventName, _super);
  40275. function BadEventName(msg) {
  40276. var _newTarget = this.constructor;
  40277. var _this = _super.call(this, msg) || this;
  40278. Object.setPrototypeOf(_this, _newTarget.prototype);
  40279. return _this;
  40280. }
  40281. return BadEventName;
  40282. }(Error));
  40283. var RequestTimedOut = (function (_super) {
  40284. errors_extends(RequestTimedOut, _super);
  40285. function RequestTimedOut(msg) {
  40286. var _newTarget = this.constructor;
  40287. var _this = _super.call(this, msg) || this;
  40288. Object.setPrototypeOf(_this, _newTarget.prototype);
  40289. return _this;
  40290. }
  40291. return RequestTimedOut;
  40292. }(Error));
  40293. var TransportPriorityTooLow = (function (_super) {
  40294. errors_extends(TransportPriorityTooLow, _super);
  40295. function TransportPriorityTooLow(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 TransportPriorityTooLow;
  40302. }(Error));
  40303. var TransportClosed = (function (_super) {
  40304. errors_extends(TransportClosed, _super);
  40305. function TransportClosed(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 TransportClosed;
  40312. }(Error));
  40313. var UnsupportedFeature = (function (_super) {
  40314. errors_extends(UnsupportedFeature, _super);
  40315. function UnsupportedFeature(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 UnsupportedFeature;
  40322. }(Error));
  40323. var UnsupportedTransport = (function (_super) {
  40324. errors_extends(UnsupportedTransport, _super);
  40325. function UnsupportedTransport(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 UnsupportedTransport;
  40332. }(Error));
  40333. var UnsupportedStrategy = (function (_super) {
  40334. errors_extends(UnsupportedStrategy, _super);
  40335. function UnsupportedStrategy(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 UnsupportedStrategy;
  40342. }(Error));
  40343. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40344. var channel_extends = (undefined && undefined.__extends) || (function () {
  40345. var extendStatics = function (d, b) {
  40346. extendStatics = Object.setPrototypeOf ||
  40347. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40348. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40349. return extendStatics(d, b);
  40350. };
  40351. return function (d, b) {
  40352. extendStatics(d, b);
  40353. function __() { this.constructor = d; }
  40354. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40355. };
  40356. })();
  40357. var channel_Channel = (function (_super) {
  40358. channel_extends(Channel, _super);
  40359. function Channel(name, pusher) {
  40360. var _this = _super.call(this, function (event, data) {
  40361. logger.debug('No callbacks on ' + name + ' for ' + event);
  40362. }) || this;
  40363. _this.name = name;
  40364. _this.pusher = pusher;
  40365. _this.subscribed = false;
  40366. _this.subscriptionPending = false;
  40367. _this.subscriptionCancelled = false;
  40368. return _this;
  40369. }
  40370. Channel.prototype.authorize = function (socketId, callback) {
  40371. return callback(false, {});
  40372. };
  40373. Channel.prototype.trigger = function (event, data) {
  40374. if (event.indexOf("client-") !== 0) {
  40375. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40376. }
  40377. if (!this.subscribed) {
  40378. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40379. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40380. }
  40381. return this.pusher.send_event(event, data, this.name);
  40382. };
  40383. Channel.prototype.disconnect = function () {
  40384. this.subscribed = false;
  40385. this.subscriptionPending = false;
  40386. };
  40387. Channel.prototype.handleEvent = function (event) {
  40388. var eventName = event.event;
  40389. var data = event.data;
  40390. if (eventName === "pusher_internal:subscription_succeeded") {
  40391. this.handleSubscriptionSucceededEvent(event);
  40392. }
  40393. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40394. var metadata = {};
  40395. this.emit(eventName, data, metadata);
  40396. }
  40397. };
  40398. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40399. this.subscriptionPending = false;
  40400. this.subscribed = true;
  40401. if (this.subscriptionCancelled) {
  40402. this.pusher.unsubscribe(this.name);
  40403. }
  40404. else {
  40405. this.emit("pusher:subscription_succeeded", event.data);
  40406. }
  40407. };
  40408. Channel.prototype.subscribe = function () {
  40409. var _this = this;
  40410. if (this.subscribed) {
  40411. return;
  40412. }
  40413. this.subscriptionPending = true;
  40414. this.subscriptionCancelled = false;
  40415. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40416. if (error) {
  40417. logger.error(data);
  40418. _this.emit('pusher:subscription_error', data);
  40419. }
  40420. else {
  40421. _this.pusher.send_event('pusher:subscribe', {
  40422. auth: data.auth,
  40423. channel_data: data.channel_data,
  40424. channel: _this.name
  40425. });
  40426. }
  40427. });
  40428. };
  40429. Channel.prototype.unsubscribe = function () {
  40430. this.subscribed = false;
  40431. this.pusher.send_event('pusher:unsubscribe', {
  40432. channel: this.name
  40433. });
  40434. };
  40435. Channel.prototype.cancelSubscription = function () {
  40436. this.subscriptionCancelled = true;
  40437. };
  40438. Channel.prototype.reinstateSubscription = function () {
  40439. this.subscriptionCancelled = false;
  40440. };
  40441. return Channel;
  40442. }(dispatcher));
  40443. /* harmony default export */ var channels_channel = (channel_Channel);
  40444. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40445. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40446. var extendStatics = function (d, b) {
  40447. extendStatics = Object.setPrototypeOf ||
  40448. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40449. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40450. return extendStatics(d, b);
  40451. };
  40452. return function (d, b) {
  40453. extendStatics(d, b);
  40454. function __() { this.constructor = d; }
  40455. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40456. };
  40457. })();
  40458. var private_channel_PrivateChannel = (function (_super) {
  40459. private_channel_extends(PrivateChannel, _super);
  40460. function PrivateChannel() {
  40461. return _super !== null && _super.apply(this, arguments) || this;
  40462. }
  40463. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40464. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40465. return authorizer.authorize(socketId, callback);
  40466. };
  40467. return PrivateChannel;
  40468. }(channels_channel));
  40469. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40470. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40471. var members_Members = (function () {
  40472. function Members() {
  40473. this.reset();
  40474. }
  40475. Members.prototype.get = function (id) {
  40476. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40477. return {
  40478. id: id,
  40479. info: this.members[id]
  40480. };
  40481. }
  40482. else {
  40483. return null;
  40484. }
  40485. };
  40486. Members.prototype.each = function (callback) {
  40487. var _this = this;
  40488. objectApply(this.members, function (member, id) {
  40489. callback(_this.get(id));
  40490. });
  40491. };
  40492. Members.prototype.setMyID = function (id) {
  40493. this.myID = id;
  40494. };
  40495. Members.prototype.onSubscription = function (subscriptionData) {
  40496. this.members = subscriptionData.presence.hash;
  40497. this.count = subscriptionData.presence.count;
  40498. this.me = this.get(this.myID);
  40499. };
  40500. Members.prototype.addMember = function (memberData) {
  40501. if (this.get(memberData.user_id) === null) {
  40502. this.count++;
  40503. }
  40504. this.members[memberData.user_id] = memberData.user_info;
  40505. return this.get(memberData.user_id);
  40506. };
  40507. Members.prototype.removeMember = function (memberData) {
  40508. var member = this.get(memberData.user_id);
  40509. if (member) {
  40510. delete this.members[memberData.user_id];
  40511. this.count--;
  40512. }
  40513. return member;
  40514. };
  40515. Members.prototype.reset = function () {
  40516. this.members = {};
  40517. this.count = 0;
  40518. this.myID = null;
  40519. this.me = null;
  40520. };
  40521. return Members;
  40522. }());
  40523. /* harmony default export */ var members = (members_Members);
  40524. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40525. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40526. var extendStatics = function (d, b) {
  40527. extendStatics = Object.setPrototypeOf ||
  40528. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40529. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40530. return extendStatics(d, b);
  40531. };
  40532. return function (d, b) {
  40533. extendStatics(d, b);
  40534. function __() { this.constructor = d; }
  40535. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40536. };
  40537. })();
  40538. var presence_channel_PresenceChannel = (function (_super) {
  40539. presence_channel_extends(PresenceChannel, _super);
  40540. function PresenceChannel(name, pusher) {
  40541. var _this = _super.call(this, name, pusher) || this;
  40542. _this.members = new members();
  40543. return _this;
  40544. }
  40545. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40546. var _this = this;
  40547. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40548. if (!error) {
  40549. if (authData.channel_data === undefined) {
  40550. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40551. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40552. ("expected 'channel_data' field. " + suffix));
  40553. callback("Invalid auth response");
  40554. return;
  40555. }
  40556. var channelData = JSON.parse(authData.channel_data);
  40557. _this.members.setMyID(channelData.user_id);
  40558. }
  40559. callback(error, authData);
  40560. });
  40561. };
  40562. PresenceChannel.prototype.handleEvent = function (event) {
  40563. var eventName = event.event;
  40564. if (eventName.indexOf("pusher_internal:") === 0) {
  40565. this.handleInternalEvent(event);
  40566. }
  40567. else {
  40568. var data = event.data;
  40569. var metadata = {};
  40570. if (event.user_id) {
  40571. metadata.user_id = event.user_id;
  40572. }
  40573. this.emit(eventName, data, metadata);
  40574. }
  40575. };
  40576. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40577. var eventName = event.event;
  40578. var data = event.data;
  40579. switch (eventName) {
  40580. case "pusher_internal:subscription_succeeded":
  40581. this.handleSubscriptionSucceededEvent(event);
  40582. break;
  40583. case "pusher_internal:member_added":
  40584. var addedMember = this.members.addMember(data);
  40585. this.emit('pusher:member_added', addedMember);
  40586. break;
  40587. case "pusher_internal:member_removed":
  40588. var removedMember = this.members.removeMember(data);
  40589. if (removedMember) {
  40590. this.emit('pusher:member_removed', removedMember);
  40591. }
  40592. break;
  40593. }
  40594. };
  40595. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40596. this.subscriptionPending = false;
  40597. this.subscribed = true;
  40598. if (this.subscriptionCancelled) {
  40599. this.pusher.unsubscribe(this.name);
  40600. }
  40601. else {
  40602. this.members.onSubscription(event.data);
  40603. this.emit("pusher:subscription_succeeded", this.members);
  40604. }
  40605. };
  40606. PresenceChannel.prototype.disconnect = function () {
  40607. this.members.reset();
  40608. _super.prototype.disconnect.call(this);
  40609. };
  40610. return PresenceChannel;
  40611. }(private_channel));
  40612. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40613. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40614. var nacl_fast = __webpack_require__(0);
  40615. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40616. var nacl_util = __webpack_require__(1);
  40617. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40618. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40619. var extendStatics = function (d, b) {
  40620. extendStatics = Object.setPrototypeOf ||
  40621. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40622. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40623. return extendStatics(d, b);
  40624. };
  40625. return function (d, b) {
  40626. extendStatics(d, b);
  40627. function __() { this.constructor = d; }
  40628. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40629. };
  40630. })();
  40631. var encrypted_channel_EncryptedChannel = (function (_super) {
  40632. encrypted_channel_extends(EncryptedChannel, _super);
  40633. function EncryptedChannel() {
  40634. var _this = _super !== null && _super.apply(this, arguments) || this;
  40635. _this.key = null;
  40636. return _this;
  40637. }
  40638. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40639. var _this = this;
  40640. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40641. if (error) {
  40642. callback(true, authData);
  40643. return;
  40644. }
  40645. var sharedSecret = authData["shared_secret"];
  40646. if (!sharedSecret) {
  40647. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40648. callback(true, errorMsg);
  40649. return;
  40650. }
  40651. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40652. delete authData["shared_secret"];
  40653. callback(false, authData);
  40654. });
  40655. };
  40656. EncryptedChannel.prototype.trigger = function (event, data) {
  40657. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40658. };
  40659. EncryptedChannel.prototype.handleEvent = function (event) {
  40660. var eventName = event.event;
  40661. var data = event.data;
  40662. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40663. _super.prototype.handleEvent.call(this, event);
  40664. return;
  40665. }
  40666. this.handleEncryptedEvent(eventName, data);
  40667. };
  40668. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40669. var _this = this;
  40670. if (!this.key) {
  40671. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40672. return;
  40673. }
  40674. if (!data.ciphertext || !data.nonce) {
  40675. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40676. return;
  40677. }
  40678. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40679. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40680. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40681. return;
  40682. }
  40683. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40684. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40685. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40686. return;
  40687. }
  40688. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40689. if (bytes === null) {
  40690. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40691. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40692. if (error) {
  40693. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40694. return;
  40695. }
  40696. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40697. if (bytes === null) {
  40698. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40699. return;
  40700. }
  40701. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40702. return;
  40703. });
  40704. return;
  40705. }
  40706. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40707. };
  40708. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40709. try {
  40710. this.emit(eventName, JSON.parse(data));
  40711. }
  40712. catch (e) {
  40713. this.emit(eventName, data);
  40714. }
  40715. return this;
  40716. };
  40717. return EncryptedChannel;
  40718. }(private_channel));
  40719. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  40720. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  40721. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  40722. var extendStatics = function (d, b) {
  40723. extendStatics = Object.setPrototypeOf ||
  40724. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40725. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40726. return extendStatics(d, b);
  40727. };
  40728. return function (d, b) {
  40729. extendStatics(d, b);
  40730. function __() { this.constructor = d; }
  40731. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40732. };
  40733. })();
  40734. var connection_manager_ConnectionManager = (function (_super) {
  40735. connection_manager_extends(ConnectionManager, _super);
  40736. function ConnectionManager(key, options) {
  40737. var _this = _super.call(this) || this;
  40738. _this.key = key;
  40739. _this.options = options || {};
  40740. _this.state = "initialized";
  40741. _this.connection = null;
  40742. _this.usingTLS = !!options.useTLS;
  40743. _this.timeline = _this.options.timeline;
  40744. _this.errorCallbacks = _this.buildErrorCallbacks();
  40745. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  40746. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  40747. var Network = runtime.getNetwork();
  40748. Network.bind("online", function () {
  40749. _this.timeline.info({ netinfo: "online" });
  40750. if (_this.state === "connecting" || _this.state === "unavailable") {
  40751. _this.retryIn(0);
  40752. }
  40753. });
  40754. Network.bind("offline", function () {
  40755. _this.timeline.info({ netinfo: "offline" });
  40756. if (_this.connection) {
  40757. _this.sendActivityCheck();
  40758. }
  40759. });
  40760. _this.updateStrategy();
  40761. return _this;
  40762. }
  40763. ConnectionManager.prototype.connect = function () {
  40764. if (this.connection || this.runner) {
  40765. return;
  40766. }
  40767. if (!this.strategy.isSupported()) {
  40768. this.updateState("failed");
  40769. return;
  40770. }
  40771. this.updateState("connecting");
  40772. this.startConnecting();
  40773. this.setUnavailableTimer();
  40774. };
  40775. ;
  40776. ConnectionManager.prototype.send = function (data) {
  40777. if (this.connection) {
  40778. return this.connection.send(data);
  40779. }
  40780. else {
  40781. return false;
  40782. }
  40783. };
  40784. ;
  40785. ConnectionManager.prototype.send_event = function (name, data, channel) {
  40786. if (this.connection) {
  40787. return this.connection.send_event(name, data, channel);
  40788. }
  40789. else {
  40790. return false;
  40791. }
  40792. };
  40793. ;
  40794. ConnectionManager.prototype.disconnect = function () {
  40795. this.disconnectInternally();
  40796. this.updateState("disconnected");
  40797. };
  40798. ;
  40799. ConnectionManager.prototype.isUsingTLS = function () {
  40800. return this.usingTLS;
  40801. };
  40802. ;
  40803. ConnectionManager.prototype.startConnecting = function () {
  40804. var _this = this;
  40805. var callback = function (error, handshake) {
  40806. if (error) {
  40807. _this.runner = _this.strategy.connect(0, callback);
  40808. }
  40809. else {
  40810. if (handshake.action === "error") {
  40811. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  40812. _this.timeline.error({ handshakeError: handshake.error });
  40813. }
  40814. else {
  40815. _this.abortConnecting();
  40816. _this.handshakeCallbacks[handshake.action](handshake);
  40817. }
  40818. }
  40819. };
  40820. this.runner = this.strategy.connect(0, callback);
  40821. };
  40822. ;
  40823. ConnectionManager.prototype.abortConnecting = function () {
  40824. if (this.runner) {
  40825. this.runner.abort();
  40826. this.runner = null;
  40827. }
  40828. };
  40829. ;
  40830. ConnectionManager.prototype.disconnectInternally = function () {
  40831. this.abortConnecting();
  40832. this.clearRetryTimer();
  40833. this.clearUnavailableTimer();
  40834. if (this.connection) {
  40835. var connection = this.abandonConnection();
  40836. connection.close();
  40837. }
  40838. };
  40839. ;
  40840. ConnectionManager.prototype.updateStrategy = function () {
  40841. this.strategy = this.options.getStrategy({
  40842. key: this.key,
  40843. timeline: this.timeline,
  40844. useTLS: this.usingTLS
  40845. });
  40846. };
  40847. ;
  40848. ConnectionManager.prototype.retryIn = function (delay) {
  40849. var _this = this;
  40850. this.timeline.info({ action: "retry", delay: delay });
  40851. if (delay > 0) {
  40852. this.emit("connecting_in", Math.round(delay / 1000));
  40853. }
  40854. this.retryTimer = new OneOffTimer(delay || 0, function () {
  40855. _this.disconnectInternally();
  40856. _this.connect();
  40857. });
  40858. };
  40859. ;
  40860. ConnectionManager.prototype.clearRetryTimer = function () {
  40861. if (this.retryTimer) {
  40862. this.retryTimer.ensureAborted();
  40863. this.retryTimer = null;
  40864. }
  40865. };
  40866. ;
  40867. ConnectionManager.prototype.setUnavailableTimer = function () {
  40868. var _this = this;
  40869. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  40870. _this.updateState("unavailable");
  40871. });
  40872. };
  40873. ;
  40874. ConnectionManager.prototype.clearUnavailableTimer = function () {
  40875. if (this.unavailableTimer) {
  40876. this.unavailableTimer.ensureAborted();
  40877. }
  40878. };
  40879. ;
  40880. ConnectionManager.prototype.sendActivityCheck = function () {
  40881. var _this = this;
  40882. this.stopActivityCheck();
  40883. this.connection.ping();
  40884. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  40885. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  40886. _this.retryIn(0);
  40887. });
  40888. };
  40889. ;
  40890. ConnectionManager.prototype.resetActivityCheck = function () {
  40891. var _this = this;
  40892. this.stopActivityCheck();
  40893. if (this.connection && !this.connection.handlesActivityChecks()) {
  40894. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  40895. _this.sendActivityCheck();
  40896. });
  40897. }
  40898. };
  40899. ;
  40900. ConnectionManager.prototype.stopActivityCheck = function () {
  40901. if (this.activityTimer) {
  40902. this.activityTimer.ensureAborted();
  40903. }
  40904. };
  40905. ;
  40906. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  40907. var _this = this;
  40908. return extend({}, errorCallbacks, {
  40909. message: function (message) {
  40910. _this.resetActivityCheck();
  40911. _this.emit('message', message);
  40912. },
  40913. ping: function () {
  40914. _this.send_event('pusher:pong', {});
  40915. },
  40916. activity: function () {
  40917. _this.resetActivityCheck();
  40918. },
  40919. error: function (error) {
  40920. _this.emit("error", { type: "WebSocketError", error: error });
  40921. },
  40922. closed: function () {
  40923. _this.abandonConnection();
  40924. if (_this.shouldRetry()) {
  40925. _this.retryIn(1000);
  40926. }
  40927. }
  40928. });
  40929. };
  40930. ;
  40931. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  40932. var _this = this;
  40933. return extend({}, errorCallbacks, {
  40934. connected: function (handshake) {
  40935. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  40936. _this.clearUnavailableTimer();
  40937. _this.setConnection(handshake.connection);
  40938. _this.socket_id = _this.connection.id;
  40939. _this.updateState("connected", { socket_id: _this.socket_id });
  40940. }
  40941. });
  40942. };
  40943. ;
  40944. ConnectionManager.prototype.buildErrorCallbacks = function () {
  40945. var _this = this;
  40946. var withErrorEmitted = function (callback) {
  40947. return function (result) {
  40948. if (result.error) {
  40949. _this.emit("error", { type: "WebSocketError", error: result.error });
  40950. }
  40951. callback(result);
  40952. };
  40953. };
  40954. return {
  40955. tls_only: withErrorEmitted(function () {
  40956. _this.usingTLS = true;
  40957. _this.updateStrategy();
  40958. _this.retryIn(0);
  40959. }),
  40960. refused: withErrorEmitted(function () {
  40961. _this.disconnect();
  40962. }),
  40963. backoff: withErrorEmitted(function () {
  40964. _this.retryIn(1000);
  40965. }),
  40966. retry: withErrorEmitted(function () {
  40967. _this.retryIn(0);
  40968. })
  40969. };
  40970. };
  40971. ;
  40972. ConnectionManager.prototype.setConnection = function (connection) {
  40973. this.connection = connection;
  40974. for (var event in this.connectionCallbacks) {
  40975. this.connection.bind(event, this.connectionCallbacks[event]);
  40976. }
  40977. this.resetActivityCheck();
  40978. };
  40979. ;
  40980. ConnectionManager.prototype.abandonConnection = function () {
  40981. if (!this.connection) {
  40982. return;
  40983. }
  40984. this.stopActivityCheck();
  40985. for (var event in this.connectionCallbacks) {
  40986. this.connection.unbind(event, this.connectionCallbacks[event]);
  40987. }
  40988. var connection = this.connection;
  40989. this.connection = null;
  40990. return connection;
  40991. };
  40992. ConnectionManager.prototype.updateState = function (newState, data) {
  40993. var previousState = this.state;
  40994. this.state = newState;
  40995. if (previousState !== newState) {
  40996. var newStateDescription = newState;
  40997. if (newStateDescription === "connected") {
  40998. newStateDescription += " with new socket ID " + data.socket_id;
  40999. }
  41000. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41001. this.timeline.info({ state: newState, params: data });
  41002. this.emit('state_change', { previous: previousState, current: newState });
  41003. this.emit(newState, data);
  41004. }
  41005. };
  41006. ConnectionManager.prototype.shouldRetry = function () {
  41007. return this.state === "connecting" || this.state === "connected";
  41008. };
  41009. return ConnectionManager;
  41010. }(dispatcher));
  41011. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41012. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41013. var channels_Channels = (function () {
  41014. function Channels() {
  41015. this.channels = {};
  41016. }
  41017. Channels.prototype.add = function (name, pusher) {
  41018. if (!this.channels[name]) {
  41019. this.channels[name] = createChannel(name, pusher);
  41020. }
  41021. return this.channels[name];
  41022. };
  41023. Channels.prototype.all = function () {
  41024. return values(this.channels);
  41025. };
  41026. Channels.prototype.find = function (name) {
  41027. return this.channels[name];
  41028. };
  41029. Channels.prototype.remove = function (name) {
  41030. var channel = this.channels[name];
  41031. delete this.channels[name];
  41032. return channel;
  41033. };
  41034. Channels.prototype.disconnect = function () {
  41035. objectApply(this.channels, function (channel) {
  41036. channel.disconnect();
  41037. });
  41038. };
  41039. return Channels;
  41040. }());
  41041. /* harmony default export */ var channels = (channels_Channels);
  41042. function createChannel(name, pusher) {
  41043. if (name.indexOf('private-encrypted-') === 0) {
  41044. if (false) { var errorMsg; }
  41045. return factory.createEncryptedChannel(name, pusher);
  41046. }
  41047. else if (name.indexOf('private-') === 0) {
  41048. return factory.createPrivateChannel(name, pusher);
  41049. }
  41050. else if (name.indexOf('presence-') === 0) {
  41051. return factory.createPresenceChannel(name, pusher);
  41052. }
  41053. else {
  41054. return factory.createChannel(name, pusher);
  41055. }
  41056. }
  41057. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41058. var Factory = {
  41059. createChannels: function () {
  41060. return new channels();
  41061. },
  41062. createConnectionManager: function (key, options) {
  41063. return new connection_manager(key, options);
  41064. },
  41065. createChannel: function (name, pusher) {
  41066. return new channels_channel(name, pusher);
  41067. },
  41068. createPrivateChannel: function (name, pusher) {
  41069. return new private_channel(name, pusher);
  41070. },
  41071. createPresenceChannel: function (name, pusher) {
  41072. return new presence_channel(name, pusher);
  41073. },
  41074. createEncryptedChannel: function (name, pusher) {
  41075. return new encrypted_channel(name, pusher);
  41076. },
  41077. createTimelineSender: function (timeline, options) {
  41078. return new timeline_sender(timeline, options);
  41079. },
  41080. createAuthorizer: function (channel, options) {
  41081. if (options.authorizer) {
  41082. return options.authorizer(channel, options);
  41083. }
  41084. return new pusher_authorizer(channel, options);
  41085. },
  41086. createHandshake: function (transport, callback) {
  41087. return new connection_handshake(transport, callback);
  41088. },
  41089. createAssistantToTheTransportManager: function (manager, transport, options) {
  41090. return new assistant_to_the_transport_manager(manager, transport, options);
  41091. }
  41092. };
  41093. /* harmony default export */ var factory = (Factory);
  41094. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41095. var transport_manager_TransportManager = (function () {
  41096. function TransportManager(options) {
  41097. this.options = options || {};
  41098. this.livesLeft = this.options.lives || Infinity;
  41099. }
  41100. TransportManager.prototype.getAssistant = function (transport) {
  41101. return factory.createAssistantToTheTransportManager(this, transport, {
  41102. minPingDelay: this.options.minPingDelay,
  41103. maxPingDelay: this.options.maxPingDelay
  41104. });
  41105. };
  41106. TransportManager.prototype.isAlive = function () {
  41107. return this.livesLeft > 0;
  41108. };
  41109. TransportManager.prototype.reportDeath = function () {
  41110. this.livesLeft -= 1;
  41111. };
  41112. return TransportManager;
  41113. }());
  41114. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41115. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41116. var sequential_strategy_SequentialStrategy = (function () {
  41117. function SequentialStrategy(strategies, options) {
  41118. this.strategies = strategies;
  41119. this.loop = Boolean(options.loop);
  41120. this.failFast = Boolean(options.failFast);
  41121. this.timeout = options.timeout;
  41122. this.timeoutLimit = options.timeoutLimit;
  41123. }
  41124. SequentialStrategy.prototype.isSupported = function () {
  41125. return any(this.strategies, util.method("isSupported"));
  41126. };
  41127. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41128. var _this = this;
  41129. var strategies = this.strategies;
  41130. var current = 0;
  41131. var timeout = this.timeout;
  41132. var runner = null;
  41133. var tryNextStrategy = function (error, handshake) {
  41134. if (handshake) {
  41135. callback(null, handshake);
  41136. }
  41137. else {
  41138. current = current + 1;
  41139. if (_this.loop) {
  41140. current = current % strategies.length;
  41141. }
  41142. if (current < strategies.length) {
  41143. if (timeout) {
  41144. timeout = timeout * 2;
  41145. if (_this.timeoutLimit) {
  41146. timeout = Math.min(timeout, _this.timeoutLimit);
  41147. }
  41148. }
  41149. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41150. }
  41151. else {
  41152. callback(true);
  41153. }
  41154. }
  41155. };
  41156. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41157. return {
  41158. abort: function () {
  41159. runner.abort();
  41160. },
  41161. forceMinPriority: function (p) {
  41162. minPriority = p;
  41163. if (runner) {
  41164. runner.forceMinPriority(p);
  41165. }
  41166. }
  41167. };
  41168. };
  41169. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41170. var timer = null;
  41171. var runner = null;
  41172. if (options.timeout > 0) {
  41173. timer = new OneOffTimer(options.timeout, function () {
  41174. runner.abort();
  41175. callback(true);
  41176. });
  41177. }
  41178. runner = strategy.connect(minPriority, function (error, handshake) {
  41179. if (error && timer && timer.isRunning() && !options.failFast) {
  41180. return;
  41181. }
  41182. if (timer) {
  41183. timer.ensureAborted();
  41184. }
  41185. callback(error, handshake);
  41186. });
  41187. return {
  41188. abort: function () {
  41189. if (timer) {
  41190. timer.ensureAborted();
  41191. }
  41192. runner.abort();
  41193. },
  41194. forceMinPriority: function (p) {
  41195. runner.forceMinPriority(p);
  41196. }
  41197. };
  41198. };
  41199. return SequentialStrategy;
  41200. }());
  41201. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41202. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41203. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41204. function BestConnectedEverStrategy(strategies) {
  41205. this.strategies = strategies;
  41206. }
  41207. BestConnectedEverStrategy.prototype.isSupported = function () {
  41208. return any(this.strategies, util.method("isSupported"));
  41209. };
  41210. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41211. return connect(this.strategies, minPriority, function (i, runners) {
  41212. return function (error, handshake) {
  41213. runners[i].error = error;
  41214. if (error) {
  41215. if (allRunnersFailed(runners)) {
  41216. callback(true);
  41217. }
  41218. return;
  41219. }
  41220. apply(runners, function (runner) {
  41221. runner.forceMinPriority(handshake.transport.priority);
  41222. });
  41223. callback(null, handshake);
  41224. };
  41225. });
  41226. };
  41227. return BestConnectedEverStrategy;
  41228. }());
  41229. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41230. function connect(strategies, minPriority, callbackBuilder) {
  41231. var runners = map(strategies, function (strategy, i, _, rs) {
  41232. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41233. });
  41234. return {
  41235. abort: function () {
  41236. apply(runners, abortRunner);
  41237. },
  41238. forceMinPriority: function (p) {
  41239. apply(runners, function (runner) {
  41240. runner.forceMinPriority(p);
  41241. });
  41242. }
  41243. };
  41244. }
  41245. function allRunnersFailed(runners) {
  41246. return collections_all(runners, function (runner) {
  41247. return Boolean(runner.error);
  41248. });
  41249. }
  41250. function abortRunner(runner) {
  41251. if (!runner.error && !runner.aborted) {
  41252. runner.abort();
  41253. runner.aborted = true;
  41254. }
  41255. }
  41256. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41257. var cached_strategy_CachedStrategy = (function () {
  41258. function CachedStrategy(strategy, transports, options) {
  41259. this.strategy = strategy;
  41260. this.transports = transports;
  41261. this.ttl = options.ttl || 1800 * 1000;
  41262. this.usingTLS = options.useTLS;
  41263. this.timeline = options.timeline;
  41264. }
  41265. CachedStrategy.prototype.isSupported = function () {
  41266. return this.strategy.isSupported();
  41267. };
  41268. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41269. var usingTLS = this.usingTLS;
  41270. var info = fetchTransportCache(usingTLS);
  41271. var strategies = [this.strategy];
  41272. if (info && info.timestamp + this.ttl >= util.now()) {
  41273. var transport = this.transports[info.transport];
  41274. if (transport) {
  41275. this.timeline.info({
  41276. cached: true,
  41277. transport: info.transport,
  41278. latency: info.latency
  41279. });
  41280. strategies.push(new sequential_strategy([transport], {
  41281. timeout: info.latency * 2 + 1000,
  41282. failFast: true
  41283. }));
  41284. }
  41285. }
  41286. var startTimestamp = util.now();
  41287. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41288. if (error) {
  41289. flushTransportCache(usingTLS);
  41290. if (strategies.length > 0) {
  41291. startTimestamp = util.now();
  41292. runner = strategies.pop().connect(minPriority, cb);
  41293. }
  41294. else {
  41295. callback(error);
  41296. }
  41297. }
  41298. else {
  41299. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41300. callback(null, handshake);
  41301. }
  41302. });
  41303. return {
  41304. abort: function () {
  41305. runner.abort();
  41306. },
  41307. forceMinPriority: function (p) {
  41308. minPriority = p;
  41309. if (runner) {
  41310. runner.forceMinPriority(p);
  41311. }
  41312. }
  41313. };
  41314. };
  41315. return CachedStrategy;
  41316. }());
  41317. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41318. function getTransportCacheKey(usingTLS) {
  41319. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41320. }
  41321. function fetchTransportCache(usingTLS) {
  41322. var storage = runtime.getLocalStorage();
  41323. if (storage) {
  41324. try {
  41325. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41326. if (serializedCache) {
  41327. return JSON.parse(serializedCache);
  41328. }
  41329. }
  41330. catch (e) {
  41331. flushTransportCache(usingTLS);
  41332. }
  41333. }
  41334. return null;
  41335. }
  41336. function storeTransportCache(usingTLS, transport, latency) {
  41337. var storage = runtime.getLocalStorage();
  41338. if (storage) {
  41339. try {
  41340. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41341. timestamp: util.now(),
  41342. transport: transport,
  41343. latency: latency
  41344. });
  41345. }
  41346. catch (e) {
  41347. }
  41348. }
  41349. }
  41350. function flushTransportCache(usingTLS) {
  41351. var storage = runtime.getLocalStorage();
  41352. if (storage) {
  41353. try {
  41354. delete storage[getTransportCacheKey(usingTLS)];
  41355. }
  41356. catch (e) {
  41357. }
  41358. }
  41359. }
  41360. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41361. var delayed_strategy_DelayedStrategy = (function () {
  41362. function DelayedStrategy(strategy, _a) {
  41363. var number = _a.delay;
  41364. this.strategy = strategy;
  41365. this.options = { delay: number };
  41366. }
  41367. DelayedStrategy.prototype.isSupported = function () {
  41368. return this.strategy.isSupported();
  41369. };
  41370. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41371. var strategy = this.strategy;
  41372. var runner;
  41373. var timer = new OneOffTimer(this.options.delay, function () {
  41374. runner = strategy.connect(minPriority, callback);
  41375. });
  41376. return {
  41377. abort: function () {
  41378. timer.ensureAborted();
  41379. if (runner) {
  41380. runner.abort();
  41381. }
  41382. },
  41383. forceMinPriority: function (p) {
  41384. minPriority = p;
  41385. if (runner) {
  41386. runner.forceMinPriority(p);
  41387. }
  41388. }
  41389. };
  41390. };
  41391. return DelayedStrategy;
  41392. }());
  41393. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41394. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41395. var IfStrategy = (function () {
  41396. function IfStrategy(test, trueBranch, falseBranch) {
  41397. this.test = test;
  41398. this.trueBranch = trueBranch;
  41399. this.falseBranch = falseBranch;
  41400. }
  41401. IfStrategy.prototype.isSupported = function () {
  41402. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41403. return branch.isSupported();
  41404. };
  41405. IfStrategy.prototype.connect = function (minPriority, callback) {
  41406. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41407. return branch.connect(minPriority, callback);
  41408. };
  41409. return IfStrategy;
  41410. }());
  41411. /* harmony default export */ var if_strategy = (IfStrategy);
  41412. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41413. var FirstConnectedStrategy = (function () {
  41414. function FirstConnectedStrategy(strategy) {
  41415. this.strategy = strategy;
  41416. }
  41417. FirstConnectedStrategy.prototype.isSupported = function () {
  41418. return this.strategy.isSupported();
  41419. };
  41420. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41421. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41422. if (handshake) {
  41423. runner.abort();
  41424. }
  41425. callback(error, handshake);
  41426. });
  41427. return runner;
  41428. };
  41429. return FirstConnectedStrategy;
  41430. }());
  41431. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41432. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41433. function testSupportsStrategy(strategy) {
  41434. return function () {
  41435. return strategy.isSupported();
  41436. };
  41437. }
  41438. var getDefaultStrategy = function (config, defineTransport) {
  41439. var definedTransports = {};
  41440. function defineTransportStrategy(name, type, priority, options, manager) {
  41441. var transport = defineTransport(config, name, type, priority, options, manager);
  41442. definedTransports[name] = transport;
  41443. return transport;
  41444. }
  41445. var ws_options = {
  41446. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41447. hostTLS: config.wsHost + ":" + config.wssPort,
  41448. httpPath: config.wsPath
  41449. };
  41450. var wss_options = extend({}, ws_options, {
  41451. useTLS: true
  41452. });
  41453. var sockjs_options = {
  41454. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41455. hostTLS: config.httpHost + ":" + config.httpsPort,
  41456. httpPath: config.httpPath
  41457. };
  41458. var timeouts = {
  41459. loop: true,
  41460. timeout: 15000,
  41461. timeoutLimit: 60000
  41462. };
  41463. var ws_manager = new transport_manager({
  41464. lives: 2,
  41465. minPingDelay: 10000,
  41466. maxPingDelay: config.activity_timeout
  41467. });
  41468. var streaming_manager = new transport_manager({
  41469. lives: 2,
  41470. minPingDelay: 10000,
  41471. maxPingDelay: config.activity_timeout
  41472. });
  41473. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41474. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41475. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41476. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41477. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41478. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41479. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41480. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41481. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41482. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41483. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41484. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41485. 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);
  41486. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41487. var wsStrategy;
  41488. if (config.useTLS) {
  41489. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41490. }
  41491. else {
  41492. wsStrategy = new best_connected_ever_strategy([
  41493. ws_loop,
  41494. new delayed_strategy(wss_loop, { delay: 2000 }),
  41495. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41496. ]);
  41497. }
  41498. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41499. ttl: 1800000,
  41500. timeline: config.timeline,
  41501. useTLS: config.useTLS
  41502. });
  41503. };
  41504. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41505. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41506. /* harmony default export */ var transport_connection_initializer = (function () {
  41507. var self = this;
  41508. self.timeline.info(self.buildTimelineMessage({
  41509. transport: self.name + (self.options.useTLS ? "s" : "")
  41510. }));
  41511. if (self.hooks.isInitialized()) {
  41512. self.changeState("initialized");
  41513. }
  41514. else if (self.hooks.file) {
  41515. self.changeState("initializing");
  41516. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41517. if (self.hooks.isInitialized()) {
  41518. self.changeState("initialized");
  41519. callback(true);
  41520. }
  41521. else {
  41522. if (error) {
  41523. self.onError(error);
  41524. }
  41525. self.onClose();
  41526. callback(false);
  41527. }
  41528. });
  41529. }
  41530. else {
  41531. self.onClose();
  41532. }
  41533. });
  41534. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41535. var http_xdomain_request_hooks = {
  41536. getRequest: function (socket) {
  41537. var xdr = new window.XDomainRequest();
  41538. xdr.ontimeout = function () {
  41539. socket.emit("error", new RequestTimedOut());
  41540. socket.close();
  41541. };
  41542. xdr.onerror = function (e) {
  41543. socket.emit("error", e);
  41544. socket.close();
  41545. };
  41546. xdr.onprogress = function () {
  41547. if (xdr.responseText && xdr.responseText.length > 0) {
  41548. socket.onChunk(200, xdr.responseText);
  41549. }
  41550. };
  41551. xdr.onload = function () {
  41552. if (xdr.responseText && xdr.responseText.length > 0) {
  41553. socket.onChunk(200, xdr.responseText);
  41554. }
  41555. socket.emit("finished", 200);
  41556. socket.close();
  41557. };
  41558. return xdr;
  41559. },
  41560. abortRequest: function (xdr) {
  41561. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41562. xdr.abort();
  41563. }
  41564. };
  41565. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41566. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41567. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41568. var extendStatics = function (d, b) {
  41569. extendStatics = Object.setPrototypeOf ||
  41570. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41571. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41572. return extendStatics(d, b);
  41573. };
  41574. return function (d, b) {
  41575. extendStatics(d, b);
  41576. function __() { this.constructor = d; }
  41577. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41578. };
  41579. })();
  41580. var MAX_BUFFER_LENGTH = 256 * 1024;
  41581. var http_request_HTTPRequest = (function (_super) {
  41582. http_request_extends(HTTPRequest, _super);
  41583. function HTTPRequest(hooks, method, url) {
  41584. var _this = _super.call(this) || this;
  41585. _this.hooks = hooks;
  41586. _this.method = method;
  41587. _this.url = url;
  41588. return _this;
  41589. }
  41590. HTTPRequest.prototype.start = function (payload) {
  41591. var _this = this;
  41592. this.position = 0;
  41593. this.xhr = this.hooks.getRequest(this);
  41594. this.unloader = function () {
  41595. _this.close();
  41596. };
  41597. runtime.addUnloadListener(this.unloader);
  41598. this.xhr.open(this.method, this.url, true);
  41599. if (this.xhr.setRequestHeader) {
  41600. this.xhr.setRequestHeader("Content-Type", "application/json");
  41601. }
  41602. this.xhr.send(payload);
  41603. };
  41604. HTTPRequest.prototype.close = function () {
  41605. if (this.unloader) {
  41606. runtime.removeUnloadListener(this.unloader);
  41607. this.unloader = null;
  41608. }
  41609. if (this.xhr) {
  41610. this.hooks.abortRequest(this.xhr);
  41611. this.xhr = null;
  41612. }
  41613. };
  41614. HTTPRequest.prototype.onChunk = function (status, data) {
  41615. while (true) {
  41616. var chunk = this.advanceBuffer(data);
  41617. if (chunk) {
  41618. this.emit("chunk", { status: status, data: chunk });
  41619. }
  41620. else {
  41621. break;
  41622. }
  41623. }
  41624. if (this.isBufferTooLong(data)) {
  41625. this.emit("buffer_too_long");
  41626. }
  41627. };
  41628. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41629. var unreadData = buffer.slice(this.position);
  41630. var endOfLinePosition = unreadData.indexOf("\n");
  41631. if (endOfLinePosition !== -1) {
  41632. this.position += endOfLinePosition + 1;
  41633. return unreadData.slice(0, endOfLinePosition);
  41634. }
  41635. else {
  41636. return null;
  41637. }
  41638. };
  41639. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41640. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41641. };
  41642. return HTTPRequest;
  41643. }(dispatcher));
  41644. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41645. // CONCATENATED MODULE: ./src/core/http/state.ts
  41646. var State;
  41647. (function (State) {
  41648. State[State["CONNECTING"] = 0] = "CONNECTING";
  41649. State[State["OPEN"] = 1] = "OPEN";
  41650. State[State["CLOSED"] = 3] = "CLOSED";
  41651. })(State || (State = {}));
  41652. /* harmony default export */ var state = (State);
  41653. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41654. var autoIncrement = 1;
  41655. var http_socket_HTTPSocket = (function () {
  41656. function HTTPSocket(hooks, url) {
  41657. this.hooks = hooks;
  41658. this.session = randomNumber(1000) + "/" + randomString(8);
  41659. this.location = getLocation(url);
  41660. this.readyState = state.CONNECTING;
  41661. this.openStream();
  41662. }
  41663. HTTPSocket.prototype.send = function (payload) {
  41664. return this.sendRaw(JSON.stringify([payload]));
  41665. };
  41666. HTTPSocket.prototype.ping = function () {
  41667. this.hooks.sendHeartbeat(this);
  41668. };
  41669. HTTPSocket.prototype.close = function (code, reason) {
  41670. this.onClose(code, reason, true);
  41671. };
  41672. HTTPSocket.prototype.sendRaw = function (payload) {
  41673. if (this.readyState === state.OPEN) {
  41674. try {
  41675. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41676. return true;
  41677. }
  41678. catch (e) {
  41679. return false;
  41680. }
  41681. }
  41682. else {
  41683. return false;
  41684. }
  41685. };
  41686. HTTPSocket.prototype.reconnect = function () {
  41687. this.closeStream();
  41688. this.openStream();
  41689. };
  41690. ;
  41691. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41692. this.closeStream();
  41693. this.readyState = state.CLOSED;
  41694. if (this.onclose) {
  41695. this.onclose({
  41696. code: code,
  41697. reason: reason,
  41698. wasClean: wasClean
  41699. });
  41700. }
  41701. };
  41702. HTTPSocket.prototype.onChunk = function (chunk) {
  41703. if (chunk.status !== 200) {
  41704. return;
  41705. }
  41706. if (this.readyState === state.OPEN) {
  41707. this.onActivity();
  41708. }
  41709. var payload;
  41710. var type = chunk.data.slice(0, 1);
  41711. switch (type) {
  41712. case 'o':
  41713. payload = JSON.parse(chunk.data.slice(1) || '{}');
  41714. this.onOpen(payload);
  41715. break;
  41716. case 'a':
  41717. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41718. for (var i = 0; i < payload.length; i++) {
  41719. this.onEvent(payload[i]);
  41720. }
  41721. break;
  41722. case 'm':
  41723. payload = JSON.parse(chunk.data.slice(1) || 'null');
  41724. this.onEvent(payload);
  41725. break;
  41726. case 'h':
  41727. this.hooks.onHeartbeat(this);
  41728. break;
  41729. case 'c':
  41730. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41731. this.onClose(payload[0], payload[1], true);
  41732. break;
  41733. }
  41734. };
  41735. HTTPSocket.prototype.onOpen = function (options) {
  41736. if (this.readyState === state.CONNECTING) {
  41737. if (options && options.hostname) {
  41738. this.location.base = replaceHost(this.location.base, options.hostname);
  41739. }
  41740. this.readyState = state.OPEN;
  41741. if (this.onopen) {
  41742. this.onopen();
  41743. }
  41744. }
  41745. else {
  41746. this.onClose(1006, "Server lost session", true);
  41747. }
  41748. };
  41749. HTTPSocket.prototype.onEvent = function (event) {
  41750. if (this.readyState === state.OPEN && this.onmessage) {
  41751. this.onmessage({ data: event });
  41752. }
  41753. };
  41754. HTTPSocket.prototype.onActivity = function () {
  41755. if (this.onactivity) {
  41756. this.onactivity();
  41757. }
  41758. };
  41759. HTTPSocket.prototype.onError = function (error) {
  41760. if (this.onerror) {
  41761. this.onerror(error);
  41762. }
  41763. };
  41764. HTTPSocket.prototype.openStream = function () {
  41765. var _this = this;
  41766. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  41767. this.stream.bind("chunk", function (chunk) {
  41768. _this.onChunk(chunk);
  41769. });
  41770. this.stream.bind("finished", function (status) {
  41771. _this.hooks.onFinished(_this, status);
  41772. });
  41773. this.stream.bind("buffer_too_long", function () {
  41774. _this.reconnect();
  41775. });
  41776. try {
  41777. this.stream.start();
  41778. }
  41779. catch (error) {
  41780. util.defer(function () {
  41781. _this.onError(error);
  41782. _this.onClose(1006, "Could not start streaming", false);
  41783. });
  41784. }
  41785. };
  41786. HTTPSocket.prototype.closeStream = function () {
  41787. if (this.stream) {
  41788. this.stream.unbind_all();
  41789. this.stream.close();
  41790. this.stream = null;
  41791. }
  41792. };
  41793. return HTTPSocket;
  41794. }());
  41795. function getLocation(url) {
  41796. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  41797. return {
  41798. base: parts[1],
  41799. queryString: parts[2]
  41800. };
  41801. }
  41802. function getSendURL(url, session) {
  41803. return url.base + "/" + session + "/xhr_send";
  41804. }
  41805. function getUniqueURL(url) {
  41806. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  41807. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  41808. }
  41809. function replaceHost(url, hostname) {
  41810. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  41811. return urlParts[1] + hostname + urlParts[3];
  41812. }
  41813. function randomNumber(max) {
  41814. return Math.floor(Math.random() * max);
  41815. }
  41816. function randomString(length) {
  41817. var result = [];
  41818. for (var i = 0; i < length; i++) {
  41819. result.push(randomNumber(32).toString(32));
  41820. }
  41821. return result.join('');
  41822. }
  41823. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  41824. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  41825. var http_streaming_socket_hooks = {
  41826. getReceiveURL: function (url, session) {
  41827. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  41828. },
  41829. onHeartbeat: function (socket) {
  41830. socket.sendRaw("[]");
  41831. },
  41832. sendHeartbeat: function (socket) {
  41833. socket.sendRaw("[]");
  41834. },
  41835. onFinished: function (socket, status) {
  41836. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41837. }
  41838. };
  41839. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  41840. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  41841. var http_polling_socket_hooks = {
  41842. getReceiveURL: function (url, session) {
  41843. return url.base + "/" + session + "/xhr" + url.queryString;
  41844. },
  41845. onHeartbeat: function () {
  41846. },
  41847. sendHeartbeat: function (socket) {
  41848. socket.sendRaw("[]");
  41849. },
  41850. onFinished: function (socket, status) {
  41851. if (status === 200) {
  41852. socket.reconnect();
  41853. }
  41854. else {
  41855. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41856. }
  41857. }
  41858. };
  41859. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  41860. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  41861. var http_xhr_request_hooks = {
  41862. getRequest: function (socket) {
  41863. var Constructor = runtime.getXHRAPI();
  41864. var xhr = new Constructor();
  41865. xhr.onreadystatechange = xhr.onprogress = function () {
  41866. switch (xhr.readyState) {
  41867. case 3:
  41868. if (xhr.responseText && xhr.responseText.length > 0) {
  41869. socket.onChunk(xhr.status, xhr.responseText);
  41870. }
  41871. break;
  41872. case 4:
  41873. if (xhr.responseText && xhr.responseText.length > 0) {
  41874. socket.onChunk(xhr.status, xhr.responseText);
  41875. }
  41876. socket.emit("finished", xhr.status);
  41877. socket.close();
  41878. break;
  41879. }
  41880. };
  41881. return xhr;
  41882. },
  41883. abortRequest: function (xhr) {
  41884. xhr.onreadystatechange = null;
  41885. xhr.abort();
  41886. }
  41887. };
  41888. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  41889. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  41890. var HTTP = {
  41891. createStreamingSocket: function (url) {
  41892. return this.createSocket(http_streaming_socket, url);
  41893. },
  41894. createPollingSocket: function (url) {
  41895. return this.createSocket(http_polling_socket, url);
  41896. },
  41897. createSocket: function (hooks, url) {
  41898. return new http_socket(hooks, url);
  41899. },
  41900. createXHR: function (method, url) {
  41901. return this.createRequest(http_xhr_request, method, url);
  41902. },
  41903. createRequest: function (hooks, method, url) {
  41904. return new http_request(hooks, method, url);
  41905. }
  41906. };
  41907. /* harmony default export */ var http_http = (HTTP);
  41908. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  41909. http_http.createXDR = function (method, url) {
  41910. return this.createRequest(http_xdomain_request, method, url);
  41911. };
  41912. /* harmony default export */ var web_http_http = (http_http);
  41913. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  41914. var Runtime = {
  41915. nextAuthCallbackID: 1,
  41916. auth_callbacks: {},
  41917. ScriptReceivers: ScriptReceivers,
  41918. DependenciesReceivers: DependenciesReceivers,
  41919. getDefaultStrategy: default_strategy,
  41920. Transports: transports_transports,
  41921. transportConnectionInitializer: transport_connection_initializer,
  41922. HTTPFactory: web_http_http,
  41923. TimelineTransport: jsonp_timeline,
  41924. getXHRAPI: function () {
  41925. return window.XMLHttpRequest;
  41926. },
  41927. getWebSocketAPI: function () {
  41928. return window.WebSocket || window.MozWebSocket;
  41929. },
  41930. setup: function (PusherClass) {
  41931. var _this = this;
  41932. window.Pusher = PusherClass;
  41933. var initializeOnDocumentBody = function () {
  41934. _this.onDocumentBody(PusherClass.ready);
  41935. };
  41936. if (!window.JSON) {
  41937. Dependencies.load("json2", {}, initializeOnDocumentBody);
  41938. }
  41939. else {
  41940. initializeOnDocumentBody();
  41941. }
  41942. },
  41943. getDocument: function () {
  41944. return document;
  41945. },
  41946. getProtocol: function () {
  41947. return this.getDocument().location.protocol;
  41948. },
  41949. getAuthorizers: function () {
  41950. return { ajax: xhr_auth, jsonp: jsonp_auth };
  41951. },
  41952. onDocumentBody: function (callback) {
  41953. var _this = this;
  41954. if (document.body) {
  41955. callback();
  41956. }
  41957. else {
  41958. setTimeout(function () {
  41959. _this.onDocumentBody(callback);
  41960. }, 0);
  41961. }
  41962. },
  41963. createJSONPRequest: function (url, data) {
  41964. return new jsonp_request(url, data);
  41965. },
  41966. createScriptRequest: function (src) {
  41967. return new script_request(src);
  41968. },
  41969. getLocalStorage: function () {
  41970. try {
  41971. return window.localStorage;
  41972. }
  41973. catch (e) {
  41974. return undefined;
  41975. }
  41976. },
  41977. createXHR: function () {
  41978. if (this.getXHRAPI()) {
  41979. return this.createXMLHttpRequest();
  41980. }
  41981. else {
  41982. return this.createMicrosoftXHR();
  41983. }
  41984. },
  41985. createXMLHttpRequest: function () {
  41986. var Constructor = this.getXHRAPI();
  41987. return new Constructor();
  41988. },
  41989. createMicrosoftXHR: function () {
  41990. return new ActiveXObject("Microsoft.XMLHTTP");
  41991. },
  41992. getNetwork: function () {
  41993. return net_info_Network;
  41994. },
  41995. createWebSocket: function (url) {
  41996. var Constructor = this.getWebSocketAPI();
  41997. return new Constructor(url);
  41998. },
  41999. createSocketRequest: function (method, url) {
  42000. if (this.isXHRSupported()) {
  42001. return this.HTTPFactory.createXHR(method, url);
  42002. }
  42003. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42004. return this.HTTPFactory.createXDR(method, url);
  42005. }
  42006. else {
  42007. throw "Cross-origin HTTP requests are not supported";
  42008. }
  42009. },
  42010. isXHRSupported: function () {
  42011. var Constructor = this.getXHRAPI();
  42012. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42013. },
  42014. isXDRSupported: function (useTLS) {
  42015. var protocol = useTLS ? "https:" : "http:";
  42016. var documentProtocol = this.getProtocol();
  42017. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42018. },
  42019. addUnloadListener: function (listener) {
  42020. if (window.addEventListener !== undefined) {
  42021. window.addEventListener("unload", listener, false);
  42022. }
  42023. else if (window.attachEvent !== undefined) {
  42024. window.attachEvent("onunload", listener);
  42025. }
  42026. },
  42027. removeUnloadListener: function (listener) {
  42028. if (window.addEventListener !== undefined) {
  42029. window.removeEventListener("unload", listener, false);
  42030. }
  42031. else if (window.detachEvent !== undefined) {
  42032. window.detachEvent("onunload", listener);
  42033. }
  42034. }
  42035. };
  42036. /* harmony default export */ var runtime = (Runtime);
  42037. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42038. var TimelineLevel;
  42039. (function (TimelineLevel) {
  42040. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42041. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42042. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42043. })(TimelineLevel || (TimelineLevel = {}));
  42044. /* harmony default export */ var timeline_level = (TimelineLevel);
  42045. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42046. var timeline_Timeline = (function () {
  42047. function Timeline(key, session, options) {
  42048. this.key = key;
  42049. this.session = session;
  42050. this.events = [];
  42051. this.options = options || {};
  42052. this.sent = 0;
  42053. this.uniqueID = 0;
  42054. }
  42055. Timeline.prototype.log = function (level, event) {
  42056. if (level <= this.options.level) {
  42057. this.events.push(extend({}, event, { timestamp: util.now() }));
  42058. if (this.options.limit && this.events.length > this.options.limit) {
  42059. this.events.shift();
  42060. }
  42061. }
  42062. };
  42063. Timeline.prototype.error = function (event) {
  42064. this.log(timeline_level.ERROR, event);
  42065. };
  42066. Timeline.prototype.info = function (event) {
  42067. this.log(timeline_level.INFO, event);
  42068. };
  42069. Timeline.prototype.debug = function (event) {
  42070. this.log(timeline_level.DEBUG, event);
  42071. };
  42072. Timeline.prototype.isEmpty = function () {
  42073. return this.events.length === 0;
  42074. };
  42075. Timeline.prototype.send = function (sendfn, callback) {
  42076. var _this = this;
  42077. var data = extend({
  42078. session: this.session,
  42079. bundle: this.sent + 1,
  42080. key: this.key,
  42081. lib: "js",
  42082. version: this.options.version,
  42083. cluster: this.options.cluster,
  42084. features: this.options.features,
  42085. timeline: this.events
  42086. }, this.options.params);
  42087. this.events = [];
  42088. sendfn(data, function (error, result) {
  42089. if (!error) {
  42090. _this.sent++;
  42091. }
  42092. if (callback) {
  42093. callback(error, result);
  42094. }
  42095. });
  42096. return true;
  42097. };
  42098. Timeline.prototype.generateUniqueID = function () {
  42099. this.uniqueID++;
  42100. return this.uniqueID;
  42101. };
  42102. return Timeline;
  42103. }());
  42104. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42105. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42106. var transport_strategy_TransportStrategy = (function () {
  42107. function TransportStrategy(name, priority, transport, options) {
  42108. this.name = name;
  42109. this.priority = priority;
  42110. this.transport = transport;
  42111. this.options = options || {};
  42112. }
  42113. TransportStrategy.prototype.isSupported = function () {
  42114. return this.transport.isSupported({
  42115. useTLS: this.options.useTLS
  42116. });
  42117. };
  42118. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42119. var _this = this;
  42120. if (!this.isSupported()) {
  42121. return failAttempt(new UnsupportedStrategy(), callback);
  42122. }
  42123. else if (this.priority < minPriority) {
  42124. return failAttempt(new TransportPriorityTooLow(), callback);
  42125. }
  42126. var connected = false;
  42127. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42128. var handshake = null;
  42129. var onInitialized = function () {
  42130. transport.unbind("initialized", onInitialized);
  42131. transport.connect();
  42132. };
  42133. var onOpen = function () {
  42134. handshake = factory.createHandshake(transport, function (result) {
  42135. connected = true;
  42136. unbindListeners();
  42137. callback(null, result);
  42138. });
  42139. };
  42140. var onError = function (error) {
  42141. unbindListeners();
  42142. callback(error);
  42143. };
  42144. var onClosed = function () {
  42145. unbindListeners();
  42146. var serializedTransport;
  42147. serializedTransport = safeJSONStringify(transport);
  42148. callback(new TransportClosed(serializedTransport));
  42149. };
  42150. var unbindListeners = function () {
  42151. transport.unbind("initialized", onInitialized);
  42152. transport.unbind("open", onOpen);
  42153. transport.unbind("error", onError);
  42154. transport.unbind("closed", onClosed);
  42155. };
  42156. transport.bind("initialized", onInitialized);
  42157. transport.bind("open", onOpen);
  42158. transport.bind("error", onError);
  42159. transport.bind("closed", onClosed);
  42160. transport.initialize();
  42161. return {
  42162. abort: function () {
  42163. if (connected) {
  42164. return;
  42165. }
  42166. unbindListeners();
  42167. if (handshake) {
  42168. handshake.close();
  42169. }
  42170. else {
  42171. transport.close();
  42172. }
  42173. },
  42174. forceMinPriority: function (p) {
  42175. if (connected) {
  42176. return;
  42177. }
  42178. if (_this.priority < p) {
  42179. if (handshake) {
  42180. handshake.close();
  42181. }
  42182. else {
  42183. transport.close();
  42184. }
  42185. }
  42186. }
  42187. };
  42188. };
  42189. return TransportStrategy;
  42190. }());
  42191. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42192. function failAttempt(error, callback) {
  42193. util.defer(function () {
  42194. callback(error);
  42195. });
  42196. return {
  42197. abort: function () { },
  42198. forceMinPriority: function () { }
  42199. };
  42200. }
  42201. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42202. var strategy_builder_Transports = runtime.Transports;
  42203. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42204. var transportClass = strategy_builder_Transports[type];
  42205. if (!transportClass) {
  42206. throw new UnsupportedTransport(type);
  42207. }
  42208. var enabled = (!config.enabledTransports ||
  42209. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42210. (!config.disabledTransports ||
  42211. arrayIndexOf(config.disabledTransports, name) === -1);
  42212. var transport;
  42213. if (enabled) {
  42214. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42215. key: config.key,
  42216. useTLS: config.useTLS,
  42217. timeline: config.timeline,
  42218. ignoreNullOrigin: config.ignoreNullOrigin
  42219. }, options));
  42220. }
  42221. else {
  42222. transport = strategy_builder_UnsupportedStrategy;
  42223. }
  42224. return transport;
  42225. };
  42226. var strategy_builder_UnsupportedStrategy = {
  42227. isSupported: function () {
  42228. return false;
  42229. },
  42230. connect: function (_, callback) {
  42231. var deferred = util.defer(function () {
  42232. callback(new UnsupportedStrategy());
  42233. });
  42234. return {
  42235. abort: function () {
  42236. deferred.ensureAborted();
  42237. },
  42238. forceMinPriority: function () { }
  42239. };
  42240. }
  42241. };
  42242. // CONCATENATED MODULE: ./src/core/config.ts
  42243. var getGlobalConfig = function () {
  42244. return {
  42245. wsHost: defaults.host,
  42246. wsPort: defaults.ws_port,
  42247. wssPort: defaults.wss_port,
  42248. wsPath: defaults.ws_path,
  42249. httpHost: defaults.sockjs_host,
  42250. httpPort: defaults.sockjs_http_port,
  42251. httpsPort: defaults.sockjs_https_port,
  42252. httpPath: defaults.sockjs_path,
  42253. statsHost: defaults.stats_host,
  42254. authEndpoint: defaults.channel_auth_endpoint,
  42255. authTransport: defaults.channel_auth_transport,
  42256. activity_timeout: defaults.activity_timeout,
  42257. pong_timeout: defaults.pong_timeout,
  42258. unavailable_timeout: defaults.unavailable_timeout
  42259. };
  42260. };
  42261. var getClusterConfig = function (clusterName) {
  42262. return {
  42263. wsHost: 'ws-' + clusterName + '.pusher.com',
  42264. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42265. };
  42266. };
  42267. // CONCATENATED MODULE: ./src/core/pusher.ts
  42268. var pusher_Pusher = (function () {
  42269. function Pusher(app_key, options) {
  42270. var _this = this;
  42271. checkAppKey(app_key);
  42272. options = options || {};
  42273. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42274. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42275. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42276. }
  42277. this.key = app_key;
  42278. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42279. this.channels = factory.createChannels();
  42280. this.global_emitter = new dispatcher();
  42281. this.sessionID = Math.floor(Math.random() * 1000000000);
  42282. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42283. cluster: this.config.cluster,
  42284. features: Pusher.getClientFeatures(),
  42285. params: this.config.timelineParams || {},
  42286. limit: 50,
  42287. level: timeline_level.INFO,
  42288. version: defaults.VERSION
  42289. });
  42290. if (!this.config.disableStats) {
  42291. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42292. host: this.config.statsHost,
  42293. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42294. });
  42295. }
  42296. var getStrategy = function (options) {
  42297. var config = extend({}, _this.config, options);
  42298. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42299. };
  42300. this.connection = factory.createConnectionManager(this.key, extend({
  42301. getStrategy: getStrategy,
  42302. timeline: this.timeline,
  42303. activityTimeout: this.config.activity_timeout,
  42304. pongTimeout: this.config.pong_timeout,
  42305. unavailableTimeout: this.config.unavailable_timeout
  42306. }, this.config, { useTLS: this.shouldUseTLS() }));
  42307. this.connection.bind('connected', function () {
  42308. _this.subscribeAll();
  42309. if (_this.timelineSender) {
  42310. _this.timelineSender.send(_this.connection.isUsingTLS());
  42311. }
  42312. });
  42313. this.connection.bind('message', function (event) {
  42314. var eventName = event.event;
  42315. var internal = eventName.indexOf('pusher_internal:') === 0;
  42316. if (event.channel) {
  42317. var channel = _this.channel(event.channel);
  42318. if (channel) {
  42319. channel.handleEvent(event);
  42320. }
  42321. }
  42322. if (!internal) {
  42323. _this.global_emitter.emit(event.event, event.data);
  42324. }
  42325. });
  42326. this.connection.bind('connecting', function () {
  42327. _this.channels.disconnect();
  42328. });
  42329. this.connection.bind('disconnected', function () {
  42330. _this.channels.disconnect();
  42331. });
  42332. this.connection.bind('error', function (err) {
  42333. logger.warn(err);
  42334. });
  42335. Pusher.instances.push(this);
  42336. this.timeline.info({ instances: Pusher.instances.length });
  42337. if (Pusher.isReady) {
  42338. this.connect();
  42339. }
  42340. }
  42341. Pusher.ready = function () {
  42342. Pusher.isReady = true;
  42343. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42344. Pusher.instances[i].connect();
  42345. }
  42346. };
  42347. Pusher.getClientFeatures = function () {
  42348. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42349. return t.isSupported({});
  42350. }));
  42351. };
  42352. Pusher.prototype.channel = function (name) {
  42353. return this.channels.find(name);
  42354. };
  42355. Pusher.prototype.allChannels = function () {
  42356. return this.channels.all();
  42357. };
  42358. Pusher.prototype.connect = function () {
  42359. this.connection.connect();
  42360. if (this.timelineSender) {
  42361. if (!this.timelineSenderTimer) {
  42362. var usingTLS = this.connection.isUsingTLS();
  42363. var timelineSender = this.timelineSender;
  42364. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42365. timelineSender.send(usingTLS);
  42366. });
  42367. }
  42368. }
  42369. };
  42370. Pusher.prototype.disconnect = function () {
  42371. this.connection.disconnect();
  42372. if (this.timelineSenderTimer) {
  42373. this.timelineSenderTimer.ensureAborted();
  42374. this.timelineSenderTimer = null;
  42375. }
  42376. };
  42377. Pusher.prototype.bind = function (event_name, callback, context) {
  42378. this.global_emitter.bind(event_name, callback, context);
  42379. return this;
  42380. };
  42381. Pusher.prototype.unbind = function (event_name, callback, context) {
  42382. this.global_emitter.unbind(event_name, callback, context);
  42383. return this;
  42384. };
  42385. Pusher.prototype.bind_global = function (callback) {
  42386. this.global_emitter.bind_global(callback);
  42387. return this;
  42388. };
  42389. Pusher.prototype.unbind_global = function (callback) {
  42390. this.global_emitter.unbind_global(callback);
  42391. return this;
  42392. };
  42393. Pusher.prototype.unbind_all = function (callback) {
  42394. this.global_emitter.unbind_all();
  42395. return this;
  42396. };
  42397. Pusher.prototype.subscribeAll = function () {
  42398. var channelName;
  42399. for (channelName in this.channels.channels) {
  42400. if (this.channels.channels.hasOwnProperty(channelName)) {
  42401. this.subscribe(channelName);
  42402. }
  42403. }
  42404. };
  42405. Pusher.prototype.subscribe = function (channel_name) {
  42406. var channel = this.channels.add(channel_name, this);
  42407. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42408. channel.reinstateSubscription();
  42409. }
  42410. else if (!channel.subscriptionPending &&
  42411. this.connection.state === 'connected') {
  42412. channel.subscribe();
  42413. }
  42414. return channel;
  42415. };
  42416. Pusher.prototype.unsubscribe = function (channel_name) {
  42417. var channel = this.channels.find(channel_name);
  42418. if (channel && channel.subscriptionPending) {
  42419. channel.cancelSubscription();
  42420. }
  42421. else {
  42422. channel = this.channels.remove(channel_name);
  42423. if (channel && this.connection.state === 'connected') {
  42424. channel.unsubscribe();
  42425. }
  42426. }
  42427. };
  42428. Pusher.prototype.send_event = function (event_name, data, channel) {
  42429. return this.connection.send_event(event_name, data, channel);
  42430. };
  42431. Pusher.prototype.shouldUseTLS = function () {
  42432. if (runtime.getProtocol() === 'https:') {
  42433. return true;
  42434. }
  42435. else if (this.config.forceTLS === true) {
  42436. return true;
  42437. }
  42438. else {
  42439. return Boolean(this.config.encrypted);
  42440. }
  42441. };
  42442. Pusher.instances = [];
  42443. Pusher.isReady = false;
  42444. Pusher.logToConsole = false;
  42445. Pusher.Runtime = runtime;
  42446. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42447. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42448. Pusher.auth_callbacks = runtime.auth_callbacks;
  42449. return Pusher;
  42450. }());
  42451. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42452. function checkAppKey(key) {
  42453. if (key === null || key === undefined) {
  42454. throw 'You must pass your app key when you instantiate Pusher.';
  42455. }
  42456. }
  42457. runtime.setup(pusher_Pusher);
  42458. /***/ })
  42459. /******/ ]);
  42460. });
  42461. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42462. /***/ }),
  42463. /***/ "./node_modules/setimmediate/setImmediate.js":
  42464. /*!***************************************************!*\
  42465. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42466. \***************************************************/
  42467. /*! no static exports found */
  42468. /***/ (function(module, exports, __webpack_require__) {
  42469. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42470. "use strict";
  42471. if (global.setImmediate) {
  42472. return;
  42473. }
  42474. var nextHandle = 1; // Spec says greater than zero
  42475. var tasksByHandle = {};
  42476. var currentlyRunningATask = false;
  42477. var doc = global.document;
  42478. var registerImmediate;
  42479. function setImmediate(callback) {
  42480. // Callback can either be a function or a string
  42481. if (typeof callback !== "function") {
  42482. callback = new Function("" + callback);
  42483. }
  42484. // Copy function arguments
  42485. var args = new Array(arguments.length - 1);
  42486. for (var i = 0; i < args.length; i++) {
  42487. args[i] = arguments[i + 1];
  42488. }
  42489. // Store and register the task
  42490. var task = { callback: callback, args: args };
  42491. tasksByHandle[nextHandle] = task;
  42492. registerImmediate(nextHandle);
  42493. return nextHandle++;
  42494. }
  42495. function clearImmediate(handle) {
  42496. delete tasksByHandle[handle];
  42497. }
  42498. function run(task) {
  42499. var callback = task.callback;
  42500. var args = task.args;
  42501. switch (args.length) {
  42502. case 0:
  42503. callback();
  42504. break;
  42505. case 1:
  42506. callback(args[0]);
  42507. break;
  42508. case 2:
  42509. callback(args[0], args[1]);
  42510. break;
  42511. case 3:
  42512. callback(args[0], args[1], args[2]);
  42513. break;
  42514. default:
  42515. callback.apply(undefined, args);
  42516. break;
  42517. }
  42518. }
  42519. function runIfPresent(handle) {
  42520. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42521. // So if we're currently running a task, we'll need to delay this invocation.
  42522. if (currentlyRunningATask) {
  42523. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42524. // "too much recursion" error.
  42525. setTimeout(runIfPresent, 0, handle);
  42526. } else {
  42527. var task = tasksByHandle[handle];
  42528. if (task) {
  42529. currentlyRunningATask = true;
  42530. try {
  42531. run(task);
  42532. } finally {
  42533. clearImmediate(handle);
  42534. currentlyRunningATask = false;
  42535. }
  42536. }
  42537. }
  42538. }
  42539. function installNextTickImplementation() {
  42540. registerImmediate = function(handle) {
  42541. process.nextTick(function () { runIfPresent(handle); });
  42542. };
  42543. }
  42544. function canUsePostMessage() {
  42545. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42546. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42547. if (global.postMessage && !global.importScripts) {
  42548. var postMessageIsAsynchronous = true;
  42549. var oldOnMessage = global.onmessage;
  42550. global.onmessage = function() {
  42551. postMessageIsAsynchronous = false;
  42552. };
  42553. global.postMessage("", "*");
  42554. global.onmessage = oldOnMessage;
  42555. return postMessageIsAsynchronous;
  42556. }
  42557. }
  42558. function installPostMessageImplementation() {
  42559. // Installs an event handler on `global` for the `message` event: see
  42560. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42561. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42562. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42563. var onGlobalMessage = function(event) {
  42564. if (event.source === global &&
  42565. typeof event.data === "string" &&
  42566. event.data.indexOf(messagePrefix) === 0) {
  42567. runIfPresent(+event.data.slice(messagePrefix.length));
  42568. }
  42569. };
  42570. if (global.addEventListener) {
  42571. global.addEventListener("message", onGlobalMessage, false);
  42572. } else {
  42573. global.attachEvent("onmessage", onGlobalMessage);
  42574. }
  42575. registerImmediate = function(handle) {
  42576. global.postMessage(messagePrefix + handle, "*");
  42577. };
  42578. }
  42579. function installMessageChannelImplementation() {
  42580. var channel = new MessageChannel();
  42581. channel.port1.onmessage = function(event) {
  42582. var handle = event.data;
  42583. runIfPresent(handle);
  42584. };
  42585. registerImmediate = function(handle) {
  42586. channel.port2.postMessage(handle);
  42587. };
  42588. }
  42589. function installReadyStateChangeImplementation() {
  42590. var html = doc.documentElement;
  42591. registerImmediate = function(handle) {
  42592. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42593. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42594. var script = doc.createElement("script");
  42595. script.onreadystatechange = function () {
  42596. runIfPresent(handle);
  42597. script.onreadystatechange = null;
  42598. html.removeChild(script);
  42599. script = null;
  42600. };
  42601. html.appendChild(script);
  42602. };
  42603. }
  42604. function installSetTimeoutImplementation() {
  42605. registerImmediate = function(handle) {
  42606. setTimeout(runIfPresent, 0, handle);
  42607. };
  42608. }
  42609. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42610. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42611. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42612. // Don't get fooled by e.g. browserify environments.
  42613. if ({}.toString.call(global.process) === "[object process]") {
  42614. // For Node.js before 0.9
  42615. installNextTickImplementation();
  42616. } else if (canUsePostMessage()) {
  42617. // For non-IE10 modern browsers
  42618. installPostMessageImplementation();
  42619. } else if (global.MessageChannel) {
  42620. // For web workers, where supported
  42621. installMessageChannelImplementation();
  42622. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42623. // For IE 6–8
  42624. installReadyStateChangeImplementation();
  42625. } else {
  42626. // For older browsers
  42627. installSetTimeoutImplementation();
  42628. }
  42629. attachTo.setImmediate = setImmediate;
  42630. attachTo.clearImmediate = clearImmediate;
  42631. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42632. /* 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")))
  42633. /***/ }),
  42634. /***/ "./node_modules/timers-browserify/main.js":
  42635. /*!************************************************!*\
  42636. !*** ./node_modules/timers-browserify/main.js ***!
  42637. \************************************************/
  42638. /*! no static exports found */
  42639. /***/ (function(module, exports, __webpack_require__) {
  42640. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42641. (typeof self !== "undefined" && self) ||
  42642. window;
  42643. var apply = Function.prototype.apply;
  42644. // DOM APIs, for completeness
  42645. exports.setTimeout = function() {
  42646. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42647. };
  42648. exports.setInterval = function() {
  42649. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42650. };
  42651. exports.clearTimeout =
  42652. exports.clearInterval = function(timeout) {
  42653. if (timeout) {
  42654. timeout.close();
  42655. }
  42656. };
  42657. function Timeout(id, clearFn) {
  42658. this._id = id;
  42659. this._clearFn = clearFn;
  42660. }
  42661. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42662. Timeout.prototype.close = function() {
  42663. this._clearFn.call(scope, this._id);
  42664. };
  42665. // Does not start the time, just sets up the members needed.
  42666. exports.enroll = function(item, msecs) {
  42667. clearTimeout(item._idleTimeoutId);
  42668. item._idleTimeout = msecs;
  42669. };
  42670. exports.unenroll = function(item) {
  42671. clearTimeout(item._idleTimeoutId);
  42672. item._idleTimeout = -1;
  42673. };
  42674. exports._unrefActive = exports.active = function(item) {
  42675. clearTimeout(item._idleTimeoutId);
  42676. var msecs = item._idleTimeout;
  42677. if (msecs >= 0) {
  42678. item._idleTimeoutId = setTimeout(function onTimeout() {
  42679. if (item._onTimeout)
  42680. item._onTimeout();
  42681. }, msecs);
  42682. }
  42683. };
  42684. // setimmediate attaches itself to the global object
  42685. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42686. // On some exotic environments, it's not clear which object `setimmediate` was
  42687. // able to install onto. Search each possibility in the same order as the
  42688. // `setimmediate` library.
  42689. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42690. (typeof global !== "undefined" && global.setImmediate) ||
  42691. (this && this.setImmediate);
  42692. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42693. (typeof global !== "undefined" && global.clearImmediate) ||
  42694. (this && this.clearImmediate);
  42695. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42696. /***/ }),
  42697. /***/ "./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&":
  42698. /*!*******************************************************************************************************************************************************************************************************************!*\
  42699. !*** ./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& ***!
  42700. \*******************************************************************************************************************************************************************************************************************/
  42701. /*! exports provided: render, staticRenderFns */
  42702. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42703. "use strict";
  42704. __webpack_require__.r(__webpack_exports__);
  42705. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42706. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42707. var render = function() {
  42708. var _vm = this
  42709. var _h = _vm.$createElement
  42710. var _c = _vm._self._c || _h
  42711. return _vm._m(0)
  42712. }
  42713. var staticRenderFns = [
  42714. function() {
  42715. var _vm = this
  42716. var _h = _vm.$createElement
  42717. var _c = _vm._self._c || _h
  42718. return _c("div", { staticClass: "container" }, [
  42719. _c("div", { staticClass: "row justify-content-center" }, [
  42720. _c("div", { staticClass: "col-md-8" }, [
  42721. _c("div", { staticClass: "card" }, [
  42722. _c("div", { staticClass: "card-header" }, [
  42723. _vm._v("Example Component")
  42724. ]),
  42725. _vm._v(" "),
  42726. _c("div", { staticClass: "card-body" }, [
  42727. _vm._v(
  42728. "\n I'm an example component.\n "
  42729. )
  42730. ])
  42731. ])
  42732. ])
  42733. ])
  42734. ])
  42735. }
  42736. ]
  42737. render._withStripped = true
  42738. /***/ }),
  42739. /***/ "./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&":
  42740. /*!************************************************************************************************************************************************************************************************************!*\
  42741. !*** ./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& ***!
  42742. \************************************************************************************************************************************************************************************************************/
  42743. /*! exports provided: render, staticRenderFns */
  42744. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42745. "use strict";
  42746. __webpack_require__.r(__webpack_exports__);
  42747. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42748. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42749. var render = function() {
  42750. var _vm = this
  42751. var _h = _vm.$createElement
  42752. var _c = _vm._self._c || _h
  42753. return _c(
  42754. "div",
  42755. [
  42756. _c(
  42757. "modal",
  42758. {
  42759. attrs: {
  42760. id: "asseteditModal",
  42761. tabindex: "-1",
  42762. role: "dialog",
  42763. "aria-labelledby": "asseteditModalLabel"
  42764. }
  42765. },
  42766. [
  42767. _c(
  42768. "h5",
  42769. {
  42770. staticClass: "modal-title",
  42771. attrs: { slot: "header", id: "asseteditModalLabel" },
  42772. slot: "header"
  42773. },
  42774. [_vm._v("\n Edit Work Order Information\n ")]
  42775. ),
  42776. _vm._v(" "),
  42777. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  42778. _c("div", { staticClass: "form-group" }, [
  42779. _c("label", { attrs: { for: "manufacturer" } }, [
  42780. _vm._v("Manufacturer")
  42781. ]),
  42782. _vm._v(" "),
  42783. _c("input", {
  42784. directives: [
  42785. {
  42786. name: "model",
  42787. rawName: "v-model.lazy",
  42788. value: _vm.data.pcmanu,
  42789. expression: "data.pcmanu",
  42790. modifiers: { lazy: true }
  42791. }
  42792. ],
  42793. staticClass: "form-control",
  42794. attrs: {
  42795. type: "text",
  42796. name: "manufacturer",
  42797. id: "manufacturer"
  42798. },
  42799. domProps: { value: _vm.data.pcmanu },
  42800. on: {
  42801. change: function($event) {
  42802. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  42803. }
  42804. }
  42805. })
  42806. ]),
  42807. _vm._v(" "),
  42808. _c("div", { staticClass: "form-group" }, [
  42809. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  42810. _vm._v(" "),
  42811. _c("input", {
  42812. directives: [
  42813. {
  42814. name: "model",
  42815. rawName: "v-model.lazy",
  42816. value: _vm.data.pcmake,
  42817. expression: "data.pcmake",
  42818. modifiers: { lazy: true }
  42819. }
  42820. ],
  42821. staticClass: "form-control",
  42822. attrs: { type: "text", name: "make", id: "make" },
  42823. domProps: { value: _vm.data.pcmake },
  42824. on: {
  42825. change: function($event) {
  42826. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  42827. }
  42828. }
  42829. })
  42830. ]),
  42831. _vm._v(" "),
  42832. _c("div", { staticClass: "form-group" }, [
  42833. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  42834. _vm._v(" "),
  42835. _c("input", {
  42836. directives: [
  42837. {
  42838. name: "model",
  42839. rawName: "v-model.lazy",
  42840. value: _vm.data.pcnickname,
  42841. expression: "data.pcnickname",
  42842. modifiers: { lazy: true }
  42843. }
  42844. ],
  42845. staticClass: "form-control",
  42846. attrs: { type: "text", name: "nickname", id: "nickname" },
  42847. domProps: { value: _vm.data.pcnickname },
  42848. on: {
  42849. change: function($event) {
  42850. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  42851. }
  42852. }
  42853. })
  42854. ]),
  42855. _vm._v(" "),
  42856. _c("div", { staticClass: "form-group" }, [
  42857. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  42858. _vm._v(" "),
  42859. _c("input", {
  42860. directives: [
  42861. {
  42862. name: "model",
  42863. rawName: "v-model.lazy",
  42864. value: _vm.pcextra[2],
  42865. expression: "pcextra[2]",
  42866. modifiers: { lazy: true }
  42867. }
  42868. ],
  42869. staticClass: "form-control",
  42870. attrs: { type: "text", name: "os", id: "os" },
  42871. domProps: { value: _vm.pcextra[2] },
  42872. on: {
  42873. change: function($event) {
  42874. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  42875. }
  42876. }
  42877. })
  42878. ]),
  42879. _vm._v(" "),
  42880. _c("div", { staticClass: "form-group" }, [
  42881. _c("label", { attrs: { for: "serial" } }, [
  42882. _vm._v("Serial Number")
  42883. ]),
  42884. _vm._v(" "),
  42885. _c("input", {
  42886. directives: [
  42887. {
  42888. name: "model",
  42889. rawName: "v-model.lazy",
  42890. value: _vm.pcextra[104],
  42891. expression: "pcextra[104]",
  42892. modifiers: { lazy: true }
  42893. }
  42894. ],
  42895. staticClass: "form-control",
  42896. attrs: { type: "text", id: "serial", name: "serial" },
  42897. domProps: { value: _vm.pcextra[104] },
  42898. on: {
  42899. change: function($event) {
  42900. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  42901. }
  42902. }
  42903. })
  42904. ]),
  42905. _vm._v(" "),
  42906. _c("div", { staticClass: "form-group" }, [
  42907. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  42908. _vm._v(" "),
  42909. _c("input", {
  42910. directives: [
  42911. {
  42912. name: "model",
  42913. rawName: "v-model.lazy",
  42914. value: _vm.pcextra[101],
  42915. expression: "pcextra[101]",
  42916. modifiers: { lazy: true }
  42917. }
  42918. ],
  42919. staticClass: "form-control",
  42920. attrs: { type: "text", id: "cpu", name: "cpu" },
  42921. domProps: { value: _vm.pcextra[101] },
  42922. on: {
  42923. change: function($event) {
  42924. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  42925. }
  42926. }
  42927. })
  42928. ]),
  42929. _vm._v(" "),
  42930. _c("div", { staticClass: "form-group" }, [
  42931. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  42932. _vm._v(" "),
  42933. _c("input", {
  42934. directives: [
  42935. {
  42936. name: "model",
  42937. rawName: "v-model.lazy",
  42938. value: _vm.pcextra[100],
  42939. expression: "pcextra[100]",
  42940. modifiers: { lazy: true }
  42941. }
  42942. ],
  42943. staticClass: "form-control",
  42944. attrs: { type: "text", name: "ram", id: "ram" },
  42945. domProps: { value: _vm.pcextra[100] },
  42946. on: {
  42947. change: function($event) {
  42948. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  42949. }
  42950. }
  42951. })
  42952. ]),
  42953. _vm._v(" "),
  42954. _c("div", { staticClass: "form-group" }, [
  42955. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  42956. _vm._v(" "),
  42957. _c("input", {
  42958. directives: [
  42959. {
  42960. name: "model",
  42961. rawName: "v-model.lazy",
  42962. value: _vm.pcextra[4],
  42963. expression: "pcextra[4]",
  42964. modifiers: { lazy: true }
  42965. }
  42966. ],
  42967. staticClass: "form-control",
  42968. attrs: { type: "text", name: "graphics", id: "grapics" },
  42969. domProps: { value: _vm.pcextra[4] },
  42970. on: {
  42971. change: function($event) {
  42972. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  42973. }
  42974. }
  42975. })
  42976. ])
  42977. ]),
  42978. _vm._v(" "),
  42979. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  42980. _c(
  42981. "button",
  42982. {
  42983. staticClass: "btn btn-secondary",
  42984. attrs: { type: "button", "data-dismiss": "modal" }
  42985. },
  42986. [_vm._v("Close")]
  42987. ),
  42988. _vm._v(" "),
  42989. _c(
  42990. "button",
  42991. {
  42992. staticClass: "btn btn-primary",
  42993. attrs: { type: "button" },
  42994. on: {
  42995. click: function($event) {
  42996. return _vm.updateAsset()
  42997. }
  42998. }
  42999. },
  43000. [_vm._v("Save")]
  43001. )
  43002. ])
  43003. ]
  43004. ),
  43005. _vm._v(" "),
  43006. _c("h4", { staticClass: "text-center" }, [
  43007. _vm._v(
  43008. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43009. ),
  43010. _c("small", { staticClass: "text-muted" }, [
  43011. _vm._v(_vm._s(this.data.pcnickname))
  43012. ])
  43013. ]),
  43014. _vm._v(" "),
  43015. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43016. _vm._v(" "),
  43017. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43018. _vm._v(" "),
  43019. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43020. _vm._v(" "),
  43021. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43022. _vm._v(" "),
  43023. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43024. _vm._v(" "),
  43025. _c(
  43026. "button",
  43027. {
  43028. staticClass: "btn btn-primary",
  43029. attrs: {
  43030. type: "button",
  43031. "data-toggle": "modal",
  43032. "data-target": "#asseteditModal"
  43033. }
  43034. },
  43035. [_vm._v("Edit")]
  43036. )
  43037. ],
  43038. 1
  43039. )
  43040. }
  43041. var staticRenderFns = []
  43042. render._withStripped = true
  43043. /***/ }),
  43044. /***/ "./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&":
  43045. /*!*************************************************************************************************************************************************************************************************************!*\
  43046. !*** ./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& ***!
  43047. \*************************************************************************************************************************************************************************************************************/
  43048. /*! exports provided: render, staticRenderFns */
  43049. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43050. "use strict";
  43051. __webpack_require__.r(__webpack_exports__);
  43052. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43053. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43054. var render = function() {
  43055. var _vm = this
  43056. var _h = _vm.$createElement
  43057. var _c = _vm._self._c || _h
  43058. return _c(
  43059. "div",
  43060. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43061. [
  43062. _c(
  43063. "modal",
  43064. {
  43065. attrs: {
  43066. id: "credential" + this.data.credid + "editModal",
  43067. tabindex: "-1",
  43068. role: "dialog",
  43069. "aria-labelledby": "credential" + _vm.data.credid + "editModalLabel"
  43070. }
  43071. },
  43072. [
  43073. _c(
  43074. "h5",
  43075. {
  43076. staticClass: "modal-title",
  43077. attrs: { slot: "header", id: "credentialeditModalLabel" },
  43078. slot: "header"
  43079. },
  43080. [_vm._v("\r\n Edit Credential\r\n ")]
  43081. ),
  43082. _vm._v(" "),
  43083. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43084. _c("div", { staticClass: "form-group" }, [
  43085. _c("label", { attrs: { for: "newusername" } }, [
  43086. _vm._v("Username")
  43087. ]),
  43088. _vm._v(" "),
  43089. _c("input", {
  43090. directives: [
  43091. {
  43092. name: "model",
  43093. rawName: "v-model.lazy",
  43094. value: _vm.data.creduser,
  43095. expression: "data.creduser",
  43096. modifiers: { lazy: true }
  43097. }
  43098. ],
  43099. staticClass: "form-control credential",
  43100. attrs: {
  43101. type: "text",
  43102. name: "newusername" + _vm.data.credid,
  43103. id: "newusername" + _vm.data.credid
  43104. },
  43105. domProps: { value: _vm.data.creduser },
  43106. on: {
  43107. change: function($event) {
  43108. return _vm.$set(_vm.data, "creduser", $event.target.value)
  43109. }
  43110. }
  43111. })
  43112. ]),
  43113. _vm._v(" "),
  43114. _c("div", { staticClass: "form-group" }, [
  43115. _c("label", { attrs: { for: "newpassword" } }, [
  43116. _vm._v("Password")
  43117. ]),
  43118. _vm._v(" "),
  43119. _c("input", {
  43120. directives: [
  43121. {
  43122. name: "model",
  43123. rawName: "v-model.lazy",
  43124. value: _vm.data.credpass,
  43125. expression: "data.credpass",
  43126. modifiers: { lazy: true }
  43127. }
  43128. ],
  43129. ref: "newpassword" + _vm.data.credid,
  43130. staticClass: "form-control credential",
  43131. attrs: {
  43132. type: "text",
  43133. name: "newpassword" + _vm.data.credid,
  43134. id: "newpassword" + _vm.data.credid
  43135. },
  43136. domProps: { value: _vm.data.credpass },
  43137. on: {
  43138. change: function($event) {
  43139. return _vm.$set(_vm.data, "credpass", $event.target.value)
  43140. }
  43141. }
  43142. }),
  43143. _vm._v(" "),
  43144. _c(
  43145. "button",
  43146. {
  43147. staticClass: "btn btn-secondary",
  43148. attrs: { type: "button" },
  43149. on: {
  43150. click: function($event) {
  43151. return _vm.getRandomPassword(_vm.data.credid)
  43152. }
  43153. }
  43154. },
  43155. [_vm._v("Generate Random")]
  43156. )
  43157. ]),
  43158. _vm._v(" "),
  43159. _c("div", { staticClass: "form-group" })
  43160. ]),
  43161. _vm._v(" "),
  43162. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43163. _c(
  43164. "button",
  43165. {
  43166. staticClass: "btn btn-secondary",
  43167. attrs: { type: "button", "data-dismiss": "modal" }
  43168. },
  43169. [_vm._v("Close")]
  43170. ),
  43171. _vm._v(" "),
  43172. _c(
  43173. "button",
  43174. {
  43175. staticClass: "btn btn-primary",
  43176. attrs: { type: "button" },
  43177. on: {
  43178. click: function($event) {
  43179. return _vm.updateCredential()
  43180. }
  43181. }
  43182. },
  43183. [_vm._v("Save")]
  43184. )
  43185. ])
  43186. ]
  43187. ),
  43188. _vm._v(" "),
  43189. _c("div", { staticClass: "row no-gutters" }, [
  43190. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43191. _vm._v(_vm._s(this.data.creddesc))
  43192. ]),
  43193. _vm._v(" "),
  43194. _c("div", { staticClass: "col-9 text-right" }, [
  43195. _vm._v(_vm._s(this.data.creddate))
  43196. ])
  43197. ]),
  43198. _vm._v(" "),
  43199. _c("div", { staticClass: "row" }, [
  43200. _c("div", { staticClass: "col-lg-9" }, [
  43201. _c("div", [
  43202. _vm._m(0),
  43203. _vm._v(" "),
  43204. _c("input", {
  43205. staticClass: "border-0 credential",
  43206. attrs: {
  43207. type: "text",
  43208. id: "username" + this.data.credid,
  43209. readonly: ""
  43210. },
  43211. domProps: { value: this.data.creduser }
  43212. }),
  43213. _vm._v(" "),
  43214. _c(
  43215. "button",
  43216. {
  43217. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43218. attrs: {
  43219. id: "btn-username" + this.data.credid,
  43220. "data-clipboard-target": "#username" + this.data.credid
  43221. }
  43222. },
  43223. [_c("i", { staticClass: "far fa-clone" })]
  43224. )
  43225. ]),
  43226. _vm._v(" "),
  43227. _c("div", [
  43228. _vm._m(1),
  43229. _vm._v(" "),
  43230. _c("input", {
  43231. staticClass: "border-0 credential",
  43232. attrs: {
  43233. type: "text",
  43234. id: "password" + this.data.credid,
  43235. readonly: ""
  43236. },
  43237. domProps: { value: this.data.credpass }
  43238. }),
  43239. _vm._v(" "),
  43240. _c(
  43241. "button",
  43242. {
  43243. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43244. attrs: {
  43245. id: "btn-password" + this.data.credid,
  43246. "data-clipboard-target": "#password" + this.data.credid
  43247. }
  43248. },
  43249. [_c("i", { staticClass: "far fa-clone" })]
  43250. )
  43251. ])
  43252. ]),
  43253. _vm._v(" "),
  43254. _c(
  43255. "div",
  43256. {
  43257. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43258. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43259. },
  43260. [
  43261. _c(
  43262. "button",
  43263. {
  43264. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43265. attrs: {
  43266. type: "button",
  43267. "data-toggle": "modal",
  43268. "data-target": "#credential" + this.data.credid + "editModal"
  43269. }
  43270. },
  43271. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43272. ),
  43273. _vm._v(" "),
  43274. _vm._m(2)
  43275. ]
  43276. )
  43277. ])
  43278. ],
  43279. 1
  43280. )
  43281. }
  43282. var staticRenderFns = [
  43283. function() {
  43284. var _vm = this
  43285. var _h = _vm.$createElement
  43286. var _c = _vm._self._c || _h
  43287. return _c("label", { attrs: { for: "username" } }, [
  43288. _c("i", { staticClass: "fas fa-fw fa-user" })
  43289. ])
  43290. },
  43291. function() {
  43292. var _vm = this
  43293. var _h = _vm.$createElement
  43294. var _c = _vm._self._c || _h
  43295. return _c("label", { attrs: { for: "password" } }, [
  43296. _c("i", { staticClass: "fas fa-fw fa-key" })
  43297. ])
  43298. },
  43299. function() {
  43300. var _vm = this
  43301. var _h = _vm.$createElement
  43302. var _c = _vm._self._c || _h
  43303. return _c(
  43304. "button",
  43305. {
  43306. staticClass: "btn btn-sm btn-danger p-lg-1",
  43307. attrs: { type: "button" }
  43308. },
  43309. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43310. )
  43311. }
  43312. ]
  43313. render._withStripped = true
  43314. /***/ }),
  43315. /***/ "./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&":
  43316. /*!************************************************************************************************************************************************************************************************************!*\
  43317. !*** ./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& ***!
  43318. \************************************************************************************************************************************************************************************************************/
  43319. /*! exports provided: render, staticRenderFns */
  43320. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43321. "use strict";
  43322. __webpack_require__.r(__webpack_exports__);
  43323. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43324. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43325. var render = function() {
  43326. var _vm = this
  43327. var _h = _vm.$createElement
  43328. var _c = _vm._self._c || _h
  43329. return _c(
  43330. "ul",
  43331. { staticClass: "list-unstyled" },
  43332. _vm._l(_vm.errorList, function(error) {
  43333. return _c("li", { key: error, staticClass: "text-danger" }, [
  43334. _vm._v(" " + _vm._s(error) + " ")
  43335. ])
  43336. }),
  43337. 0
  43338. )
  43339. }
  43340. var staticRenderFns = []
  43341. render._withStripped = true
  43342. /***/ }),
  43343. /***/ "./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&":
  43344. /*!********************************************************************************************************************************************************************************************************!*\
  43345. !*** ./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& ***!
  43346. \********************************************************************************************************************************************************************************************************/
  43347. /*! exports provided: render, staticRenderFns */
  43348. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43349. "use strict";
  43350. __webpack_require__.r(__webpack_exports__);
  43351. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43352. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43353. var render = function() {
  43354. var _vm = this
  43355. var _h = _vm.$createElement
  43356. var _c = _vm._self._c || _h
  43357. return _c("div", { staticClass: "modal fade" }, [
  43358. _c(
  43359. "div",
  43360. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43361. [
  43362. _c("div", { staticClass: "modal-content" }, [
  43363. _c(
  43364. "div",
  43365. { staticClass: "modal-header" },
  43366. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43367. 2
  43368. ),
  43369. _vm._v(" "),
  43370. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43371. _vm._v(" "),
  43372. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43373. ])
  43374. ]
  43375. )
  43376. ])
  43377. }
  43378. var staticRenderFns = [
  43379. function() {
  43380. var _vm = this
  43381. var _h = _vm.$createElement
  43382. var _c = _vm._self._c || _h
  43383. return _c(
  43384. "button",
  43385. {
  43386. staticClass: "close",
  43387. attrs: {
  43388. type: "button",
  43389. "data-dismiss": "modal",
  43390. "aria-label": "Close"
  43391. }
  43392. },
  43393. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43394. )
  43395. }
  43396. ]
  43397. render._withStripped = true
  43398. /***/ }),
  43399. /***/ "./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&":
  43400. /*!********************************************************************************************************************************************************************************************************!*\
  43401. !*** ./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& ***!
  43402. \********************************************************************************************************************************************************************************************************/
  43403. /*! exports provided: render, staticRenderFns */
  43404. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43405. "use strict";
  43406. __webpack_require__.r(__webpack_exports__);
  43407. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43408. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43409. var render = function() {
  43410. var _vm = this
  43411. var _h = _vm.$createElement
  43412. var _c = _vm._self._c || _h
  43413. return _c(
  43414. "ul",
  43415. { staticClass: "list-unstyled" },
  43416. _vm._l(this.notes, function(note) {
  43417. return _c(
  43418. "li",
  43419. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43420. [
  43421. _c(
  43422. "modal",
  43423. {
  43424. attrs: {
  43425. id: "note" + note.noteid + "editModal",
  43426. tabindex: "-1",
  43427. role: "dialog",
  43428. "aria-labelledby": "note" + note.noteid + "editModalLabel"
  43429. }
  43430. },
  43431. [
  43432. _c(
  43433. "h5",
  43434. {
  43435. staticClass: "modal-title",
  43436. attrs: {
  43437. slot: "header",
  43438. id: "note" + note.noteid + "editModalLabel"
  43439. },
  43440. slot: "header"
  43441. },
  43442. [_vm._v("\n Edit Note\n ")]
  43443. ),
  43444. _vm._v(" "),
  43445. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43446. _c("div", { staticClass: "form-group" }, [
  43447. _c("label", { attrs: { for: "content" } }, [
  43448. _vm._v("Content")
  43449. ]),
  43450. _vm._v(" "),
  43451. _c("textarea", {
  43452. directives: [
  43453. {
  43454. name: "model",
  43455. rawName: "v-model",
  43456. value: note.thenote,
  43457. expression: "note.thenote"
  43458. }
  43459. ],
  43460. staticClass: "form-control",
  43461. attrs: {
  43462. name: "content" + note.noteid,
  43463. id: "content" + note.noteid
  43464. },
  43465. domProps: { value: note.thenote },
  43466. on: {
  43467. input: function($event) {
  43468. if ($event.target.composing) {
  43469. return
  43470. }
  43471. _vm.$set(note, "thenote", $event.target.value)
  43472. }
  43473. }
  43474. })
  43475. ])
  43476. ]),
  43477. _vm._v(" "),
  43478. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43479. _c(
  43480. "button",
  43481. {
  43482. staticClass: "btn btn-secondary",
  43483. attrs: { type: "button", "data-dismiss": "modal" }
  43484. },
  43485. [_vm._v("Close")]
  43486. ),
  43487. _vm._v(" "),
  43488. _c(
  43489. "button",
  43490. {
  43491. staticClass: "btn btn-primary",
  43492. attrs: { type: "button" },
  43493. on: {
  43494. click: function($event) {
  43495. return _vm.updateNote(note.noteid)
  43496. }
  43497. }
  43498. },
  43499. [_vm._v("Save")]
  43500. )
  43501. ])
  43502. ]
  43503. ),
  43504. _vm._v(" "),
  43505. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  43506. _c("div", { staticClass: "text-center p-0 m-0" }, [
  43507. _vm._v(_vm._s(note.noteuser))
  43508. ]),
  43509. _vm._v(" "),
  43510. _c(
  43511. "div",
  43512. { staticClass: "text-muted text-small text-center p-0 m-0" },
  43513. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  43514. ),
  43515. _vm._v(" "),
  43516. _c(
  43517. "div",
  43518. { staticClass: "btn-group justify-content-center p-0 m-0" },
  43519. [
  43520. _vm.authusername === note.noteuser ||
  43521. _vm.authusername === "admin"
  43522. ? [
  43523. _c(
  43524. "button",
  43525. {
  43526. staticClass: "btn btn-sm btn-primary m-1",
  43527. attrs: {
  43528. "data-toggle": "modal",
  43529. "data-target": "#note" + note.noteid + "editModal"
  43530. }
  43531. },
  43532. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43533. ),
  43534. _vm._v(" "),
  43535. _vm._m(0, true),
  43536. _vm._v(" "),
  43537. _vm._m(1, true)
  43538. ]
  43539. : _vm._e()
  43540. ],
  43541. 2
  43542. )
  43543. ]),
  43544. _vm._v(" "),
  43545. _c("div", { staticClass: "col-md-10" }, [
  43546. _c("div", { staticClass: "card m-2" }, [
  43547. _c("div", { staticClass: "card-body p-2" }, [
  43548. _vm._v(
  43549. "\n " +
  43550. _vm._s(note.thenote) +
  43551. "\n "
  43552. )
  43553. ])
  43554. ])
  43555. ])
  43556. ],
  43557. 1
  43558. )
  43559. }),
  43560. 0
  43561. )
  43562. }
  43563. var staticRenderFns = [
  43564. function() {
  43565. var _vm = this
  43566. var _h = _vm.$createElement
  43567. var _c = _vm._self._c || _h
  43568. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  43569. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  43570. ])
  43571. },
  43572. function() {
  43573. var _vm = this
  43574. var _h = _vm.$createElement
  43575. var _c = _vm._self._c || _h
  43576. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  43577. _c("i", { staticClass: "fa fa-fw fa-random" })
  43578. ])
  43579. }
  43580. ]
  43581. render._withStripped = true
  43582. /***/ }),
  43583. /***/ "./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&":
  43584. /*!********************************************************************************************************************************************************************************************************************!*\
  43585. !*** ./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& ***!
  43586. \********************************************************************************************************************************************************************************************************************/
  43587. /*! exports provided: render, staticRenderFns */
  43588. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43589. "use strict";
  43590. __webpack_require__.r(__webpack_exports__);
  43591. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43592. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43593. var render = function() {
  43594. var _vm = this
  43595. var _h = _vm.$createElement
  43596. var _c = _vm._self._c || _h
  43597. return _c(
  43598. "modal",
  43599. {
  43600. attrs: {
  43601. id: _vm.id,
  43602. tabindex: "-1",
  43603. role: "dialog",
  43604. "aria-labelledby": _vm.id + "Label"
  43605. }
  43606. },
  43607. [
  43608. _c(
  43609. "h5",
  43610. {
  43611. staticClass: "modal-title",
  43612. attrs: { slot: "header", id: _vm.id + "Label" },
  43613. slot: "header"
  43614. },
  43615. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  43616. ),
  43617. _vm._v(" "),
  43618. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43619. _c(
  43620. "div",
  43621. { staticClass: "form-group" },
  43622. [
  43623. _c("label", { attrs: { for: "probdesc" } }, [
  43624. _vm._v("Problem Description")
  43625. ]),
  43626. _vm._v(" "),
  43627. _c("textarea", {
  43628. directives: [
  43629. {
  43630. name: "model",
  43631. rawName: "v-model",
  43632. value: _vm.data.probdesc,
  43633. expression: "data.probdesc"
  43634. }
  43635. ],
  43636. class: {
  43637. "form-control": true,
  43638. "is-invalid": _vm.errors.probdesc
  43639. },
  43640. attrs: { id: "probdesc", name: "probdesc" },
  43641. domProps: { value: _vm.data.probdesc },
  43642. on: {
  43643. input: function($event) {
  43644. if ($event.target.composing) {
  43645. return
  43646. }
  43647. _vm.$set(_vm.data, "probdesc", $event.target.value)
  43648. }
  43649. }
  43650. }),
  43651. _vm._v(" "),
  43652. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  43653. ],
  43654. 1
  43655. ),
  43656. _vm._v(" "),
  43657. _c(
  43658. "div",
  43659. { staticClass: "form-group" },
  43660. [
  43661. _c("label", { attrs: { for: "suggested" } }, [
  43662. _vm._v("Suggested Solution")
  43663. ]),
  43664. _vm._v(" "),
  43665. _c("textarea", {
  43666. directives: [
  43667. {
  43668. name: "model",
  43669. rawName: "v-model",
  43670. value: _vm.data.suggested,
  43671. expression: "data.suggested"
  43672. }
  43673. ],
  43674. class: {
  43675. "form-control": true,
  43676. "is-invalid": _vm.errors.suggested
  43677. },
  43678. attrs: { id: "suggested", name: "suggested" },
  43679. domProps: { value: _vm.data.suggested },
  43680. on: {
  43681. input: function($event) {
  43682. if ($event.target.composing) {
  43683. return
  43684. }
  43685. _vm.$set(_vm.data, "suggested", $event.target.value)
  43686. }
  43687. }
  43688. }),
  43689. _vm._v(" "),
  43690. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  43691. ],
  43692. 1
  43693. ),
  43694. _vm._v(" "),
  43695. _c("div", { staticClass: "form-group" }, [
  43696. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  43697. _vm._v(" "),
  43698. _vm.storeList
  43699. ? _c(
  43700. "select",
  43701. {
  43702. directives: [
  43703. {
  43704. name: "model",
  43705. rawName: "v-model",
  43706. value: _vm.data.storeid,
  43707. expression: "data.storeid"
  43708. }
  43709. ],
  43710. staticClass: "form-control",
  43711. attrs: { name: "storelist", id: "storelist" },
  43712. on: {
  43713. change: function($event) {
  43714. var $$selectedVal = Array.prototype.filter
  43715. .call($event.target.options, function(o) {
  43716. return o.selected
  43717. })
  43718. .map(function(o) {
  43719. var val = "_value" in o ? o._value : o.value
  43720. return val
  43721. })
  43722. _vm.$set(
  43723. _vm.data,
  43724. "storeid",
  43725. $event.target.multiple
  43726. ? $$selectedVal
  43727. : $$selectedVal[0]
  43728. )
  43729. }
  43730. }
  43731. },
  43732. _vm._l(_vm.storeList, function(store) {
  43733. return _c(
  43734. "option",
  43735. { key: store.storeid, domProps: { value: store.storeid } },
  43736. [
  43737. _vm._v(
  43738. "\r\n " +
  43739. _vm._s(store.storesname) +
  43740. "\r\n "
  43741. )
  43742. ]
  43743. )
  43744. }),
  43745. 0
  43746. )
  43747. : _vm._e()
  43748. ])
  43749. ]),
  43750. _vm._v(" "),
  43751. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43752. _c(
  43753. "button",
  43754. {
  43755. staticClass: "btn btn-secondary",
  43756. attrs: { type: "button", "data-dismiss": "modal" }
  43757. },
  43758. [_vm._v("Close")]
  43759. ),
  43760. _vm._v(" "),
  43761. _c(
  43762. "button",
  43763. {
  43764. staticClass: "btn btn-primary",
  43765. attrs: { type: "button" },
  43766. on: {
  43767. click: function($event) {
  43768. return _vm.updateWorkOrder()
  43769. }
  43770. }
  43771. },
  43772. [_vm._v("Save")]
  43773. )
  43774. ])
  43775. ]
  43776. )
  43777. }
  43778. var staticRenderFns = []
  43779. render._withStripped = true
  43780. /***/ }),
  43781. /***/ "./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&":
  43782. /*!*********************************************************************************************************************************************************************************************************!*\
  43783. !*** ./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& ***!
  43784. \*********************************************************************************************************************************************************************************************************/
  43785. /*! exports provided: render, staticRenderFns */
  43786. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43787. "use strict";
  43788. __webpack_require__.r(__webpack_exports__);
  43789. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43790. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43791. var render = function() {
  43792. var _vm = this
  43793. var _h = _vm.$createElement
  43794. var _c = _vm._self._c || _h
  43795. return _c(
  43796. "div",
  43797. [
  43798. _c("woinfo-edit-modal", {
  43799. attrs: {
  43800. "modal-id": "workordereditModal",
  43801. "populate-with": this.data,
  43802. "store-list": this.storeList
  43803. }
  43804. }),
  43805. _vm._v(" "),
  43806. _c("p", [
  43807. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  43808. _vm._v(" "),
  43809. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  43810. ]),
  43811. _vm._v(" "),
  43812. _c("p", [
  43813. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  43814. _vm._v(" "),
  43815. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  43816. ]),
  43817. _vm._v(" "),
  43818. _c("p", [
  43819. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  43820. _vm._v(" "),
  43821. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  43822. ]),
  43823. _vm._v(" "),
  43824. _c("p", [
  43825. _c("i", { staticClass: "fas fa-fw fa-building" }),
  43826. _vm._v(" "),
  43827. this.storeList
  43828. ? _c("span", [
  43829. _vm._v(_vm._s(this.storeList[this.data.storeid].storesname))
  43830. ])
  43831. : _vm._e()
  43832. ]),
  43833. _vm._v(" "),
  43834. _c("p", [
  43835. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  43836. _vm._v(" "),
  43837. _c(
  43838. "span",
  43839. {
  43840. staticClass: "dashed-underline",
  43841. attrs: {
  43842. "data-toggle": "tooltip",
  43843. "data-placement": "bottom",
  43844. title: this.getHRDate(this.data.dropdate)
  43845. }
  43846. },
  43847. [
  43848. _vm._v(
  43849. "\n " +
  43850. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  43851. " days ago\n "
  43852. )
  43853. ]
  43854. )
  43855. ]),
  43856. _vm._v(" "),
  43857. _c("p", [
  43858. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  43859. _vm._v(" "),
  43860. !this.isZero(this.data.pickupdate)
  43861. ? _c(
  43862. "span",
  43863. {
  43864. staticClass: "dashed-underline",
  43865. attrs: {
  43866. "data-toggle": "tooltip",
  43867. "data-placement": "bottom",
  43868. title: this.getHRDate(this.data.pickupdate)
  43869. }
  43870. },
  43871. [
  43872. _vm._v(
  43873. "\n " +
  43874. _vm._s(
  43875. Math.floor(this.daysSinceToday(this.data.pickupdate))
  43876. ) +
  43877. " days ago\n "
  43878. )
  43879. ]
  43880. )
  43881. : _vm._e()
  43882. ]),
  43883. _vm._v(" "),
  43884. _c(
  43885. "button",
  43886. {
  43887. staticClass: "btn btn-primary",
  43888. attrs: {
  43889. type: "button",
  43890. "data-toggle": "modal",
  43891. "data-target": "#workordereditModal"
  43892. }
  43893. },
  43894. [_vm._v("Edit")]
  43895. )
  43896. ],
  43897. 1
  43898. )
  43899. }
  43900. var staticRenderFns = []
  43901. render._withStripped = true
  43902. /***/ }),
  43903. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  43904. /*!********************************************************************!*\
  43905. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  43906. \********************************************************************/
  43907. /*! exports provided: default */
  43908. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43909. "use strict";
  43910. __webpack_require__.r(__webpack_exports__);
  43911. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  43912. /* globals __VUE_SSR_CONTEXT__ */
  43913. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  43914. // This module is a runtime utility for cleaner component module output and will
  43915. // be included in the final webpack user bundle.
  43916. function normalizeComponent (
  43917. scriptExports,
  43918. render,
  43919. staticRenderFns,
  43920. functionalTemplate,
  43921. injectStyles,
  43922. scopeId,
  43923. moduleIdentifier, /* server only */
  43924. shadowMode /* vue-cli only */
  43925. ) {
  43926. // Vue.extend constructor export interop
  43927. var options = typeof scriptExports === 'function'
  43928. ? scriptExports.options
  43929. : scriptExports
  43930. // render functions
  43931. if (render) {
  43932. options.render = render
  43933. options.staticRenderFns = staticRenderFns
  43934. options._compiled = true
  43935. }
  43936. // functional template
  43937. if (functionalTemplate) {
  43938. options.functional = true
  43939. }
  43940. // scopedId
  43941. if (scopeId) {
  43942. options._scopeId = 'data-v-' + scopeId
  43943. }
  43944. var hook
  43945. if (moduleIdentifier) { // server build
  43946. hook = function (context) {
  43947. // 2.3 injection
  43948. context =
  43949. context || // cached call
  43950. (this.$vnode && this.$vnode.ssrContext) || // stateful
  43951. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  43952. // 2.2 with runInNewContext: true
  43953. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  43954. context = __VUE_SSR_CONTEXT__
  43955. }
  43956. // inject component styles
  43957. if (injectStyles) {
  43958. injectStyles.call(this, context)
  43959. }
  43960. // register component module identifier for async chunk inferrence
  43961. if (context && context._registeredComponents) {
  43962. context._registeredComponents.add(moduleIdentifier)
  43963. }
  43964. }
  43965. // used by ssr in case component is cached and beforeCreate
  43966. // never gets called
  43967. options._ssrRegister = hook
  43968. } else if (injectStyles) {
  43969. hook = shadowMode
  43970. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  43971. : injectStyles
  43972. }
  43973. if (hook) {
  43974. if (options.functional) {
  43975. // for template-only hot-reload because in that case the render fn doesn't
  43976. // go through the normalizer
  43977. options._injectStyles = hook
  43978. // register for functioal component in vue file
  43979. var originalRender = options.render
  43980. options.render = function renderWithStyleInjection (h, context) {
  43981. hook.call(context)
  43982. return originalRender(h, context)
  43983. }
  43984. } else {
  43985. // inject component registration as beforeCreate hook
  43986. var existing = options.beforeCreate
  43987. options.beforeCreate = existing
  43988. ? [].concat(existing, hook)
  43989. : [hook]
  43990. }
  43991. }
  43992. return {
  43993. exports: scriptExports,
  43994. options: options
  43995. }
  43996. }
  43997. /***/ }),
  43998. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  43999. /*!*************************************************!*\
  44000. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44001. \*************************************************/
  44002. /*! no static exports found */
  44003. /***/ (function(module, exports, __webpack_require__) {
  44004. "use strict";
  44005. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44006. * Vue.js v2.6.11
  44007. * (c) 2014-2019 Evan You
  44008. * Released under the MIT License.
  44009. */
  44010. /* */
  44011. var emptyObject = Object.freeze({});
  44012. // These helpers produce better VM code in JS engines due to their
  44013. // explicitness and function inlining.
  44014. function isUndef (v) {
  44015. return v === undefined || v === null
  44016. }
  44017. function isDef (v) {
  44018. return v !== undefined && v !== null
  44019. }
  44020. function isTrue (v) {
  44021. return v === true
  44022. }
  44023. function isFalse (v) {
  44024. return v === false
  44025. }
  44026. /**
  44027. * Check if value is primitive.
  44028. */
  44029. function isPrimitive (value) {
  44030. return (
  44031. typeof value === 'string' ||
  44032. typeof value === 'number' ||
  44033. // $flow-disable-line
  44034. typeof value === 'symbol' ||
  44035. typeof value === 'boolean'
  44036. )
  44037. }
  44038. /**
  44039. * Quick object check - this is primarily used to tell
  44040. * Objects from primitive values when we know the value
  44041. * is a JSON-compliant type.
  44042. */
  44043. function isObject (obj) {
  44044. return obj !== null && typeof obj === 'object'
  44045. }
  44046. /**
  44047. * Get the raw type string of a value, e.g., [object Object].
  44048. */
  44049. var _toString = Object.prototype.toString;
  44050. function toRawType (value) {
  44051. return _toString.call(value).slice(8, -1)
  44052. }
  44053. /**
  44054. * Strict object type check. Only returns true
  44055. * for plain JavaScript objects.
  44056. */
  44057. function isPlainObject (obj) {
  44058. return _toString.call(obj) === '[object Object]'
  44059. }
  44060. function isRegExp (v) {
  44061. return _toString.call(v) === '[object RegExp]'
  44062. }
  44063. /**
  44064. * Check if val is a valid array index.
  44065. */
  44066. function isValidArrayIndex (val) {
  44067. var n = parseFloat(String(val));
  44068. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44069. }
  44070. function isPromise (val) {
  44071. return (
  44072. isDef(val) &&
  44073. typeof val.then === 'function' &&
  44074. typeof val.catch === 'function'
  44075. )
  44076. }
  44077. /**
  44078. * Convert a value to a string that is actually rendered.
  44079. */
  44080. function toString (val) {
  44081. return val == null
  44082. ? ''
  44083. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44084. ? JSON.stringify(val, null, 2)
  44085. : String(val)
  44086. }
  44087. /**
  44088. * Convert an input value to a number for persistence.
  44089. * If the conversion fails, return original string.
  44090. */
  44091. function toNumber (val) {
  44092. var n = parseFloat(val);
  44093. return isNaN(n) ? val : n
  44094. }
  44095. /**
  44096. * Make a map and return a function for checking if a key
  44097. * is in that map.
  44098. */
  44099. function makeMap (
  44100. str,
  44101. expectsLowerCase
  44102. ) {
  44103. var map = Object.create(null);
  44104. var list = str.split(',');
  44105. for (var i = 0; i < list.length; i++) {
  44106. map[list[i]] = true;
  44107. }
  44108. return expectsLowerCase
  44109. ? function (val) { return map[val.toLowerCase()]; }
  44110. : function (val) { return map[val]; }
  44111. }
  44112. /**
  44113. * Check if a tag is a built-in tag.
  44114. */
  44115. var isBuiltInTag = makeMap('slot,component', true);
  44116. /**
  44117. * Check if an attribute is a reserved attribute.
  44118. */
  44119. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44120. /**
  44121. * Remove an item from an array.
  44122. */
  44123. function remove (arr, item) {
  44124. if (arr.length) {
  44125. var index = arr.indexOf(item);
  44126. if (index > -1) {
  44127. return arr.splice(index, 1)
  44128. }
  44129. }
  44130. }
  44131. /**
  44132. * Check whether an object has the property.
  44133. */
  44134. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44135. function hasOwn (obj, key) {
  44136. return hasOwnProperty.call(obj, key)
  44137. }
  44138. /**
  44139. * Create a cached version of a pure function.
  44140. */
  44141. function cached (fn) {
  44142. var cache = Object.create(null);
  44143. return (function cachedFn (str) {
  44144. var hit = cache[str];
  44145. return hit || (cache[str] = fn(str))
  44146. })
  44147. }
  44148. /**
  44149. * Camelize a hyphen-delimited string.
  44150. */
  44151. var camelizeRE = /-(\w)/g;
  44152. var camelize = cached(function (str) {
  44153. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44154. });
  44155. /**
  44156. * Capitalize a string.
  44157. */
  44158. var capitalize = cached(function (str) {
  44159. return str.charAt(0).toUpperCase() + str.slice(1)
  44160. });
  44161. /**
  44162. * Hyphenate a camelCase string.
  44163. */
  44164. var hyphenateRE = /\B([A-Z])/g;
  44165. var hyphenate = cached(function (str) {
  44166. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44167. });
  44168. /**
  44169. * Simple bind polyfill for environments that do not support it,
  44170. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44171. * since native bind is now performant enough in most browsers.
  44172. * But removing it would mean breaking code that was able to run in
  44173. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44174. */
  44175. /* istanbul ignore next */
  44176. function polyfillBind (fn, ctx) {
  44177. function boundFn (a) {
  44178. var l = arguments.length;
  44179. return l
  44180. ? l > 1
  44181. ? fn.apply(ctx, arguments)
  44182. : fn.call(ctx, a)
  44183. : fn.call(ctx)
  44184. }
  44185. boundFn._length = fn.length;
  44186. return boundFn
  44187. }
  44188. function nativeBind (fn, ctx) {
  44189. return fn.bind(ctx)
  44190. }
  44191. var bind = Function.prototype.bind
  44192. ? nativeBind
  44193. : polyfillBind;
  44194. /**
  44195. * Convert an Array-like object to a real Array.
  44196. */
  44197. function toArray (list, start) {
  44198. start = start || 0;
  44199. var i = list.length - start;
  44200. var ret = new Array(i);
  44201. while (i--) {
  44202. ret[i] = list[i + start];
  44203. }
  44204. return ret
  44205. }
  44206. /**
  44207. * Mix properties into target object.
  44208. */
  44209. function extend (to, _from) {
  44210. for (var key in _from) {
  44211. to[key] = _from[key];
  44212. }
  44213. return to
  44214. }
  44215. /**
  44216. * Merge an Array of Objects into a single Object.
  44217. */
  44218. function toObject (arr) {
  44219. var res = {};
  44220. for (var i = 0; i < arr.length; i++) {
  44221. if (arr[i]) {
  44222. extend(res, arr[i]);
  44223. }
  44224. }
  44225. return res
  44226. }
  44227. /* eslint-disable no-unused-vars */
  44228. /**
  44229. * Perform no operation.
  44230. * Stubbing args to make Flow happy without leaving useless transpiled code
  44231. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44232. */
  44233. function noop (a, b, c) {}
  44234. /**
  44235. * Always return false.
  44236. */
  44237. var no = function (a, b, c) { return false; };
  44238. /* eslint-enable no-unused-vars */
  44239. /**
  44240. * Return the same value.
  44241. */
  44242. var identity = function (_) { return _; };
  44243. /**
  44244. * Generate a string containing static keys from compiler modules.
  44245. */
  44246. function genStaticKeys (modules) {
  44247. return modules.reduce(function (keys, m) {
  44248. return keys.concat(m.staticKeys || [])
  44249. }, []).join(',')
  44250. }
  44251. /**
  44252. * Check if two values are loosely equal - that is,
  44253. * if they are plain objects, do they have the same shape?
  44254. */
  44255. function looseEqual (a, b) {
  44256. if (a === b) { return true }
  44257. var isObjectA = isObject(a);
  44258. var isObjectB = isObject(b);
  44259. if (isObjectA && isObjectB) {
  44260. try {
  44261. var isArrayA = Array.isArray(a);
  44262. var isArrayB = Array.isArray(b);
  44263. if (isArrayA && isArrayB) {
  44264. return a.length === b.length && a.every(function (e, i) {
  44265. return looseEqual(e, b[i])
  44266. })
  44267. } else if (a instanceof Date && b instanceof Date) {
  44268. return a.getTime() === b.getTime()
  44269. } else if (!isArrayA && !isArrayB) {
  44270. var keysA = Object.keys(a);
  44271. var keysB = Object.keys(b);
  44272. return keysA.length === keysB.length && keysA.every(function (key) {
  44273. return looseEqual(a[key], b[key])
  44274. })
  44275. } else {
  44276. /* istanbul ignore next */
  44277. return false
  44278. }
  44279. } catch (e) {
  44280. /* istanbul ignore next */
  44281. return false
  44282. }
  44283. } else if (!isObjectA && !isObjectB) {
  44284. return String(a) === String(b)
  44285. } else {
  44286. return false
  44287. }
  44288. }
  44289. /**
  44290. * Return the first index at which a loosely equal value can be
  44291. * found in the array (if value is a plain object, the array must
  44292. * contain an object of the same shape), or -1 if it is not present.
  44293. */
  44294. function looseIndexOf (arr, val) {
  44295. for (var i = 0; i < arr.length; i++) {
  44296. if (looseEqual(arr[i], val)) { return i }
  44297. }
  44298. return -1
  44299. }
  44300. /**
  44301. * Ensure a function is called only once.
  44302. */
  44303. function once (fn) {
  44304. var called = false;
  44305. return function () {
  44306. if (!called) {
  44307. called = true;
  44308. fn.apply(this, arguments);
  44309. }
  44310. }
  44311. }
  44312. var SSR_ATTR = 'data-server-rendered';
  44313. var ASSET_TYPES = [
  44314. 'component',
  44315. 'directive',
  44316. 'filter'
  44317. ];
  44318. var LIFECYCLE_HOOKS = [
  44319. 'beforeCreate',
  44320. 'created',
  44321. 'beforeMount',
  44322. 'mounted',
  44323. 'beforeUpdate',
  44324. 'updated',
  44325. 'beforeDestroy',
  44326. 'destroyed',
  44327. 'activated',
  44328. 'deactivated',
  44329. 'errorCaptured',
  44330. 'serverPrefetch'
  44331. ];
  44332. /* */
  44333. var config = ({
  44334. /**
  44335. * Option merge strategies (used in core/util/options)
  44336. */
  44337. // $flow-disable-line
  44338. optionMergeStrategies: Object.create(null),
  44339. /**
  44340. * Whether to suppress warnings.
  44341. */
  44342. silent: false,
  44343. /**
  44344. * Show production mode tip message on boot?
  44345. */
  44346. productionTip: "development" !== 'production',
  44347. /**
  44348. * Whether to enable devtools
  44349. */
  44350. devtools: "development" !== 'production',
  44351. /**
  44352. * Whether to record perf
  44353. */
  44354. performance: false,
  44355. /**
  44356. * Error handler for watcher errors
  44357. */
  44358. errorHandler: null,
  44359. /**
  44360. * Warn handler for watcher warns
  44361. */
  44362. warnHandler: null,
  44363. /**
  44364. * Ignore certain custom elements
  44365. */
  44366. ignoredElements: [],
  44367. /**
  44368. * Custom user key aliases for v-on
  44369. */
  44370. // $flow-disable-line
  44371. keyCodes: Object.create(null),
  44372. /**
  44373. * Check if a tag is reserved so that it cannot be registered as a
  44374. * component. This is platform-dependent and may be overwritten.
  44375. */
  44376. isReservedTag: no,
  44377. /**
  44378. * Check if an attribute is reserved so that it cannot be used as a component
  44379. * prop. This is platform-dependent and may be overwritten.
  44380. */
  44381. isReservedAttr: no,
  44382. /**
  44383. * Check if a tag is an unknown element.
  44384. * Platform-dependent.
  44385. */
  44386. isUnknownElement: no,
  44387. /**
  44388. * Get the namespace of an element
  44389. */
  44390. getTagNamespace: noop,
  44391. /**
  44392. * Parse the real tag name for the specific platform.
  44393. */
  44394. parsePlatformTagName: identity,
  44395. /**
  44396. * Check if an attribute must be bound using property, e.g. value
  44397. * Platform-dependent.
  44398. */
  44399. mustUseProp: no,
  44400. /**
  44401. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44402. * This will significantly reduce performance if set to false.
  44403. */
  44404. async: true,
  44405. /**
  44406. * Exposed for legacy reasons
  44407. */
  44408. _lifecycleHooks: LIFECYCLE_HOOKS
  44409. });
  44410. /* */
  44411. /**
  44412. * unicode letters used for parsing html tags, component names and property paths.
  44413. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44414. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44415. */
  44416. 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/;
  44417. /**
  44418. * Check if a string starts with $ or _
  44419. */
  44420. function isReserved (str) {
  44421. var c = (str + '').charCodeAt(0);
  44422. return c === 0x24 || c === 0x5F
  44423. }
  44424. /**
  44425. * Define a property.
  44426. */
  44427. function def (obj, key, val, enumerable) {
  44428. Object.defineProperty(obj, key, {
  44429. value: val,
  44430. enumerable: !!enumerable,
  44431. writable: true,
  44432. configurable: true
  44433. });
  44434. }
  44435. /**
  44436. * Parse simple path.
  44437. */
  44438. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44439. function parsePath (path) {
  44440. if (bailRE.test(path)) {
  44441. return
  44442. }
  44443. var segments = path.split('.');
  44444. return function (obj) {
  44445. for (var i = 0; i < segments.length; i++) {
  44446. if (!obj) { return }
  44447. obj = obj[segments[i]];
  44448. }
  44449. return obj
  44450. }
  44451. }
  44452. /* */
  44453. // can we use __proto__?
  44454. var hasProto = '__proto__' in {};
  44455. // Browser environment sniffing
  44456. var inBrowser = typeof window !== 'undefined';
  44457. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44458. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44459. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44460. var isIE = UA && /msie|trident/.test(UA);
  44461. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44462. var isEdge = UA && UA.indexOf('edge/') > 0;
  44463. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44464. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  44465. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  44466. var isPhantomJS = UA && /phantomjs/.test(UA);
  44467. var isFF = UA && UA.match(/firefox\/(\d+)/);
  44468. // Firefox has a "watch" function on Object.prototype...
  44469. var nativeWatch = ({}).watch;
  44470. var supportsPassive = false;
  44471. if (inBrowser) {
  44472. try {
  44473. var opts = {};
  44474. Object.defineProperty(opts, 'passive', ({
  44475. get: function get () {
  44476. /* istanbul ignore next */
  44477. supportsPassive = true;
  44478. }
  44479. })); // https://github.com/facebook/flow/issues/285
  44480. window.addEventListener('test-passive', null, opts);
  44481. } catch (e) {}
  44482. }
  44483. // this needs to be lazy-evaled because vue may be required before
  44484. // vue-server-renderer can set VUE_ENV
  44485. var _isServer;
  44486. var isServerRendering = function () {
  44487. if (_isServer === undefined) {
  44488. /* istanbul ignore if */
  44489. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  44490. // detect presence of vue-server-renderer and avoid
  44491. // Webpack shimming the process
  44492. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  44493. } else {
  44494. _isServer = false;
  44495. }
  44496. }
  44497. return _isServer
  44498. };
  44499. // detect devtools
  44500. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  44501. /* istanbul ignore next */
  44502. function isNative (Ctor) {
  44503. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  44504. }
  44505. var hasSymbol =
  44506. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  44507. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  44508. var _Set;
  44509. /* istanbul ignore if */ // $flow-disable-line
  44510. if (typeof Set !== 'undefined' && isNative(Set)) {
  44511. // use native Set when available.
  44512. _Set = Set;
  44513. } else {
  44514. // a non-standard Set polyfill that only works with primitive keys.
  44515. _Set = /*@__PURE__*/(function () {
  44516. function Set () {
  44517. this.set = Object.create(null);
  44518. }
  44519. Set.prototype.has = function has (key) {
  44520. return this.set[key] === true
  44521. };
  44522. Set.prototype.add = function add (key) {
  44523. this.set[key] = true;
  44524. };
  44525. Set.prototype.clear = function clear () {
  44526. this.set = Object.create(null);
  44527. };
  44528. return Set;
  44529. }());
  44530. }
  44531. /* */
  44532. var warn = noop;
  44533. var tip = noop;
  44534. var generateComponentTrace = (noop); // work around flow check
  44535. var formatComponentName = (noop);
  44536. {
  44537. var hasConsole = typeof console !== 'undefined';
  44538. var classifyRE = /(?:^|[-_])(\w)/g;
  44539. var classify = function (str) { return str
  44540. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  44541. .replace(/[-_]/g, ''); };
  44542. warn = function (msg, vm) {
  44543. var trace = vm ? generateComponentTrace(vm) : '';
  44544. if (config.warnHandler) {
  44545. config.warnHandler.call(null, msg, vm, trace);
  44546. } else if (hasConsole && (!config.silent)) {
  44547. console.error(("[Vue warn]: " + msg + trace));
  44548. }
  44549. };
  44550. tip = function (msg, vm) {
  44551. if (hasConsole && (!config.silent)) {
  44552. console.warn("[Vue tip]: " + msg + (
  44553. vm ? generateComponentTrace(vm) : ''
  44554. ));
  44555. }
  44556. };
  44557. formatComponentName = function (vm, includeFile) {
  44558. if (vm.$root === vm) {
  44559. return '<Root>'
  44560. }
  44561. var options = typeof vm === 'function' && vm.cid != null
  44562. ? vm.options
  44563. : vm._isVue
  44564. ? vm.$options || vm.constructor.options
  44565. : vm;
  44566. var name = options.name || options._componentTag;
  44567. var file = options.__file;
  44568. if (!name && file) {
  44569. var match = file.match(/([^/\\]+)\.vue$/);
  44570. name = match && match[1];
  44571. }
  44572. return (
  44573. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  44574. (file && includeFile !== false ? (" at " + file) : '')
  44575. )
  44576. };
  44577. var repeat = function (str, n) {
  44578. var res = '';
  44579. while (n) {
  44580. if (n % 2 === 1) { res += str; }
  44581. if (n > 1) { str += str; }
  44582. n >>= 1;
  44583. }
  44584. return res
  44585. };
  44586. generateComponentTrace = function (vm) {
  44587. if (vm._isVue && vm.$parent) {
  44588. var tree = [];
  44589. var currentRecursiveSequence = 0;
  44590. while (vm) {
  44591. if (tree.length > 0) {
  44592. var last = tree[tree.length - 1];
  44593. if (last.constructor === vm.constructor) {
  44594. currentRecursiveSequence++;
  44595. vm = vm.$parent;
  44596. continue
  44597. } else if (currentRecursiveSequence > 0) {
  44598. tree[tree.length - 1] = [last, currentRecursiveSequence];
  44599. currentRecursiveSequence = 0;
  44600. }
  44601. }
  44602. tree.push(vm);
  44603. vm = vm.$parent;
  44604. }
  44605. return '\n\nfound in\n\n' + tree
  44606. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  44607. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  44608. : formatComponentName(vm))); })
  44609. .join('\n')
  44610. } else {
  44611. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  44612. }
  44613. };
  44614. }
  44615. /* */
  44616. var uid = 0;
  44617. /**
  44618. * A dep is an observable that can have multiple
  44619. * directives subscribing to it.
  44620. */
  44621. var Dep = function Dep () {
  44622. this.id = uid++;
  44623. this.subs = [];
  44624. };
  44625. Dep.prototype.addSub = function addSub (sub) {
  44626. this.subs.push(sub);
  44627. };
  44628. Dep.prototype.removeSub = function removeSub (sub) {
  44629. remove(this.subs, sub);
  44630. };
  44631. Dep.prototype.depend = function depend () {
  44632. if (Dep.target) {
  44633. Dep.target.addDep(this);
  44634. }
  44635. };
  44636. Dep.prototype.notify = function notify () {
  44637. // stabilize the subscriber list first
  44638. var subs = this.subs.slice();
  44639. if (!config.async) {
  44640. // subs aren't sorted in scheduler if not running async
  44641. // we need to sort them now to make sure they fire in correct
  44642. // order
  44643. subs.sort(function (a, b) { return a.id - b.id; });
  44644. }
  44645. for (var i = 0, l = subs.length; i < l; i++) {
  44646. subs[i].update();
  44647. }
  44648. };
  44649. // The current target watcher being evaluated.
  44650. // This is globally unique because only one watcher
  44651. // can be evaluated at a time.
  44652. Dep.target = null;
  44653. var targetStack = [];
  44654. function pushTarget (target) {
  44655. targetStack.push(target);
  44656. Dep.target = target;
  44657. }
  44658. function popTarget () {
  44659. targetStack.pop();
  44660. Dep.target = targetStack[targetStack.length - 1];
  44661. }
  44662. /* */
  44663. var VNode = function VNode (
  44664. tag,
  44665. data,
  44666. children,
  44667. text,
  44668. elm,
  44669. context,
  44670. componentOptions,
  44671. asyncFactory
  44672. ) {
  44673. this.tag = tag;
  44674. this.data = data;
  44675. this.children = children;
  44676. this.text = text;
  44677. this.elm = elm;
  44678. this.ns = undefined;
  44679. this.context = context;
  44680. this.fnContext = undefined;
  44681. this.fnOptions = undefined;
  44682. this.fnScopeId = undefined;
  44683. this.key = data && data.key;
  44684. this.componentOptions = componentOptions;
  44685. this.componentInstance = undefined;
  44686. this.parent = undefined;
  44687. this.raw = false;
  44688. this.isStatic = false;
  44689. this.isRootInsert = true;
  44690. this.isComment = false;
  44691. this.isCloned = false;
  44692. this.isOnce = false;
  44693. this.asyncFactory = asyncFactory;
  44694. this.asyncMeta = undefined;
  44695. this.isAsyncPlaceholder = false;
  44696. };
  44697. var prototypeAccessors = { child: { configurable: true } };
  44698. // DEPRECATED: alias for componentInstance for backwards compat.
  44699. /* istanbul ignore next */
  44700. prototypeAccessors.child.get = function () {
  44701. return this.componentInstance
  44702. };
  44703. Object.defineProperties( VNode.prototype, prototypeAccessors );
  44704. var createEmptyVNode = function (text) {
  44705. if ( text === void 0 ) text = '';
  44706. var node = new VNode();
  44707. node.text = text;
  44708. node.isComment = true;
  44709. return node
  44710. };
  44711. function createTextVNode (val) {
  44712. return new VNode(undefined, undefined, undefined, String(val))
  44713. }
  44714. // optimized shallow clone
  44715. // used for static nodes and slot nodes because they may be reused across
  44716. // multiple renders, cloning them avoids errors when DOM manipulations rely
  44717. // on their elm reference.
  44718. function cloneVNode (vnode) {
  44719. var cloned = new VNode(
  44720. vnode.tag,
  44721. vnode.data,
  44722. // #7975
  44723. // clone children array to avoid mutating original in case of cloning
  44724. // a child.
  44725. vnode.children && vnode.children.slice(),
  44726. vnode.text,
  44727. vnode.elm,
  44728. vnode.context,
  44729. vnode.componentOptions,
  44730. vnode.asyncFactory
  44731. );
  44732. cloned.ns = vnode.ns;
  44733. cloned.isStatic = vnode.isStatic;
  44734. cloned.key = vnode.key;
  44735. cloned.isComment = vnode.isComment;
  44736. cloned.fnContext = vnode.fnContext;
  44737. cloned.fnOptions = vnode.fnOptions;
  44738. cloned.fnScopeId = vnode.fnScopeId;
  44739. cloned.asyncMeta = vnode.asyncMeta;
  44740. cloned.isCloned = true;
  44741. return cloned
  44742. }
  44743. /*
  44744. * not type checking this file because flow doesn't play well with
  44745. * dynamically accessing methods on Array prototype
  44746. */
  44747. var arrayProto = Array.prototype;
  44748. var arrayMethods = Object.create(arrayProto);
  44749. var methodsToPatch = [
  44750. 'push',
  44751. 'pop',
  44752. 'shift',
  44753. 'unshift',
  44754. 'splice',
  44755. 'sort',
  44756. 'reverse'
  44757. ];
  44758. /**
  44759. * Intercept mutating methods and emit events
  44760. */
  44761. methodsToPatch.forEach(function (method) {
  44762. // cache original method
  44763. var original = arrayProto[method];
  44764. def(arrayMethods, method, function mutator () {
  44765. var args = [], len = arguments.length;
  44766. while ( len-- ) args[ len ] = arguments[ len ];
  44767. var result = original.apply(this, args);
  44768. var ob = this.__ob__;
  44769. var inserted;
  44770. switch (method) {
  44771. case 'push':
  44772. case 'unshift':
  44773. inserted = args;
  44774. break
  44775. case 'splice':
  44776. inserted = args.slice(2);
  44777. break
  44778. }
  44779. if (inserted) { ob.observeArray(inserted); }
  44780. // notify change
  44781. ob.dep.notify();
  44782. return result
  44783. });
  44784. });
  44785. /* */
  44786. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  44787. /**
  44788. * In some cases we may want to disable observation inside a component's
  44789. * update computation.
  44790. */
  44791. var shouldObserve = true;
  44792. function toggleObserving (value) {
  44793. shouldObserve = value;
  44794. }
  44795. /**
  44796. * Observer class that is attached to each observed
  44797. * object. Once attached, the observer converts the target
  44798. * object's property keys into getter/setters that
  44799. * collect dependencies and dispatch updates.
  44800. */
  44801. var Observer = function Observer (value) {
  44802. this.value = value;
  44803. this.dep = new Dep();
  44804. this.vmCount = 0;
  44805. def(value, '__ob__', this);
  44806. if (Array.isArray(value)) {
  44807. if (hasProto) {
  44808. protoAugment(value, arrayMethods);
  44809. } else {
  44810. copyAugment(value, arrayMethods, arrayKeys);
  44811. }
  44812. this.observeArray(value);
  44813. } else {
  44814. this.walk(value);
  44815. }
  44816. };
  44817. /**
  44818. * Walk through all properties and convert them into
  44819. * getter/setters. This method should only be called when
  44820. * value type is Object.
  44821. */
  44822. Observer.prototype.walk = function walk (obj) {
  44823. var keys = Object.keys(obj);
  44824. for (var i = 0; i < keys.length; i++) {
  44825. defineReactive$$1(obj, keys[i]);
  44826. }
  44827. };
  44828. /**
  44829. * Observe a list of Array items.
  44830. */
  44831. Observer.prototype.observeArray = function observeArray (items) {
  44832. for (var i = 0, l = items.length; i < l; i++) {
  44833. observe(items[i]);
  44834. }
  44835. };
  44836. // helpers
  44837. /**
  44838. * Augment a target Object or Array by intercepting
  44839. * the prototype chain using __proto__
  44840. */
  44841. function protoAugment (target, src) {
  44842. /* eslint-disable no-proto */
  44843. target.__proto__ = src;
  44844. /* eslint-enable no-proto */
  44845. }
  44846. /**
  44847. * Augment a target Object or Array by defining
  44848. * hidden properties.
  44849. */
  44850. /* istanbul ignore next */
  44851. function copyAugment (target, src, keys) {
  44852. for (var i = 0, l = keys.length; i < l; i++) {
  44853. var key = keys[i];
  44854. def(target, key, src[key]);
  44855. }
  44856. }
  44857. /**
  44858. * Attempt to create an observer instance for a value,
  44859. * returns the new observer if successfully observed,
  44860. * or the existing observer if the value already has one.
  44861. */
  44862. function observe (value, asRootData) {
  44863. if (!isObject(value) || value instanceof VNode) {
  44864. return
  44865. }
  44866. var ob;
  44867. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  44868. ob = value.__ob__;
  44869. } else if (
  44870. shouldObserve &&
  44871. !isServerRendering() &&
  44872. (Array.isArray(value) || isPlainObject(value)) &&
  44873. Object.isExtensible(value) &&
  44874. !value._isVue
  44875. ) {
  44876. ob = new Observer(value);
  44877. }
  44878. if (asRootData && ob) {
  44879. ob.vmCount++;
  44880. }
  44881. return ob
  44882. }
  44883. /**
  44884. * Define a reactive property on an Object.
  44885. */
  44886. function defineReactive$$1 (
  44887. obj,
  44888. key,
  44889. val,
  44890. customSetter,
  44891. shallow
  44892. ) {
  44893. var dep = new Dep();
  44894. var property = Object.getOwnPropertyDescriptor(obj, key);
  44895. if (property && property.configurable === false) {
  44896. return
  44897. }
  44898. // cater for pre-defined getter/setters
  44899. var getter = property && property.get;
  44900. var setter = property && property.set;
  44901. if ((!getter || setter) && arguments.length === 2) {
  44902. val = obj[key];
  44903. }
  44904. var childOb = !shallow && observe(val);
  44905. Object.defineProperty(obj, key, {
  44906. enumerable: true,
  44907. configurable: true,
  44908. get: function reactiveGetter () {
  44909. var value = getter ? getter.call(obj) : val;
  44910. if (Dep.target) {
  44911. dep.depend();
  44912. if (childOb) {
  44913. childOb.dep.depend();
  44914. if (Array.isArray(value)) {
  44915. dependArray(value);
  44916. }
  44917. }
  44918. }
  44919. return value
  44920. },
  44921. set: function reactiveSetter (newVal) {
  44922. var value = getter ? getter.call(obj) : val;
  44923. /* eslint-disable no-self-compare */
  44924. if (newVal === value || (newVal !== newVal && value !== value)) {
  44925. return
  44926. }
  44927. /* eslint-enable no-self-compare */
  44928. if (customSetter) {
  44929. customSetter();
  44930. }
  44931. // #7981: for accessor properties without setter
  44932. if (getter && !setter) { return }
  44933. if (setter) {
  44934. setter.call(obj, newVal);
  44935. } else {
  44936. val = newVal;
  44937. }
  44938. childOb = !shallow && observe(newVal);
  44939. dep.notify();
  44940. }
  44941. });
  44942. }
  44943. /**
  44944. * Set a property on an object. Adds the new property and
  44945. * triggers change notification if the property doesn't
  44946. * already exist.
  44947. */
  44948. function set (target, key, val) {
  44949. if (isUndef(target) || isPrimitive(target)
  44950. ) {
  44951. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  44952. }
  44953. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44954. target.length = Math.max(target.length, key);
  44955. target.splice(key, 1, val);
  44956. return val
  44957. }
  44958. if (key in target && !(key in Object.prototype)) {
  44959. target[key] = val;
  44960. return val
  44961. }
  44962. var ob = (target).__ob__;
  44963. if (target._isVue || (ob && ob.vmCount)) {
  44964. warn(
  44965. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  44966. 'at runtime - declare it upfront in the data option.'
  44967. );
  44968. return val
  44969. }
  44970. if (!ob) {
  44971. target[key] = val;
  44972. return val
  44973. }
  44974. defineReactive$$1(ob.value, key, val);
  44975. ob.dep.notify();
  44976. return val
  44977. }
  44978. /**
  44979. * Delete a property and trigger change if necessary.
  44980. */
  44981. function del (target, key) {
  44982. if (isUndef(target) || isPrimitive(target)
  44983. ) {
  44984. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  44985. }
  44986. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44987. target.splice(key, 1);
  44988. return
  44989. }
  44990. var ob = (target).__ob__;
  44991. if (target._isVue || (ob && ob.vmCount)) {
  44992. warn(
  44993. 'Avoid deleting properties on a Vue instance or its root $data ' +
  44994. '- just set it to null.'
  44995. );
  44996. return
  44997. }
  44998. if (!hasOwn(target, key)) {
  44999. return
  45000. }
  45001. delete target[key];
  45002. if (!ob) {
  45003. return
  45004. }
  45005. ob.dep.notify();
  45006. }
  45007. /**
  45008. * Collect dependencies on array elements when the array is touched, since
  45009. * we cannot intercept array element access like property getters.
  45010. */
  45011. function dependArray (value) {
  45012. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45013. e = value[i];
  45014. e && e.__ob__ && e.__ob__.dep.depend();
  45015. if (Array.isArray(e)) {
  45016. dependArray(e);
  45017. }
  45018. }
  45019. }
  45020. /* */
  45021. /**
  45022. * Option overwriting strategies are functions that handle
  45023. * how to merge a parent option value and a child option
  45024. * value into the final value.
  45025. */
  45026. var strats = config.optionMergeStrategies;
  45027. /**
  45028. * Options with restrictions
  45029. */
  45030. {
  45031. strats.el = strats.propsData = function (parent, child, vm, key) {
  45032. if (!vm) {
  45033. warn(
  45034. "option \"" + key + "\" can only be used during instance " +
  45035. 'creation with the `new` keyword.'
  45036. );
  45037. }
  45038. return defaultStrat(parent, child)
  45039. };
  45040. }
  45041. /**
  45042. * Helper that recursively merges two data objects together.
  45043. */
  45044. function mergeData (to, from) {
  45045. if (!from) { return to }
  45046. var key, toVal, fromVal;
  45047. var keys = hasSymbol
  45048. ? Reflect.ownKeys(from)
  45049. : Object.keys(from);
  45050. for (var i = 0; i < keys.length; i++) {
  45051. key = keys[i];
  45052. // in case the object is already observed...
  45053. if (key === '__ob__') { continue }
  45054. toVal = to[key];
  45055. fromVal = from[key];
  45056. if (!hasOwn(to, key)) {
  45057. set(to, key, fromVal);
  45058. } else if (
  45059. toVal !== fromVal &&
  45060. isPlainObject(toVal) &&
  45061. isPlainObject(fromVal)
  45062. ) {
  45063. mergeData(toVal, fromVal);
  45064. }
  45065. }
  45066. return to
  45067. }
  45068. /**
  45069. * Data
  45070. */
  45071. function mergeDataOrFn (
  45072. parentVal,
  45073. childVal,
  45074. vm
  45075. ) {
  45076. if (!vm) {
  45077. // in a Vue.extend merge, both should be functions
  45078. if (!childVal) {
  45079. return parentVal
  45080. }
  45081. if (!parentVal) {
  45082. return childVal
  45083. }
  45084. // when parentVal & childVal are both present,
  45085. // we need to return a function that returns the
  45086. // merged result of both functions... no need to
  45087. // check if parentVal is a function here because
  45088. // it has to be a function to pass previous merges.
  45089. return function mergedDataFn () {
  45090. return mergeData(
  45091. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45092. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45093. )
  45094. }
  45095. } else {
  45096. return function mergedInstanceDataFn () {
  45097. // instance merge
  45098. var instanceData = typeof childVal === 'function'
  45099. ? childVal.call(vm, vm)
  45100. : childVal;
  45101. var defaultData = typeof parentVal === 'function'
  45102. ? parentVal.call(vm, vm)
  45103. : parentVal;
  45104. if (instanceData) {
  45105. return mergeData(instanceData, defaultData)
  45106. } else {
  45107. return defaultData
  45108. }
  45109. }
  45110. }
  45111. }
  45112. strats.data = function (
  45113. parentVal,
  45114. childVal,
  45115. vm
  45116. ) {
  45117. if (!vm) {
  45118. if (childVal && typeof childVal !== 'function') {
  45119. warn(
  45120. 'The "data" option should be a function ' +
  45121. 'that returns a per-instance value in component ' +
  45122. 'definitions.',
  45123. vm
  45124. );
  45125. return parentVal
  45126. }
  45127. return mergeDataOrFn(parentVal, childVal)
  45128. }
  45129. return mergeDataOrFn(parentVal, childVal, vm)
  45130. };
  45131. /**
  45132. * Hooks and props are merged as arrays.
  45133. */
  45134. function mergeHook (
  45135. parentVal,
  45136. childVal
  45137. ) {
  45138. var res = childVal
  45139. ? parentVal
  45140. ? parentVal.concat(childVal)
  45141. : Array.isArray(childVal)
  45142. ? childVal
  45143. : [childVal]
  45144. : parentVal;
  45145. return res
  45146. ? dedupeHooks(res)
  45147. : res
  45148. }
  45149. function dedupeHooks (hooks) {
  45150. var res = [];
  45151. for (var i = 0; i < hooks.length; i++) {
  45152. if (res.indexOf(hooks[i]) === -1) {
  45153. res.push(hooks[i]);
  45154. }
  45155. }
  45156. return res
  45157. }
  45158. LIFECYCLE_HOOKS.forEach(function (hook) {
  45159. strats[hook] = mergeHook;
  45160. });
  45161. /**
  45162. * Assets
  45163. *
  45164. * When a vm is present (instance creation), we need to do
  45165. * a three-way merge between constructor options, instance
  45166. * options and parent options.
  45167. */
  45168. function mergeAssets (
  45169. parentVal,
  45170. childVal,
  45171. vm,
  45172. key
  45173. ) {
  45174. var res = Object.create(parentVal || null);
  45175. if (childVal) {
  45176. assertObjectType(key, childVal, vm);
  45177. return extend(res, childVal)
  45178. } else {
  45179. return res
  45180. }
  45181. }
  45182. ASSET_TYPES.forEach(function (type) {
  45183. strats[type + 's'] = mergeAssets;
  45184. });
  45185. /**
  45186. * Watchers.
  45187. *
  45188. * Watchers hashes should not overwrite one
  45189. * another, so we merge them as arrays.
  45190. */
  45191. strats.watch = function (
  45192. parentVal,
  45193. childVal,
  45194. vm,
  45195. key
  45196. ) {
  45197. // work around Firefox's Object.prototype.watch...
  45198. if (parentVal === nativeWatch) { parentVal = undefined; }
  45199. if (childVal === nativeWatch) { childVal = undefined; }
  45200. /* istanbul ignore if */
  45201. if (!childVal) { return Object.create(parentVal || null) }
  45202. {
  45203. assertObjectType(key, childVal, vm);
  45204. }
  45205. if (!parentVal) { return childVal }
  45206. var ret = {};
  45207. extend(ret, parentVal);
  45208. for (var key$1 in childVal) {
  45209. var parent = ret[key$1];
  45210. var child = childVal[key$1];
  45211. if (parent && !Array.isArray(parent)) {
  45212. parent = [parent];
  45213. }
  45214. ret[key$1] = parent
  45215. ? parent.concat(child)
  45216. : Array.isArray(child) ? child : [child];
  45217. }
  45218. return ret
  45219. };
  45220. /**
  45221. * Other object hashes.
  45222. */
  45223. strats.props =
  45224. strats.methods =
  45225. strats.inject =
  45226. strats.computed = function (
  45227. parentVal,
  45228. childVal,
  45229. vm,
  45230. key
  45231. ) {
  45232. if (childVal && "development" !== 'production') {
  45233. assertObjectType(key, childVal, vm);
  45234. }
  45235. if (!parentVal) { return childVal }
  45236. var ret = Object.create(null);
  45237. extend(ret, parentVal);
  45238. if (childVal) { extend(ret, childVal); }
  45239. return ret
  45240. };
  45241. strats.provide = mergeDataOrFn;
  45242. /**
  45243. * Default strategy.
  45244. */
  45245. var defaultStrat = function (parentVal, childVal) {
  45246. return childVal === undefined
  45247. ? parentVal
  45248. : childVal
  45249. };
  45250. /**
  45251. * Validate component names
  45252. */
  45253. function checkComponents (options) {
  45254. for (var key in options.components) {
  45255. validateComponentName(key);
  45256. }
  45257. }
  45258. function validateComponentName (name) {
  45259. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45260. warn(
  45261. 'Invalid component name: "' + name + '". Component names ' +
  45262. 'should conform to valid custom element name in html5 specification.'
  45263. );
  45264. }
  45265. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45266. warn(
  45267. 'Do not use built-in or reserved HTML elements as component ' +
  45268. 'id: ' + name
  45269. );
  45270. }
  45271. }
  45272. /**
  45273. * Ensure all props option syntax are normalized into the
  45274. * Object-based format.
  45275. */
  45276. function normalizeProps (options, vm) {
  45277. var props = options.props;
  45278. if (!props) { return }
  45279. var res = {};
  45280. var i, val, name;
  45281. if (Array.isArray(props)) {
  45282. i = props.length;
  45283. while (i--) {
  45284. val = props[i];
  45285. if (typeof val === 'string') {
  45286. name = camelize(val);
  45287. res[name] = { type: null };
  45288. } else {
  45289. warn('props must be strings when using array syntax.');
  45290. }
  45291. }
  45292. } else if (isPlainObject(props)) {
  45293. for (var key in props) {
  45294. val = props[key];
  45295. name = camelize(key);
  45296. res[name] = isPlainObject(val)
  45297. ? val
  45298. : { type: val };
  45299. }
  45300. } else {
  45301. warn(
  45302. "Invalid value for option \"props\": expected an Array or an Object, " +
  45303. "but got " + (toRawType(props)) + ".",
  45304. vm
  45305. );
  45306. }
  45307. options.props = res;
  45308. }
  45309. /**
  45310. * Normalize all injections into Object-based format
  45311. */
  45312. function normalizeInject (options, vm) {
  45313. var inject = options.inject;
  45314. if (!inject) { return }
  45315. var normalized = options.inject = {};
  45316. if (Array.isArray(inject)) {
  45317. for (var i = 0; i < inject.length; i++) {
  45318. normalized[inject[i]] = { from: inject[i] };
  45319. }
  45320. } else if (isPlainObject(inject)) {
  45321. for (var key in inject) {
  45322. var val = inject[key];
  45323. normalized[key] = isPlainObject(val)
  45324. ? extend({ from: key }, val)
  45325. : { from: val };
  45326. }
  45327. } else {
  45328. warn(
  45329. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45330. "but got " + (toRawType(inject)) + ".",
  45331. vm
  45332. );
  45333. }
  45334. }
  45335. /**
  45336. * Normalize raw function directives into object format.
  45337. */
  45338. function normalizeDirectives (options) {
  45339. var dirs = options.directives;
  45340. if (dirs) {
  45341. for (var key in dirs) {
  45342. var def$$1 = dirs[key];
  45343. if (typeof def$$1 === 'function') {
  45344. dirs[key] = { bind: def$$1, update: def$$1 };
  45345. }
  45346. }
  45347. }
  45348. }
  45349. function assertObjectType (name, value, vm) {
  45350. if (!isPlainObject(value)) {
  45351. warn(
  45352. "Invalid value for option \"" + name + "\": expected an Object, " +
  45353. "but got " + (toRawType(value)) + ".",
  45354. vm
  45355. );
  45356. }
  45357. }
  45358. /**
  45359. * Merge two option objects into a new one.
  45360. * Core utility used in both instantiation and inheritance.
  45361. */
  45362. function mergeOptions (
  45363. parent,
  45364. child,
  45365. vm
  45366. ) {
  45367. {
  45368. checkComponents(child);
  45369. }
  45370. if (typeof child === 'function') {
  45371. child = child.options;
  45372. }
  45373. normalizeProps(child, vm);
  45374. normalizeInject(child, vm);
  45375. normalizeDirectives(child);
  45376. // Apply extends and mixins on the child options,
  45377. // but only if it is a raw options object that isn't
  45378. // the result of another mergeOptions call.
  45379. // Only merged options has the _base property.
  45380. if (!child._base) {
  45381. if (child.extends) {
  45382. parent = mergeOptions(parent, child.extends, vm);
  45383. }
  45384. if (child.mixins) {
  45385. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45386. parent = mergeOptions(parent, child.mixins[i], vm);
  45387. }
  45388. }
  45389. }
  45390. var options = {};
  45391. var key;
  45392. for (key in parent) {
  45393. mergeField(key);
  45394. }
  45395. for (key in child) {
  45396. if (!hasOwn(parent, key)) {
  45397. mergeField(key);
  45398. }
  45399. }
  45400. function mergeField (key) {
  45401. var strat = strats[key] || defaultStrat;
  45402. options[key] = strat(parent[key], child[key], vm, key);
  45403. }
  45404. return options
  45405. }
  45406. /**
  45407. * Resolve an asset.
  45408. * This function is used because child instances need access
  45409. * to assets defined in its ancestor chain.
  45410. */
  45411. function resolveAsset (
  45412. options,
  45413. type,
  45414. id,
  45415. warnMissing
  45416. ) {
  45417. /* istanbul ignore if */
  45418. if (typeof id !== 'string') {
  45419. return
  45420. }
  45421. var assets = options[type];
  45422. // check local registration variations first
  45423. if (hasOwn(assets, id)) { return assets[id] }
  45424. var camelizedId = camelize(id);
  45425. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45426. var PascalCaseId = capitalize(camelizedId);
  45427. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45428. // fallback to prototype chain
  45429. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45430. if (warnMissing && !res) {
  45431. warn(
  45432. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45433. options
  45434. );
  45435. }
  45436. return res
  45437. }
  45438. /* */
  45439. function validateProp (
  45440. key,
  45441. propOptions,
  45442. propsData,
  45443. vm
  45444. ) {
  45445. var prop = propOptions[key];
  45446. var absent = !hasOwn(propsData, key);
  45447. var value = propsData[key];
  45448. // boolean casting
  45449. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45450. if (booleanIndex > -1) {
  45451. if (absent && !hasOwn(prop, 'default')) {
  45452. value = false;
  45453. } else if (value === '' || value === hyphenate(key)) {
  45454. // only cast empty string / same name to boolean if
  45455. // boolean has higher priority
  45456. var stringIndex = getTypeIndex(String, prop.type);
  45457. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45458. value = true;
  45459. }
  45460. }
  45461. }
  45462. // check default value
  45463. if (value === undefined) {
  45464. value = getPropDefaultValue(vm, prop, key);
  45465. // since the default value is a fresh copy,
  45466. // make sure to observe it.
  45467. var prevShouldObserve = shouldObserve;
  45468. toggleObserving(true);
  45469. observe(value);
  45470. toggleObserving(prevShouldObserve);
  45471. }
  45472. {
  45473. assertProp(prop, key, value, vm, absent);
  45474. }
  45475. return value
  45476. }
  45477. /**
  45478. * Get the default value of a prop.
  45479. */
  45480. function getPropDefaultValue (vm, prop, key) {
  45481. // no default, return undefined
  45482. if (!hasOwn(prop, 'default')) {
  45483. return undefined
  45484. }
  45485. var def = prop.default;
  45486. // warn against non-factory defaults for Object & Array
  45487. if (isObject(def)) {
  45488. warn(
  45489. 'Invalid default value for prop "' + key + '": ' +
  45490. 'Props with type Object/Array must use a factory function ' +
  45491. 'to return the default value.',
  45492. vm
  45493. );
  45494. }
  45495. // the raw prop value was also undefined from previous render,
  45496. // return previous default value to avoid unnecessary watcher trigger
  45497. if (vm && vm.$options.propsData &&
  45498. vm.$options.propsData[key] === undefined &&
  45499. vm._props[key] !== undefined
  45500. ) {
  45501. return vm._props[key]
  45502. }
  45503. // call factory function for non-Function types
  45504. // a value is Function if its prototype is function even across different execution context
  45505. return typeof def === 'function' && getType(prop.type) !== 'Function'
  45506. ? def.call(vm)
  45507. : def
  45508. }
  45509. /**
  45510. * Assert whether a prop is valid.
  45511. */
  45512. function assertProp (
  45513. prop,
  45514. name,
  45515. value,
  45516. vm,
  45517. absent
  45518. ) {
  45519. if (prop.required && absent) {
  45520. warn(
  45521. 'Missing required prop: "' + name + '"',
  45522. vm
  45523. );
  45524. return
  45525. }
  45526. if (value == null && !prop.required) {
  45527. return
  45528. }
  45529. var type = prop.type;
  45530. var valid = !type || type === true;
  45531. var expectedTypes = [];
  45532. if (type) {
  45533. if (!Array.isArray(type)) {
  45534. type = [type];
  45535. }
  45536. for (var i = 0; i < type.length && !valid; i++) {
  45537. var assertedType = assertType(value, type[i]);
  45538. expectedTypes.push(assertedType.expectedType || '');
  45539. valid = assertedType.valid;
  45540. }
  45541. }
  45542. if (!valid) {
  45543. warn(
  45544. getInvalidTypeMessage(name, value, expectedTypes),
  45545. vm
  45546. );
  45547. return
  45548. }
  45549. var validator = prop.validator;
  45550. if (validator) {
  45551. if (!validator(value)) {
  45552. warn(
  45553. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  45554. vm
  45555. );
  45556. }
  45557. }
  45558. }
  45559. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  45560. function assertType (value, type) {
  45561. var valid;
  45562. var expectedType = getType(type);
  45563. if (simpleCheckRE.test(expectedType)) {
  45564. var t = typeof value;
  45565. valid = t === expectedType.toLowerCase();
  45566. // for primitive wrapper objects
  45567. if (!valid && t === 'object') {
  45568. valid = value instanceof type;
  45569. }
  45570. } else if (expectedType === 'Object') {
  45571. valid = isPlainObject(value);
  45572. } else if (expectedType === 'Array') {
  45573. valid = Array.isArray(value);
  45574. } else {
  45575. valid = value instanceof type;
  45576. }
  45577. return {
  45578. valid: valid,
  45579. expectedType: expectedType
  45580. }
  45581. }
  45582. /**
  45583. * Use function string name to check built-in types,
  45584. * because a simple equality check will fail when running
  45585. * across different vms / iframes.
  45586. */
  45587. function getType (fn) {
  45588. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  45589. return match ? match[1] : ''
  45590. }
  45591. function isSameType (a, b) {
  45592. return getType(a) === getType(b)
  45593. }
  45594. function getTypeIndex (type, expectedTypes) {
  45595. if (!Array.isArray(expectedTypes)) {
  45596. return isSameType(expectedTypes, type) ? 0 : -1
  45597. }
  45598. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  45599. if (isSameType(expectedTypes[i], type)) {
  45600. return i
  45601. }
  45602. }
  45603. return -1
  45604. }
  45605. function getInvalidTypeMessage (name, value, expectedTypes) {
  45606. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  45607. " Expected " + (expectedTypes.map(capitalize).join(', '));
  45608. var expectedType = expectedTypes[0];
  45609. var receivedType = toRawType(value);
  45610. var expectedValue = styleValue(value, expectedType);
  45611. var receivedValue = styleValue(value, receivedType);
  45612. // check if we need to specify expected value
  45613. if (expectedTypes.length === 1 &&
  45614. isExplicable(expectedType) &&
  45615. !isBoolean(expectedType, receivedType)) {
  45616. message += " with value " + expectedValue;
  45617. }
  45618. message += ", got " + receivedType + " ";
  45619. // check if we need to specify received value
  45620. if (isExplicable(receivedType)) {
  45621. message += "with value " + receivedValue + ".";
  45622. }
  45623. return message
  45624. }
  45625. function styleValue (value, type) {
  45626. if (type === 'String') {
  45627. return ("\"" + value + "\"")
  45628. } else if (type === 'Number') {
  45629. return ("" + (Number(value)))
  45630. } else {
  45631. return ("" + value)
  45632. }
  45633. }
  45634. function isExplicable (value) {
  45635. var explicitTypes = ['string', 'number', 'boolean'];
  45636. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  45637. }
  45638. function isBoolean () {
  45639. var args = [], len = arguments.length;
  45640. while ( len-- ) args[ len ] = arguments[ len ];
  45641. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  45642. }
  45643. /* */
  45644. function handleError (err, vm, info) {
  45645. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  45646. // See: https://github.com/vuejs/vuex/issues/1505
  45647. pushTarget();
  45648. try {
  45649. if (vm) {
  45650. var cur = vm;
  45651. while ((cur = cur.$parent)) {
  45652. var hooks = cur.$options.errorCaptured;
  45653. if (hooks) {
  45654. for (var i = 0; i < hooks.length; i++) {
  45655. try {
  45656. var capture = hooks[i].call(cur, err, vm, info) === false;
  45657. if (capture) { return }
  45658. } catch (e) {
  45659. globalHandleError(e, cur, 'errorCaptured hook');
  45660. }
  45661. }
  45662. }
  45663. }
  45664. }
  45665. globalHandleError(err, vm, info);
  45666. } finally {
  45667. popTarget();
  45668. }
  45669. }
  45670. function invokeWithErrorHandling (
  45671. handler,
  45672. context,
  45673. args,
  45674. vm,
  45675. info
  45676. ) {
  45677. var res;
  45678. try {
  45679. res = args ? handler.apply(context, args) : handler.call(context);
  45680. if (res && !res._isVue && isPromise(res) && !res._handled) {
  45681. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  45682. // issue #9511
  45683. // avoid catch triggering multiple times when nested calls
  45684. res._handled = true;
  45685. }
  45686. } catch (e) {
  45687. handleError(e, vm, info);
  45688. }
  45689. return res
  45690. }
  45691. function globalHandleError (err, vm, info) {
  45692. if (config.errorHandler) {
  45693. try {
  45694. return config.errorHandler.call(null, err, vm, info)
  45695. } catch (e) {
  45696. // if the user intentionally throws the original error in the handler,
  45697. // do not log it twice
  45698. if (e !== err) {
  45699. logError(e, null, 'config.errorHandler');
  45700. }
  45701. }
  45702. }
  45703. logError(err, vm, info);
  45704. }
  45705. function logError (err, vm, info) {
  45706. {
  45707. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  45708. }
  45709. /* istanbul ignore else */
  45710. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  45711. console.error(err);
  45712. } else {
  45713. throw err
  45714. }
  45715. }
  45716. /* */
  45717. var isUsingMicroTask = false;
  45718. var callbacks = [];
  45719. var pending = false;
  45720. function flushCallbacks () {
  45721. pending = false;
  45722. var copies = callbacks.slice(0);
  45723. callbacks.length = 0;
  45724. for (var i = 0; i < copies.length; i++) {
  45725. copies[i]();
  45726. }
  45727. }
  45728. // Here we have async deferring wrappers using microtasks.
  45729. // In 2.5 we used (macro) tasks (in combination with microtasks).
  45730. // However, it has subtle problems when state is changed right before repaint
  45731. // (e.g. #6813, out-in transitions).
  45732. // Also, using (macro) tasks in event handler would cause some weird behaviors
  45733. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  45734. // So we now use microtasks everywhere, again.
  45735. // A major drawback of this tradeoff is that there are some scenarios
  45736. // where microtasks have too high a priority and fire in between supposedly
  45737. // sequential events (e.g. #4521, #6690, which have workarounds)
  45738. // or even between bubbling of the same event (#6566).
  45739. var timerFunc;
  45740. // The nextTick behavior leverages the microtask queue, which can be accessed
  45741. // via either native Promise.then or MutationObserver.
  45742. // MutationObserver has wider support, however it is seriously bugged in
  45743. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  45744. // completely stops working after triggering a few times... so, if native
  45745. // Promise is available, we will use it:
  45746. /* istanbul ignore next, $flow-disable-line */
  45747. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  45748. var p = Promise.resolve();
  45749. timerFunc = function () {
  45750. p.then(flushCallbacks);
  45751. // In problematic UIWebViews, Promise.then doesn't completely break, but
  45752. // it can get stuck in a weird state where callbacks are pushed into the
  45753. // microtask queue but the queue isn't being flushed, until the browser
  45754. // needs to do some other work, e.g. handle a timer. Therefore we can
  45755. // "force" the microtask queue to be flushed by adding an empty timer.
  45756. if (isIOS) { setTimeout(noop); }
  45757. };
  45758. isUsingMicroTask = true;
  45759. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  45760. isNative(MutationObserver) ||
  45761. // PhantomJS and iOS 7.x
  45762. MutationObserver.toString() === '[object MutationObserverConstructor]'
  45763. )) {
  45764. // Use MutationObserver where native Promise is not available,
  45765. // e.g. PhantomJS, iOS7, Android 4.4
  45766. // (#6466 MutationObserver is unreliable in IE11)
  45767. var counter = 1;
  45768. var observer = new MutationObserver(flushCallbacks);
  45769. var textNode = document.createTextNode(String(counter));
  45770. observer.observe(textNode, {
  45771. characterData: true
  45772. });
  45773. timerFunc = function () {
  45774. counter = (counter + 1) % 2;
  45775. textNode.data = String(counter);
  45776. };
  45777. isUsingMicroTask = true;
  45778. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  45779. // Fallback to setImmediate.
  45780. // Technically it leverages the (macro) task queue,
  45781. // but it is still a better choice than setTimeout.
  45782. timerFunc = function () {
  45783. setImmediate(flushCallbacks);
  45784. };
  45785. } else {
  45786. // Fallback to setTimeout.
  45787. timerFunc = function () {
  45788. setTimeout(flushCallbacks, 0);
  45789. };
  45790. }
  45791. function nextTick (cb, ctx) {
  45792. var _resolve;
  45793. callbacks.push(function () {
  45794. if (cb) {
  45795. try {
  45796. cb.call(ctx);
  45797. } catch (e) {
  45798. handleError(e, ctx, 'nextTick');
  45799. }
  45800. } else if (_resolve) {
  45801. _resolve(ctx);
  45802. }
  45803. });
  45804. if (!pending) {
  45805. pending = true;
  45806. timerFunc();
  45807. }
  45808. // $flow-disable-line
  45809. if (!cb && typeof Promise !== 'undefined') {
  45810. return new Promise(function (resolve) {
  45811. _resolve = resolve;
  45812. })
  45813. }
  45814. }
  45815. /* */
  45816. var mark;
  45817. var measure;
  45818. {
  45819. var perf = inBrowser && window.performance;
  45820. /* istanbul ignore if */
  45821. if (
  45822. perf &&
  45823. perf.mark &&
  45824. perf.measure &&
  45825. perf.clearMarks &&
  45826. perf.clearMeasures
  45827. ) {
  45828. mark = function (tag) { return perf.mark(tag); };
  45829. measure = function (name, startTag, endTag) {
  45830. perf.measure(name, startTag, endTag);
  45831. perf.clearMarks(startTag);
  45832. perf.clearMarks(endTag);
  45833. // perf.clearMeasures(name)
  45834. };
  45835. }
  45836. }
  45837. /* not type checking this file because flow doesn't play well with Proxy */
  45838. var initProxy;
  45839. {
  45840. var allowedGlobals = makeMap(
  45841. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  45842. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  45843. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  45844. 'require' // for Webpack/Browserify
  45845. );
  45846. var warnNonPresent = function (target, key) {
  45847. warn(
  45848. "Property or method \"" + key + "\" is not defined on the instance but " +
  45849. 'referenced during render. Make sure that this property is reactive, ' +
  45850. 'either in the data option, or for class-based components, by ' +
  45851. 'initializing the property. ' +
  45852. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  45853. target
  45854. );
  45855. };
  45856. var warnReservedPrefix = function (target, key) {
  45857. warn(
  45858. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  45859. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  45860. 'prevent conflicts with Vue internals. ' +
  45861. 'See: https://vuejs.org/v2/api/#data',
  45862. target
  45863. );
  45864. };
  45865. var hasProxy =
  45866. typeof Proxy !== 'undefined' && isNative(Proxy);
  45867. if (hasProxy) {
  45868. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  45869. config.keyCodes = new Proxy(config.keyCodes, {
  45870. set: function set (target, key, value) {
  45871. if (isBuiltInModifier(key)) {
  45872. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  45873. return false
  45874. } else {
  45875. target[key] = value;
  45876. return true
  45877. }
  45878. }
  45879. });
  45880. }
  45881. var hasHandler = {
  45882. has: function has (target, key) {
  45883. var has = key in target;
  45884. var isAllowed = allowedGlobals(key) ||
  45885. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  45886. if (!has && !isAllowed) {
  45887. if (key in target.$data) { warnReservedPrefix(target, key); }
  45888. else { warnNonPresent(target, key); }
  45889. }
  45890. return has || !isAllowed
  45891. }
  45892. };
  45893. var getHandler = {
  45894. get: function get (target, key) {
  45895. if (typeof key === 'string' && !(key in target)) {
  45896. if (key in target.$data) { warnReservedPrefix(target, key); }
  45897. else { warnNonPresent(target, key); }
  45898. }
  45899. return target[key]
  45900. }
  45901. };
  45902. initProxy = function initProxy (vm) {
  45903. if (hasProxy) {
  45904. // determine which proxy handler to use
  45905. var options = vm.$options;
  45906. var handlers = options.render && options.render._withStripped
  45907. ? getHandler
  45908. : hasHandler;
  45909. vm._renderProxy = new Proxy(vm, handlers);
  45910. } else {
  45911. vm._renderProxy = vm;
  45912. }
  45913. };
  45914. }
  45915. /* */
  45916. var seenObjects = new _Set();
  45917. /**
  45918. * Recursively traverse an object to evoke all converted
  45919. * getters, so that every nested property inside the object
  45920. * is collected as a "deep" dependency.
  45921. */
  45922. function traverse (val) {
  45923. _traverse(val, seenObjects);
  45924. seenObjects.clear();
  45925. }
  45926. function _traverse (val, seen) {
  45927. var i, keys;
  45928. var isA = Array.isArray(val);
  45929. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  45930. return
  45931. }
  45932. if (val.__ob__) {
  45933. var depId = val.__ob__.dep.id;
  45934. if (seen.has(depId)) {
  45935. return
  45936. }
  45937. seen.add(depId);
  45938. }
  45939. if (isA) {
  45940. i = val.length;
  45941. while (i--) { _traverse(val[i], seen); }
  45942. } else {
  45943. keys = Object.keys(val);
  45944. i = keys.length;
  45945. while (i--) { _traverse(val[keys[i]], seen); }
  45946. }
  45947. }
  45948. /* */
  45949. var normalizeEvent = cached(function (name) {
  45950. var passive = name.charAt(0) === '&';
  45951. name = passive ? name.slice(1) : name;
  45952. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  45953. name = once$$1 ? name.slice(1) : name;
  45954. var capture = name.charAt(0) === '!';
  45955. name = capture ? name.slice(1) : name;
  45956. return {
  45957. name: name,
  45958. once: once$$1,
  45959. capture: capture,
  45960. passive: passive
  45961. }
  45962. });
  45963. function createFnInvoker (fns, vm) {
  45964. function invoker () {
  45965. var arguments$1 = arguments;
  45966. var fns = invoker.fns;
  45967. if (Array.isArray(fns)) {
  45968. var cloned = fns.slice();
  45969. for (var i = 0; i < cloned.length; i++) {
  45970. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  45971. }
  45972. } else {
  45973. // return handler return value for single handlers
  45974. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  45975. }
  45976. }
  45977. invoker.fns = fns;
  45978. return invoker
  45979. }
  45980. function updateListeners (
  45981. on,
  45982. oldOn,
  45983. add,
  45984. remove$$1,
  45985. createOnceHandler,
  45986. vm
  45987. ) {
  45988. var name, def$$1, cur, old, event;
  45989. for (name in on) {
  45990. def$$1 = cur = on[name];
  45991. old = oldOn[name];
  45992. event = normalizeEvent(name);
  45993. if (isUndef(cur)) {
  45994. warn(
  45995. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  45996. vm
  45997. );
  45998. } else if (isUndef(old)) {
  45999. if (isUndef(cur.fns)) {
  46000. cur = on[name] = createFnInvoker(cur, vm);
  46001. }
  46002. if (isTrue(event.once)) {
  46003. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46004. }
  46005. add(event.name, cur, event.capture, event.passive, event.params);
  46006. } else if (cur !== old) {
  46007. old.fns = cur;
  46008. on[name] = old;
  46009. }
  46010. }
  46011. for (name in oldOn) {
  46012. if (isUndef(on[name])) {
  46013. event = normalizeEvent(name);
  46014. remove$$1(event.name, oldOn[name], event.capture);
  46015. }
  46016. }
  46017. }
  46018. /* */
  46019. function mergeVNodeHook (def, hookKey, hook) {
  46020. if (def instanceof VNode) {
  46021. def = def.data.hook || (def.data.hook = {});
  46022. }
  46023. var invoker;
  46024. var oldHook = def[hookKey];
  46025. function wrappedHook () {
  46026. hook.apply(this, arguments);
  46027. // important: remove merged hook to ensure it's called only once
  46028. // and prevent memory leak
  46029. remove(invoker.fns, wrappedHook);
  46030. }
  46031. if (isUndef(oldHook)) {
  46032. // no existing hook
  46033. invoker = createFnInvoker([wrappedHook]);
  46034. } else {
  46035. /* istanbul ignore if */
  46036. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46037. // already a merged invoker
  46038. invoker = oldHook;
  46039. invoker.fns.push(wrappedHook);
  46040. } else {
  46041. // existing plain hook
  46042. invoker = createFnInvoker([oldHook, wrappedHook]);
  46043. }
  46044. }
  46045. invoker.merged = true;
  46046. def[hookKey] = invoker;
  46047. }
  46048. /* */
  46049. function extractPropsFromVNodeData (
  46050. data,
  46051. Ctor,
  46052. tag
  46053. ) {
  46054. // we are only extracting raw values here.
  46055. // validation and default values are handled in the child
  46056. // component itself.
  46057. var propOptions = Ctor.options.props;
  46058. if (isUndef(propOptions)) {
  46059. return
  46060. }
  46061. var res = {};
  46062. var attrs = data.attrs;
  46063. var props = data.props;
  46064. if (isDef(attrs) || isDef(props)) {
  46065. for (var key in propOptions) {
  46066. var altKey = hyphenate(key);
  46067. {
  46068. var keyInLowerCase = key.toLowerCase();
  46069. if (
  46070. key !== keyInLowerCase &&
  46071. attrs && hasOwn(attrs, keyInLowerCase)
  46072. ) {
  46073. tip(
  46074. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46075. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46076. " \"" + key + "\". " +
  46077. "Note that HTML attributes are case-insensitive and camelCased " +
  46078. "props need to use their kebab-case equivalents when using in-DOM " +
  46079. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46080. );
  46081. }
  46082. }
  46083. checkProp(res, props, key, altKey, true) ||
  46084. checkProp(res, attrs, key, altKey, false);
  46085. }
  46086. }
  46087. return res
  46088. }
  46089. function checkProp (
  46090. res,
  46091. hash,
  46092. key,
  46093. altKey,
  46094. preserve
  46095. ) {
  46096. if (isDef(hash)) {
  46097. if (hasOwn(hash, key)) {
  46098. res[key] = hash[key];
  46099. if (!preserve) {
  46100. delete hash[key];
  46101. }
  46102. return true
  46103. } else if (hasOwn(hash, altKey)) {
  46104. res[key] = hash[altKey];
  46105. if (!preserve) {
  46106. delete hash[altKey];
  46107. }
  46108. return true
  46109. }
  46110. }
  46111. return false
  46112. }
  46113. /* */
  46114. // The template compiler attempts to minimize the need for normalization by
  46115. // statically analyzing the template at compile time.
  46116. //
  46117. // For plain HTML markup, normalization can be completely skipped because the
  46118. // generated render function is guaranteed to return Array<VNode>. There are
  46119. // two cases where extra normalization is needed:
  46120. // 1. When the children contains components - because a functional component
  46121. // may return an Array instead of a single root. In this case, just a simple
  46122. // normalization is needed - if any child is an Array, we flatten the whole
  46123. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46124. // because functional components already normalize their own children.
  46125. function simpleNormalizeChildren (children) {
  46126. for (var i = 0; i < children.length; i++) {
  46127. if (Array.isArray(children[i])) {
  46128. return Array.prototype.concat.apply([], children)
  46129. }
  46130. }
  46131. return children
  46132. }
  46133. // 2. When the children contains constructs that always generated nested Arrays,
  46134. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46135. // with hand-written render functions / JSX. In such cases a full normalization
  46136. // is needed to cater to all possible types of children values.
  46137. function normalizeChildren (children) {
  46138. return isPrimitive(children)
  46139. ? [createTextVNode(children)]
  46140. : Array.isArray(children)
  46141. ? normalizeArrayChildren(children)
  46142. : undefined
  46143. }
  46144. function isTextNode (node) {
  46145. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46146. }
  46147. function normalizeArrayChildren (children, nestedIndex) {
  46148. var res = [];
  46149. var i, c, lastIndex, last;
  46150. for (i = 0; i < children.length; i++) {
  46151. c = children[i];
  46152. if (isUndef(c) || typeof c === 'boolean') { continue }
  46153. lastIndex = res.length - 1;
  46154. last = res[lastIndex];
  46155. // nested
  46156. if (Array.isArray(c)) {
  46157. if (c.length > 0) {
  46158. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46159. // merge adjacent text nodes
  46160. if (isTextNode(c[0]) && isTextNode(last)) {
  46161. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46162. c.shift();
  46163. }
  46164. res.push.apply(res, c);
  46165. }
  46166. } else if (isPrimitive(c)) {
  46167. if (isTextNode(last)) {
  46168. // merge adjacent text nodes
  46169. // this is necessary for SSR hydration because text nodes are
  46170. // essentially merged when rendered to HTML strings
  46171. res[lastIndex] = createTextVNode(last.text + c);
  46172. } else if (c !== '') {
  46173. // convert primitive to vnode
  46174. res.push(createTextVNode(c));
  46175. }
  46176. } else {
  46177. if (isTextNode(c) && isTextNode(last)) {
  46178. // merge adjacent text nodes
  46179. res[lastIndex] = createTextVNode(last.text + c.text);
  46180. } else {
  46181. // default key for nested array children (likely generated by v-for)
  46182. if (isTrue(children._isVList) &&
  46183. isDef(c.tag) &&
  46184. isUndef(c.key) &&
  46185. isDef(nestedIndex)) {
  46186. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46187. }
  46188. res.push(c);
  46189. }
  46190. }
  46191. }
  46192. return res
  46193. }
  46194. /* */
  46195. function initProvide (vm) {
  46196. var provide = vm.$options.provide;
  46197. if (provide) {
  46198. vm._provided = typeof provide === 'function'
  46199. ? provide.call(vm)
  46200. : provide;
  46201. }
  46202. }
  46203. function initInjections (vm) {
  46204. var result = resolveInject(vm.$options.inject, vm);
  46205. if (result) {
  46206. toggleObserving(false);
  46207. Object.keys(result).forEach(function (key) {
  46208. /* istanbul ignore else */
  46209. {
  46210. defineReactive$$1(vm, key, result[key], function () {
  46211. warn(
  46212. "Avoid mutating an injected value directly since the changes will be " +
  46213. "overwritten whenever the provided component re-renders. " +
  46214. "injection being mutated: \"" + key + "\"",
  46215. vm
  46216. );
  46217. });
  46218. }
  46219. });
  46220. toggleObserving(true);
  46221. }
  46222. }
  46223. function resolveInject (inject, vm) {
  46224. if (inject) {
  46225. // inject is :any because flow is not smart enough to figure out cached
  46226. var result = Object.create(null);
  46227. var keys = hasSymbol
  46228. ? Reflect.ownKeys(inject)
  46229. : Object.keys(inject);
  46230. for (var i = 0; i < keys.length; i++) {
  46231. var key = keys[i];
  46232. // #6574 in case the inject object is observed...
  46233. if (key === '__ob__') { continue }
  46234. var provideKey = inject[key].from;
  46235. var source = vm;
  46236. while (source) {
  46237. if (source._provided && hasOwn(source._provided, provideKey)) {
  46238. result[key] = source._provided[provideKey];
  46239. break
  46240. }
  46241. source = source.$parent;
  46242. }
  46243. if (!source) {
  46244. if ('default' in inject[key]) {
  46245. var provideDefault = inject[key].default;
  46246. result[key] = typeof provideDefault === 'function'
  46247. ? provideDefault.call(vm)
  46248. : provideDefault;
  46249. } else {
  46250. warn(("Injection \"" + key + "\" not found"), vm);
  46251. }
  46252. }
  46253. }
  46254. return result
  46255. }
  46256. }
  46257. /* */
  46258. /**
  46259. * Runtime helper for resolving raw children VNodes into a slot object.
  46260. */
  46261. function resolveSlots (
  46262. children,
  46263. context
  46264. ) {
  46265. if (!children || !children.length) {
  46266. return {}
  46267. }
  46268. var slots = {};
  46269. for (var i = 0, l = children.length; i < l; i++) {
  46270. var child = children[i];
  46271. var data = child.data;
  46272. // remove slot attribute if the node is resolved as a Vue slot node
  46273. if (data && data.attrs && data.attrs.slot) {
  46274. delete data.attrs.slot;
  46275. }
  46276. // named slots should only be respected if the vnode was rendered in the
  46277. // same context.
  46278. if ((child.context === context || child.fnContext === context) &&
  46279. data && data.slot != null
  46280. ) {
  46281. var name = data.slot;
  46282. var slot = (slots[name] || (slots[name] = []));
  46283. if (child.tag === 'template') {
  46284. slot.push.apply(slot, child.children || []);
  46285. } else {
  46286. slot.push(child);
  46287. }
  46288. } else {
  46289. (slots.default || (slots.default = [])).push(child);
  46290. }
  46291. }
  46292. // ignore slots that contains only whitespace
  46293. for (var name$1 in slots) {
  46294. if (slots[name$1].every(isWhitespace)) {
  46295. delete slots[name$1];
  46296. }
  46297. }
  46298. return slots
  46299. }
  46300. function isWhitespace (node) {
  46301. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46302. }
  46303. /* */
  46304. function normalizeScopedSlots (
  46305. slots,
  46306. normalSlots,
  46307. prevSlots
  46308. ) {
  46309. var res;
  46310. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46311. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46312. var key = slots && slots.$key;
  46313. if (!slots) {
  46314. res = {};
  46315. } else if (slots._normalized) {
  46316. // fast path 1: child component re-render only, parent did not change
  46317. return slots._normalized
  46318. } else if (
  46319. isStable &&
  46320. prevSlots &&
  46321. prevSlots !== emptyObject &&
  46322. key === prevSlots.$key &&
  46323. !hasNormalSlots &&
  46324. !prevSlots.$hasNormal
  46325. ) {
  46326. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46327. // only need to normalize once
  46328. return prevSlots
  46329. } else {
  46330. res = {};
  46331. for (var key$1 in slots) {
  46332. if (slots[key$1] && key$1[0] !== '$') {
  46333. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46334. }
  46335. }
  46336. }
  46337. // expose normal slots on scopedSlots
  46338. for (var key$2 in normalSlots) {
  46339. if (!(key$2 in res)) {
  46340. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46341. }
  46342. }
  46343. // avoriaz seems to mock a non-extensible $scopedSlots object
  46344. // and when that is passed down this would cause an error
  46345. if (slots && Object.isExtensible(slots)) {
  46346. (slots)._normalized = res;
  46347. }
  46348. def(res, '$stable', isStable);
  46349. def(res, '$key', key);
  46350. def(res, '$hasNormal', hasNormalSlots);
  46351. return res
  46352. }
  46353. function normalizeScopedSlot(normalSlots, key, fn) {
  46354. var normalized = function () {
  46355. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46356. res = res && typeof res === 'object' && !Array.isArray(res)
  46357. ? [res] // single vnode
  46358. : normalizeChildren(res);
  46359. return res && (
  46360. res.length === 0 ||
  46361. (res.length === 1 && res[0].isComment) // #9658
  46362. ) ? undefined
  46363. : res
  46364. };
  46365. // this is a slot using the new v-slot syntax without scope. although it is
  46366. // compiled as a scoped slot, render fn users would expect it to be present
  46367. // on this.$slots because the usage is semantically a normal slot.
  46368. if (fn.proxy) {
  46369. Object.defineProperty(normalSlots, key, {
  46370. get: normalized,
  46371. enumerable: true,
  46372. configurable: true
  46373. });
  46374. }
  46375. return normalized
  46376. }
  46377. function proxyNormalSlot(slots, key) {
  46378. return function () { return slots[key]; }
  46379. }
  46380. /* */
  46381. /**
  46382. * Runtime helper for rendering v-for lists.
  46383. */
  46384. function renderList (
  46385. val,
  46386. render
  46387. ) {
  46388. var ret, i, l, keys, key;
  46389. if (Array.isArray(val) || typeof val === 'string') {
  46390. ret = new Array(val.length);
  46391. for (i = 0, l = val.length; i < l; i++) {
  46392. ret[i] = render(val[i], i);
  46393. }
  46394. } else if (typeof val === 'number') {
  46395. ret = new Array(val);
  46396. for (i = 0; i < val; i++) {
  46397. ret[i] = render(i + 1, i);
  46398. }
  46399. } else if (isObject(val)) {
  46400. if (hasSymbol && val[Symbol.iterator]) {
  46401. ret = [];
  46402. var iterator = val[Symbol.iterator]();
  46403. var result = iterator.next();
  46404. while (!result.done) {
  46405. ret.push(render(result.value, ret.length));
  46406. result = iterator.next();
  46407. }
  46408. } else {
  46409. keys = Object.keys(val);
  46410. ret = new Array(keys.length);
  46411. for (i = 0, l = keys.length; i < l; i++) {
  46412. key = keys[i];
  46413. ret[i] = render(val[key], key, i);
  46414. }
  46415. }
  46416. }
  46417. if (!isDef(ret)) {
  46418. ret = [];
  46419. }
  46420. (ret)._isVList = true;
  46421. return ret
  46422. }
  46423. /* */
  46424. /**
  46425. * Runtime helper for rendering <slot>
  46426. */
  46427. function renderSlot (
  46428. name,
  46429. fallback,
  46430. props,
  46431. bindObject
  46432. ) {
  46433. var scopedSlotFn = this.$scopedSlots[name];
  46434. var nodes;
  46435. if (scopedSlotFn) { // scoped slot
  46436. props = props || {};
  46437. if (bindObject) {
  46438. if (!isObject(bindObject)) {
  46439. warn(
  46440. 'slot v-bind without argument expects an Object',
  46441. this
  46442. );
  46443. }
  46444. props = extend(extend({}, bindObject), props);
  46445. }
  46446. nodes = scopedSlotFn(props) || fallback;
  46447. } else {
  46448. nodes = this.$slots[name] || fallback;
  46449. }
  46450. var target = props && props.slot;
  46451. if (target) {
  46452. return this.$createElement('template', { slot: target }, nodes)
  46453. } else {
  46454. return nodes
  46455. }
  46456. }
  46457. /* */
  46458. /**
  46459. * Runtime helper for resolving filters
  46460. */
  46461. function resolveFilter (id) {
  46462. return resolveAsset(this.$options, 'filters', id, true) || identity
  46463. }
  46464. /* */
  46465. function isKeyNotMatch (expect, actual) {
  46466. if (Array.isArray(expect)) {
  46467. return expect.indexOf(actual) === -1
  46468. } else {
  46469. return expect !== actual
  46470. }
  46471. }
  46472. /**
  46473. * Runtime helper for checking keyCodes from config.
  46474. * exposed as Vue.prototype._k
  46475. * passing in eventKeyName as last argument separately for backwards compat
  46476. */
  46477. function checkKeyCodes (
  46478. eventKeyCode,
  46479. key,
  46480. builtInKeyCode,
  46481. eventKeyName,
  46482. builtInKeyName
  46483. ) {
  46484. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  46485. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  46486. return isKeyNotMatch(builtInKeyName, eventKeyName)
  46487. } else if (mappedKeyCode) {
  46488. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  46489. } else if (eventKeyName) {
  46490. return hyphenate(eventKeyName) !== key
  46491. }
  46492. }
  46493. /* */
  46494. /**
  46495. * Runtime helper for merging v-bind="object" into a VNode's data.
  46496. */
  46497. function bindObjectProps (
  46498. data,
  46499. tag,
  46500. value,
  46501. asProp,
  46502. isSync
  46503. ) {
  46504. if (value) {
  46505. if (!isObject(value)) {
  46506. warn(
  46507. 'v-bind without argument expects an Object or Array value',
  46508. this
  46509. );
  46510. } else {
  46511. if (Array.isArray(value)) {
  46512. value = toObject(value);
  46513. }
  46514. var hash;
  46515. var loop = function ( key ) {
  46516. if (
  46517. key === 'class' ||
  46518. key === 'style' ||
  46519. isReservedAttribute(key)
  46520. ) {
  46521. hash = data;
  46522. } else {
  46523. var type = data.attrs && data.attrs.type;
  46524. hash = asProp || config.mustUseProp(tag, type, key)
  46525. ? data.domProps || (data.domProps = {})
  46526. : data.attrs || (data.attrs = {});
  46527. }
  46528. var camelizedKey = camelize(key);
  46529. var hyphenatedKey = hyphenate(key);
  46530. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  46531. hash[key] = value[key];
  46532. if (isSync) {
  46533. var on = data.on || (data.on = {});
  46534. on[("update:" + key)] = function ($event) {
  46535. value[key] = $event;
  46536. };
  46537. }
  46538. }
  46539. };
  46540. for (var key in value) loop( key );
  46541. }
  46542. }
  46543. return data
  46544. }
  46545. /* */
  46546. /**
  46547. * Runtime helper for rendering static trees.
  46548. */
  46549. function renderStatic (
  46550. index,
  46551. isInFor
  46552. ) {
  46553. var cached = this._staticTrees || (this._staticTrees = []);
  46554. var tree = cached[index];
  46555. // if has already-rendered static tree and not inside v-for,
  46556. // we can reuse the same tree.
  46557. if (tree && !isInFor) {
  46558. return tree
  46559. }
  46560. // otherwise, render a fresh tree.
  46561. tree = cached[index] = this.$options.staticRenderFns[index].call(
  46562. this._renderProxy,
  46563. null,
  46564. this // for render fns generated for functional component templates
  46565. );
  46566. markStatic(tree, ("__static__" + index), false);
  46567. return tree
  46568. }
  46569. /**
  46570. * Runtime helper for v-once.
  46571. * Effectively it means marking the node as static with a unique key.
  46572. */
  46573. function markOnce (
  46574. tree,
  46575. index,
  46576. key
  46577. ) {
  46578. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  46579. return tree
  46580. }
  46581. function markStatic (
  46582. tree,
  46583. key,
  46584. isOnce
  46585. ) {
  46586. if (Array.isArray(tree)) {
  46587. for (var i = 0; i < tree.length; i++) {
  46588. if (tree[i] && typeof tree[i] !== 'string') {
  46589. markStaticNode(tree[i], (key + "_" + i), isOnce);
  46590. }
  46591. }
  46592. } else {
  46593. markStaticNode(tree, key, isOnce);
  46594. }
  46595. }
  46596. function markStaticNode (node, key, isOnce) {
  46597. node.isStatic = true;
  46598. node.key = key;
  46599. node.isOnce = isOnce;
  46600. }
  46601. /* */
  46602. function bindObjectListeners (data, value) {
  46603. if (value) {
  46604. if (!isPlainObject(value)) {
  46605. warn(
  46606. 'v-on without argument expects an Object value',
  46607. this
  46608. );
  46609. } else {
  46610. var on = data.on = data.on ? extend({}, data.on) : {};
  46611. for (var key in value) {
  46612. var existing = on[key];
  46613. var ours = value[key];
  46614. on[key] = existing ? [].concat(existing, ours) : ours;
  46615. }
  46616. }
  46617. }
  46618. return data
  46619. }
  46620. /* */
  46621. function resolveScopedSlots (
  46622. fns, // see flow/vnode
  46623. res,
  46624. // the following are added in 2.6
  46625. hasDynamicKeys,
  46626. contentHashKey
  46627. ) {
  46628. res = res || { $stable: !hasDynamicKeys };
  46629. for (var i = 0; i < fns.length; i++) {
  46630. var slot = fns[i];
  46631. if (Array.isArray(slot)) {
  46632. resolveScopedSlots(slot, res, hasDynamicKeys);
  46633. } else if (slot) {
  46634. // marker for reverse proxying v-slot without scope on this.$slots
  46635. if (slot.proxy) {
  46636. slot.fn.proxy = true;
  46637. }
  46638. res[slot.key] = slot.fn;
  46639. }
  46640. }
  46641. if (contentHashKey) {
  46642. (res).$key = contentHashKey;
  46643. }
  46644. return res
  46645. }
  46646. /* */
  46647. function bindDynamicKeys (baseObj, values) {
  46648. for (var i = 0; i < values.length; i += 2) {
  46649. var key = values[i];
  46650. if (typeof key === 'string' && key) {
  46651. baseObj[values[i]] = values[i + 1];
  46652. } else if (key !== '' && key !== null) {
  46653. // null is a special value for explicitly removing a binding
  46654. warn(
  46655. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  46656. this
  46657. );
  46658. }
  46659. }
  46660. return baseObj
  46661. }
  46662. // helper to dynamically append modifier runtime markers to event names.
  46663. // ensure only append when value is already string, otherwise it will be cast
  46664. // to string and cause the type check to miss.
  46665. function prependModifier (value, symbol) {
  46666. return typeof value === 'string' ? symbol + value : value
  46667. }
  46668. /* */
  46669. function installRenderHelpers (target) {
  46670. target._o = markOnce;
  46671. target._n = toNumber;
  46672. target._s = toString;
  46673. target._l = renderList;
  46674. target._t = renderSlot;
  46675. target._q = looseEqual;
  46676. target._i = looseIndexOf;
  46677. target._m = renderStatic;
  46678. target._f = resolveFilter;
  46679. target._k = checkKeyCodes;
  46680. target._b = bindObjectProps;
  46681. target._v = createTextVNode;
  46682. target._e = createEmptyVNode;
  46683. target._u = resolveScopedSlots;
  46684. target._g = bindObjectListeners;
  46685. target._d = bindDynamicKeys;
  46686. target._p = prependModifier;
  46687. }
  46688. /* */
  46689. function FunctionalRenderContext (
  46690. data,
  46691. props,
  46692. children,
  46693. parent,
  46694. Ctor
  46695. ) {
  46696. var this$1 = this;
  46697. var options = Ctor.options;
  46698. // ensure the createElement function in functional components
  46699. // gets a unique context - this is necessary for correct named slot check
  46700. var contextVm;
  46701. if (hasOwn(parent, '_uid')) {
  46702. contextVm = Object.create(parent);
  46703. // $flow-disable-line
  46704. contextVm._original = parent;
  46705. } else {
  46706. // the context vm passed in is a functional context as well.
  46707. // in this case we want to make sure we are able to get a hold to the
  46708. // real context instance.
  46709. contextVm = parent;
  46710. // $flow-disable-line
  46711. parent = parent._original;
  46712. }
  46713. var isCompiled = isTrue(options._compiled);
  46714. var needNormalization = !isCompiled;
  46715. this.data = data;
  46716. this.props = props;
  46717. this.children = children;
  46718. this.parent = parent;
  46719. this.listeners = data.on || emptyObject;
  46720. this.injections = resolveInject(options.inject, parent);
  46721. this.slots = function () {
  46722. if (!this$1.$slots) {
  46723. normalizeScopedSlots(
  46724. data.scopedSlots,
  46725. this$1.$slots = resolveSlots(children, parent)
  46726. );
  46727. }
  46728. return this$1.$slots
  46729. };
  46730. Object.defineProperty(this, 'scopedSlots', ({
  46731. enumerable: true,
  46732. get: function get () {
  46733. return normalizeScopedSlots(data.scopedSlots, this.slots())
  46734. }
  46735. }));
  46736. // support for compiled functional template
  46737. if (isCompiled) {
  46738. // exposing $options for renderStatic()
  46739. this.$options = options;
  46740. // pre-resolve slots for renderSlot()
  46741. this.$slots = this.slots();
  46742. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  46743. }
  46744. if (options._scopeId) {
  46745. this._c = function (a, b, c, d) {
  46746. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  46747. if (vnode && !Array.isArray(vnode)) {
  46748. vnode.fnScopeId = options._scopeId;
  46749. vnode.fnContext = parent;
  46750. }
  46751. return vnode
  46752. };
  46753. } else {
  46754. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  46755. }
  46756. }
  46757. installRenderHelpers(FunctionalRenderContext.prototype);
  46758. function createFunctionalComponent (
  46759. Ctor,
  46760. propsData,
  46761. data,
  46762. contextVm,
  46763. children
  46764. ) {
  46765. var options = Ctor.options;
  46766. var props = {};
  46767. var propOptions = options.props;
  46768. if (isDef(propOptions)) {
  46769. for (var key in propOptions) {
  46770. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  46771. }
  46772. } else {
  46773. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  46774. if (isDef(data.props)) { mergeProps(props, data.props); }
  46775. }
  46776. var renderContext = new FunctionalRenderContext(
  46777. data,
  46778. props,
  46779. children,
  46780. contextVm,
  46781. Ctor
  46782. );
  46783. var vnode = options.render.call(null, renderContext._c, renderContext);
  46784. if (vnode instanceof VNode) {
  46785. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  46786. } else if (Array.isArray(vnode)) {
  46787. var vnodes = normalizeChildren(vnode) || [];
  46788. var res = new Array(vnodes.length);
  46789. for (var i = 0; i < vnodes.length; i++) {
  46790. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  46791. }
  46792. return res
  46793. }
  46794. }
  46795. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  46796. // #7817 clone node before setting fnContext, otherwise if the node is reused
  46797. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  46798. // that should not be matched to match.
  46799. var clone = cloneVNode(vnode);
  46800. clone.fnContext = contextVm;
  46801. clone.fnOptions = options;
  46802. {
  46803. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  46804. }
  46805. if (data.slot) {
  46806. (clone.data || (clone.data = {})).slot = data.slot;
  46807. }
  46808. return clone
  46809. }
  46810. function mergeProps (to, from) {
  46811. for (var key in from) {
  46812. to[camelize(key)] = from[key];
  46813. }
  46814. }
  46815. /* */
  46816. /* */
  46817. /* */
  46818. /* */
  46819. // inline hooks to be invoked on component VNodes during patch
  46820. var componentVNodeHooks = {
  46821. init: function init (vnode, hydrating) {
  46822. if (
  46823. vnode.componentInstance &&
  46824. !vnode.componentInstance._isDestroyed &&
  46825. vnode.data.keepAlive
  46826. ) {
  46827. // kept-alive components, treat as a patch
  46828. var mountedNode = vnode; // work around flow
  46829. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  46830. } else {
  46831. var child = vnode.componentInstance = createComponentInstanceForVnode(
  46832. vnode,
  46833. activeInstance
  46834. );
  46835. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  46836. }
  46837. },
  46838. prepatch: function prepatch (oldVnode, vnode) {
  46839. var options = vnode.componentOptions;
  46840. var child = vnode.componentInstance = oldVnode.componentInstance;
  46841. updateChildComponent(
  46842. child,
  46843. options.propsData, // updated props
  46844. options.listeners, // updated listeners
  46845. vnode, // new parent vnode
  46846. options.children // new children
  46847. );
  46848. },
  46849. insert: function insert (vnode) {
  46850. var context = vnode.context;
  46851. var componentInstance = vnode.componentInstance;
  46852. if (!componentInstance._isMounted) {
  46853. componentInstance._isMounted = true;
  46854. callHook(componentInstance, 'mounted');
  46855. }
  46856. if (vnode.data.keepAlive) {
  46857. if (context._isMounted) {
  46858. // vue-router#1212
  46859. // During updates, a kept-alive component's child components may
  46860. // change, so directly walking the tree here may call activated hooks
  46861. // on incorrect children. Instead we push them into a queue which will
  46862. // be processed after the whole patch process ended.
  46863. queueActivatedComponent(componentInstance);
  46864. } else {
  46865. activateChildComponent(componentInstance, true /* direct */);
  46866. }
  46867. }
  46868. },
  46869. destroy: function destroy (vnode) {
  46870. var componentInstance = vnode.componentInstance;
  46871. if (!componentInstance._isDestroyed) {
  46872. if (!vnode.data.keepAlive) {
  46873. componentInstance.$destroy();
  46874. } else {
  46875. deactivateChildComponent(componentInstance, true /* direct */);
  46876. }
  46877. }
  46878. }
  46879. };
  46880. var hooksToMerge = Object.keys(componentVNodeHooks);
  46881. function createComponent (
  46882. Ctor,
  46883. data,
  46884. context,
  46885. children,
  46886. tag
  46887. ) {
  46888. if (isUndef(Ctor)) {
  46889. return
  46890. }
  46891. var baseCtor = context.$options._base;
  46892. // plain options object: turn it into a constructor
  46893. if (isObject(Ctor)) {
  46894. Ctor = baseCtor.extend(Ctor);
  46895. }
  46896. // if at this stage it's not a constructor or an async component factory,
  46897. // reject.
  46898. if (typeof Ctor !== 'function') {
  46899. {
  46900. warn(("Invalid Component definition: " + (String(Ctor))), context);
  46901. }
  46902. return
  46903. }
  46904. // async component
  46905. var asyncFactory;
  46906. if (isUndef(Ctor.cid)) {
  46907. asyncFactory = Ctor;
  46908. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  46909. if (Ctor === undefined) {
  46910. // return a placeholder node for async component, which is rendered
  46911. // as a comment node but preserves all the raw information for the node.
  46912. // the information will be used for async server-rendering and hydration.
  46913. return createAsyncPlaceholder(
  46914. asyncFactory,
  46915. data,
  46916. context,
  46917. children,
  46918. tag
  46919. )
  46920. }
  46921. }
  46922. data = data || {};
  46923. // resolve constructor options in case global mixins are applied after
  46924. // component constructor creation
  46925. resolveConstructorOptions(Ctor);
  46926. // transform component v-model data into props & events
  46927. if (isDef(data.model)) {
  46928. transformModel(Ctor.options, data);
  46929. }
  46930. // extract props
  46931. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  46932. // functional component
  46933. if (isTrue(Ctor.options.functional)) {
  46934. return createFunctionalComponent(Ctor, propsData, data, context, children)
  46935. }
  46936. // extract listeners, since these needs to be treated as
  46937. // child component listeners instead of DOM listeners
  46938. var listeners = data.on;
  46939. // replace with listeners with .native modifier
  46940. // so it gets processed during parent component patch.
  46941. data.on = data.nativeOn;
  46942. if (isTrue(Ctor.options.abstract)) {
  46943. // abstract components do not keep anything
  46944. // other than props & listeners & slot
  46945. // work around flow
  46946. var slot = data.slot;
  46947. data = {};
  46948. if (slot) {
  46949. data.slot = slot;
  46950. }
  46951. }
  46952. // install component management hooks onto the placeholder node
  46953. installComponentHooks(data);
  46954. // return a placeholder vnode
  46955. var name = Ctor.options.name || tag;
  46956. var vnode = new VNode(
  46957. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  46958. data, undefined, undefined, undefined, context,
  46959. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  46960. asyncFactory
  46961. );
  46962. return vnode
  46963. }
  46964. function createComponentInstanceForVnode (
  46965. vnode, // we know it's MountedComponentVNode but flow doesn't
  46966. parent // activeInstance in lifecycle state
  46967. ) {
  46968. var options = {
  46969. _isComponent: true,
  46970. _parentVnode: vnode,
  46971. parent: parent
  46972. };
  46973. // check inline-template render functions
  46974. var inlineTemplate = vnode.data.inlineTemplate;
  46975. if (isDef(inlineTemplate)) {
  46976. options.render = inlineTemplate.render;
  46977. options.staticRenderFns = inlineTemplate.staticRenderFns;
  46978. }
  46979. return new vnode.componentOptions.Ctor(options)
  46980. }
  46981. function installComponentHooks (data) {
  46982. var hooks = data.hook || (data.hook = {});
  46983. for (var i = 0; i < hooksToMerge.length; i++) {
  46984. var key = hooksToMerge[i];
  46985. var existing = hooks[key];
  46986. var toMerge = componentVNodeHooks[key];
  46987. if (existing !== toMerge && !(existing && existing._merged)) {
  46988. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  46989. }
  46990. }
  46991. }
  46992. function mergeHook$1 (f1, f2) {
  46993. var merged = function (a, b) {
  46994. // flow complains about extra args which is why we use any
  46995. f1(a, b);
  46996. f2(a, b);
  46997. };
  46998. merged._merged = true;
  46999. return merged
  47000. }
  47001. // transform component v-model info (value and callback) into
  47002. // prop and event handler respectively.
  47003. function transformModel (options, data) {
  47004. var prop = (options.model && options.model.prop) || 'value';
  47005. var event = (options.model && options.model.event) || 'input'
  47006. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47007. var on = data.on || (data.on = {});
  47008. var existing = on[event];
  47009. var callback = data.model.callback;
  47010. if (isDef(existing)) {
  47011. if (
  47012. Array.isArray(existing)
  47013. ? existing.indexOf(callback) === -1
  47014. : existing !== callback
  47015. ) {
  47016. on[event] = [callback].concat(existing);
  47017. }
  47018. } else {
  47019. on[event] = callback;
  47020. }
  47021. }
  47022. /* */
  47023. var SIMPLE_NORMALIZE = 1;
  47024. var ALWAYS_NORMALIZE = 2;
  47025. // wrapper function for providing a more flexible interface
  47026. // without getting yelled at by flow
  47027. function createElement (
  47028. context,
  47029. tag,
  47030. data,
  47031. children,
  47032. normalizationType,
  47033. alwaysNormalize
  47034. ) {
  47035. if (Array.isArray(data) || isPrimitive(data)) {
  47036. normalizationType = children;
  47037. children = data;
  47038. data = undefined;
  47039. }
  47040. if (isTrue(alwaysNormalize)) {
  47041. normalizationType = ALWAYS_NORMALIZE;
  47042. }
  47043. return _createElement(context, tag, data, children, normalizationType)
  47044. }
  47045. function _createElement (
  47046. context,
  47047. tag,
  47048. data,
  47049. children,
  47050. normalizationType
  47051. ) {
  47052. if (isDef(data) && isDef((data).__ob__)) {
  47053. warn(
  47054. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47055. 'Always create fresh vnode data objects in each render!',
  47056. context
  47057. );
  47058. return createEmptyVNode()
  47059. }
  47060. // object syntax in v-bind
  47061. if (isDef(data) && isDef(data.is)) {
  47062. tag = data.is;
  47063. }
  47064. if (!tag) {
  47065. // in case of component :is set to falsy value
  47066. return createEmptyVNode()
  47067. }
  47068. // warn against non-primitive key
  47069. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47070. ) {
  47071. {
  47072. warn(
  47073. 'Avoid using non-primitive value as key, ' +
  47074. 'use string/number value instead.',
  47075. context
  47076. );
  47077. }
  47078. }
  47079. // support single function children as default scoped slot
  47080. if (Array.isArray(children) &&
  47081. typeof children[0] === 'function'
  47082. ) {
  47083. data = data || {};
  47084. data.scopedSlots = { default: children[0] };
  47085. children.length = 0;
  47086. }
  47087. if (normalizationType === ALWAYS_NORMALIZE) {
  47088. children = normalizeChildren(children);
  47089. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47090. children = simpleNormalizeChildren(children);
  47091. }
  47092. var vnode, ns;
  47093. if (typeof tag === 'string') {
  47094. var Ctor;
  47095. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47096. if (config.isReservedTag(tag)) {
  47097. // platform built-in elements
  47098. if (isDef(data) && isDef(data.nativeOn)) {
  47099. warn(
  47100. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47101. context
  47102. );
  47103. }
  47104. vnode = new VNode(
  47105. config.parsePlatformTagName(tag), data, children,
  47106. undefined, undefined, context
  47107. );
  47108. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47109. // component
  47110. vnode = createComponent(Ctor, data, context, children, tag);
  47111. } else {
  47112. // unknown or unlisted namespaced elements
  47113. // check at runtime because it may get assigned a namespace when its
  47114. // parent normalizes children
  47115. vnode = new VNode(
  47116. tag, data, children,
  47117. undefined, undefined, context
  47118. );
  47119. }
  47120. } else {
  47121. // direct component options / constructor
  47122. vnode = createComponent(tag, data, context, children);
  47123. }
  47124. if (Array.isArray(vnode)) {
  47125. return vnode
  47126. } else if (isDef(vnode)) {
  47127. if (isDef(ns)) { applyNS(vnode, ns); }
  47128. if (isDef(data)) { registerDeepBindings(data); }
  47129. return vnode
  47130. } else {
  47131. return createEmptyVNode()
  47132. }
  47133. }
  47134. function applyNS (vnode, ns, force) {
  47135. vnode.ns = ns;
  47136. if (vnode.tag === 'foreignObject') {
  47137. // use default namespace inside foreignObject
  47138. ns = undefined;
  47139. force = true;
  47140. }
  47141. if (isDef(vnode.children)) {
  47142. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47143. var child = vnode.children[i];
  47144. if (isDef(child.tag) && (
  47145. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47146. applyNS(child, ns, force);
  47147. }
  47148. }
  47149. }
  47150. }
  47151. // ref #5318
  47152. // necessary to ensure parent re-render when deep bindings like :style and
  47153. // :class are used on slot nodes
  47154. function registerDeepBindings (data) {
  47155. if (isObject(data.style)) {
  47156. traverse(data.style);
  47157. }
  47158. if (isObject(data.class)) {
  47159. traverse(data.class);
  47160. }
  47161. }
  47162. /* */
  47163. function initRender (vm) {
  47164. vm._vnode = null; // the root of the child tree
  47165. vm._staticTrees = null; // v-once cached trees
  47166. var options = vm.$options;
  47167. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47168. var renderContext = parentVnode && parentVnode.context;
  47169. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47170. vm.$scopedSlots = emptyObject;
  47171. // bind the createElement fn to this instance
  47172. // so that we get proper render context inside it.
  47173. // args order: tag, data, children, normalizationType, alwaysNormalize
  47174. // internal version is used by render functions compiled from templates
  47175. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47176. // normalization is always applied for the public version, used in
  47177. // user-written render functions.
  47178. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47179. // $attrs & $listeners are exposed for easier HOC creation.
  47180. // they need to be reactive so that HOCs using them are always updated
  47181. var parentData = parentVnode && parentVnode.data;
  47182. /* istanbul ignore else */
  47183. {
  47184. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47185. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47186. }, true);
  47187. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47188. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47189. }, true);
  47190. }
  47191. }
  47192. var currentRenderingInstance = null;
  47193. function renderMixin (Vue) {
  47194. // install runtime convenience helpers
  47195. installRenderHelpers(Vue.prototype);
  47196. Vue.prototype.$nextTick = function (fn) {
  47197. return nextTick(fn, this)
  47198. };
  47199. Vue.prototype._render = function () {
  47200. var vm = this;
  47201. var ref = vm.$options;
  47202. var render = ref.render;
  47203. var _parentVnode = ref._parentVnode;
  47204. if (_parentVnode) {
  47205. vm.$scopedSlots = normalizeScopedSlots(
  47206. _parentVnode.data.scopedSlots,
  47207. vm.$slots,
  47208. vm.$scopedSlots
  47209. );
  47210. }
  47211. // set parent vnode. this allows render functions to have access
  47212. // to the data on the placeholder node.
  47213. vm.$vnode = _parentVnode;
  47214. // render self
  47215. var vnode;
  47216. try {
  47217. // There's no need to maintain a stack because all render fns are called
  47218. // separately from one another. Nested component's render fns are called
  47219. // when parent component is patched.
  47220. currentRenderingInstance = vm;
  47221. vnode = render.call(vm._renderProxy, vm.$createElement);
  47222. } catch (e) {
  47223. handleError(e, vm, "render");
  47224. // return error render result,
  47225. // or previous vnode to prevent render error causing blank component
  47226. /* istanbul ignore else */
  47227. if (vm.$options.renderError) {
  47228. try {
  47229. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47230. } catch (e) {
  47231. handleError(e, vm, "renderError");
  47232. vnode = vm._vnode;
  47233. }
  47234. } else {
  47235. vnode = vm._vnode;
  47236. }
  47237. } finally {
  47238. currentRenderingInstance = null;
  47239. }
  47240. // if the returned array contains only a single node, allow it
  47241. if (Array.isArray(vnode) && vnode.length === 1) {
  47242. vnode = vnode[0];
  47243. }
  47244. // return empty vnode in case the render function errored out
  47245. if (!(vnode instanceof VNode)) {
  47246. if (Array.isArray(vnode)) {
  47247. warn(
  47248. 'Multiple root nodes returned from render function. Render function ' +
  47249. 'should return a single root node.',
  47250. vm
  47251. );
  47252. }
  47253. vnode = createEmptyVNode();
  47254. }
  47255. // set parent
  47256. vnode.parent = _parentVnode;
  47257. return vnode
  47258. };
  47259. }
  47260. /* */
  47261. function ensureCtor (comp, base) {
  47262. if (
  47263. comp.__esModule ||
  47264. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47265. ) {
  47266. comp = comp.default;
  47267. }
  47268. return isObject(comp)
  47269. ? base.extend(comp)
  47270. : comp
  47271. }
  47272. function createAsyncPlaceholder (
  47273. factory,
  47274. data,
  47275. context,
  47276. children,
  47277. tag
  47278. ) {
  47279. var node = createEmptyVNode();
  47280. node.asyncFactory = factory;
  47281. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47282. return node
  47283. }
  47284. function resolveAsyncComponent (
  47285. factory,
  47286. baseCtor
  47287. ) {
  47288. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47289. return factory.errorComp
  47290. }
  47291. if (isDef(factory.resolved)) {
  47292. return factory.resolved
  47293. }
  47294. var owner = currentRenderingInstance;
  47295. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47296. // already pending
  47297. factory.owners.push(owner);
  47298. }
  47299. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47300. return factory.loadingComp
  47301. }
  47302. if (owner && !isDef(factory.owners)) {
  47303. var owners = factory.owners = [owner];
  47304. var sync = true;
  47305. var timerLoading = null;
  47306. var timerTimeout = null
  47307. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47308. var forceRender = function (renderCompleted) {
  47309. for (var i = 0, l = owners.length; i < l; i++) {
  47310. (owners[i]).$forceUpdate();
  47311. }
  47312. if (renderCompleted) {
  47313. owners.length = 0;
  47314. if (timerLoading !== null) {
  47315. clearTimeout(timerLoading);
  47316. timerLoading = null;
  47317. }
  47318. if (timerTimeout !== null) {
  47319. clearTimeout(timerTimeout);
  47320. timerTimeout = null;
  47321. }
  47322. }
  47323. };
  47324. var resolve = once(function (res) {
  47325. // cache resolved
  47326. factory.resolved = ensureCtor(res, baseCtor);
  47327. // invoke callbacks only if this is not a synchronous resolve
  47328. // (async resolves are shimmed as synchronous during SSR)
  47329. if (!sync) {
  47330. forceRender(true);
  47331. } else {
  47332. owners.length = 0;
  47333. }
  47334. });
  47335. var reject = once(function (reason) {
  47336. warn(
  47337. "Failed to resolve async component: " + (String(factory)) +
  47338. (reason ? ("\nReason: " + reason) : '')
  47339. );
  47340. if (isDef(factory.errorComp)) {
  47341. factory.error = true;
  47342. forceRender(true);
  47343. }
  47344. });
  47345. var res = factory(resolve, reject);
  47346. if (isObject(res)) {
  47347. if (isPromise(res)) {
  47348. // () => Promise
  47349. if (isUndef(factory.resolved)) {
  47350. res.then(resolve, reject);
  47351. }
  47352. } else if (isPromise(res.component)) {
  47353. res.component.then(resolve, reject);
  47354. if (isDef(res.error)) {
  47355. factory.errorComp = ensureCtor(res.error, baseCtor);
  47356. }
  47357. if (isDef(res.loading)) {
  47358. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47359. if (res.delay === 0) {
  47360. factory.loading = true;
  47361. } else {
  47362. timerLoading = setTimeout(function () {
  47363. timerLoading = null;
  47364. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47365. factory.loading = true;
  47366. forceRender(false);
  47367. }
  47368. }, res.delay || 200);
  47369. }
  47370. }
  47371. if (isDef(res.timeout)) {
  47372. timerTimeout = setTimeout(function () {
  47373. timerTimeout = null;
  47374. if (isUndef(factory.resolved)) {
  47375. reject(
  47376. "timeout (" + (res.timeout) + "ms)"
  47377. );
  47378. }
  47379. }, res.timeout);
  47380. }
  47381. }
  47382. }
  47383. sync = false;
  47384. // return in case resolved synchronously
  47385. return factory.loading
  47386. ? factory.loadingComp
  47387. : factory.resolved
  47388. }
  47389. }
  47390. /* */
  47391. function isAsyncPlaceholder (node) {
  47392. return node.isComment && node.asyncFactory
  47393. }
  47394. /* */
  47395. function getFirstComponentChild (children) {
  47396. if (Array.isArray(children)) {
  47397. for (var i = 0; i < children.length; i++) {
  47398. var c = children[i];
  47399. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47400. return c
  47401. }
  47402. }
  47403. }
  47404. }
  47405. /* */
  47406. /* */
  47407. function initEvents (vm) {
  47408. vm._events = Object.create(null);
  47409. vm._hasHookEvent = false;
  47410. // init parent attached events
  47411. var listeners = vm.$options._parentListeners;
  47412. if (listeners) {
  47413. updateComponentListeners(vm, listeners);
  47414. }
  47415. }
  47416. var target;
  47417. function add (event, fn) {
  47418. target.$on(event, fn);
  47419. }
  47420. function remove$1 (event, fn) {
  47421. target.$off(event, fn);
  47422. }
  47423. function createOnceHandler (event, fn) {
  47424. var _target = target;
  47425. return function onceHandler () {
  47426. var res = fn.apply(null, arguments);
  47427. if (res !== null) {
  47428. _target.$off(event, onceHandler);
  47429. }
  47430. }
  47431. }
  47432. function updateComponentListeners (
  47433. vm,
  47434. listeners,
  47435. oldListeners
  47436. ) {
  47437. target = vm;
  47438. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47439. target = undefined;
  47440. }
  47441. function eventsMixin (Vue) {
  47442. var hookRE = /^hook:/;
  47443. Vue.prototype.$on = function (event, fn) {
  47444. var vm = this;
  47445. if (Array.isArray(event)) {
  47446. for (var i = 0, l = event.length; i < l; i++) {
  47447. vm.$on(event[i], fn);
  47448. }
  47449. } else {
  47450. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47451. // optimize hook:event cost by using a boolean flag marked at registration
  47452. // instead of a hash lookup
  47453. if (hookRE.test(event)) {
  47454. vm._hasHookEvent = true;
  47455. }
  47456. }
  47457. return vm
  47458. };
  47459. Vue.prototype.$once = function (event, fn) {
  47460. var vm = this;
  47461. function on () {
  47462. vm.$off(event, on);
  47463. fn.apply(vm, arguments);
  47464. }
  47465. on.fn = fn;
  47466. vm.$on(event, on);
  47467. return vm
  47468. };
  47469. Vue.prototype.$off = function (event, fn) {
  47470. var vm = this;
  47471. // all
  47472. if (!arguments.length) {
  47473. vm._events = Object.create(null);
  47474. return vm
  47475. }
  47476. // array of events
  47477. if (Array.isArray(event)) {
  47478. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  47479. vm.$off(event[i$1], fn);
  47480. }
  47481. return vm
  47482. }
  47483. // specific event
  47484. var cbs = vm._events[event];
  47485. if (!cbs) {
  47486. return vm
  47487. }
  47488. if (!fn) {
  47489. vm._events[event] = null;
  47490. return vm
  47491. }
  47492. // specific handler
  47493. var cb;
  47494. var i = cbs.length;
  47495. while (i--) {
  47496. cb = cbs[i];
  47497. if (cb === fn || cb.fn === fn) {
  47498. cbs.splice(i, 1);
  47499. break
  47500. }
  47501. }
  47502. return vm
  47503. };
  47504. Vue.prototype.$emit = function (event) {
  47505. var vm = this;
  47506. {
  47507. var lowerCaseEvent = event.toLowerCase();
  47508. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  47509. tip(
  47510. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  47511. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  47512. "Note that HTML attributes are case-insensitive and you cannot use " +
  47513. "v-on to listen to camelCase events when using in-DOM templates. " +
  47514. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  47515. );
  47516. }
  47517. }
  47518. var cbs = vm._events[event];
  47519. if (cbs) {
  47520. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  47521. var args = toArray(arguments, 1);
  47522. var info = "event handler for \"" + event + "\"";
  47523. for (var i = 0, l = cbs.length; i < l; i++) {
  47524. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  47525. }
  47526. }
  47527. return vm
  47528. };
  47529. }
  47530. /* */
  47531. var activeInstance = null;
  47532. var isUpdatingChildComponent = false;
  47533. function setActiveInstance(vm) {
  47534. var prevActiveInstance = activeInstance;
  47535. activeInstance = vm;
  47536. return function () {
  47537. activeInstance = prevActiveInstance;
  47538. }
  47539. }
  47540. function initLifecycle (vm) {
  47541. var options = vm.$options;
  47542. // locate first non-abstract parent
  47543. var parent = options.parent;
  47544. if (parent && !options.abstract) {
  47545. while (parent.$options.abstract && parent.$parent) {
  47546. parent = parent.$parent;
  47547. }
  47548. parent.$children.push(vm);
  47549. }
  47550. vm.$parent = parent;
  47551. vm.$root = parent ? parent.$root : vm;
  47552. vm.$children = [];
  47553. vm.$refs = {};
  47554. vm._watcher = null;
  47555. vm._inactive = null;
  47556. vm._directInactive = false;
  47557. vm._isMounted = false;
  47558. vm._isDestroyed = false;
  47559. vm._isBeingDestroyed = false;
  47560. }
  47561. function lifecycleMixin (Vue) {
  47562. Vue.prototype._update = function (vnode, hydrating) {
  47563. var vm = this;
  47564. var prevEl = vm.$el;
  47565. var prevVnode = vm._vnode;
  47566. var restoreActiveInstance = setActiveInstance(vm);
  47567. vm._vnode = vnode;
  47568. // Vue.prototype.__patch__ is injected in entry points
  47569. // based on the rendering backend used.
  47570. if (!prevVnode) {
  47571. // initial render
  47572. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  47573. } else {
  47574. // updates
  47575. vm.$el = vm.__patch__(prevVnode, vnode);
  47576. }
  47577. restoreActiveInstance();
  47578. // update __vue__ reference
  47579. if (prevEl) {
  47580. prevEl.__vue__ = null;
  47581. }
  47582. if (vm.$el) {
  47583. vm.$el.__vue__ = vm;
  47584. }
  47585. // if parent is an HOC, update its $el as well
  47586. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  47587. vm.$parent.$el = vm.$el;
  47588. }
  47589. // updated hook is called by the scheduler to ensure that children are
  47590. // updated in a parent's updated hook.
  47591. };
  47592. Vue.prototype.$forceUpdate = function () {
  47593. var vm = this;
  47594. if (vm._watcher) {
  47595. vm._watcher.update();
  47596. }
  47597. };
  47598. Vue.prototype.$destroy = function () {
  47599. var vm = this;
  47600. if (vm._isBeingDestroyed) {
  47601. return
  47602. }
  47603. callHook(vm, 'beforeDestroy');
  47604. vm._isBeingDestroyed = true;
  47605. // remove self from parent
  47606. var parent = vm.$parent;
  47607. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  47608. remove(parent.$children, vm);
  47609. }
  47610. // teardown watchers
  47611. if (vm._watcher) {
  47612. vm._watcher.teardown();
  47613. }
  47614. var i = vm._watchers.length;
  47615. while (i--) {
  47616. vm._watchers[i].teardown();
  47617. }
  47618. // remove reference from data ob
  47619. // frozen object may not have observer.
  47620. if (vm._data.__ob__) {
  47621. vm._data.__ob__.vmCount--;
  47622. }
  47623. // call the last hook...
  47624. vm._isDestroyed = true;
  47625. // invoke destroy hooks on current rendered tree
  47626. vm.__patch__(vm._vnode, null);
  47627. // fire destroyed hook
  47628. callHook(vm, 'destroyed');
  47629. // turn off all instance listeners.
  47630. vm.$off();
  47631. // remove __vue__ reference
  47632. if (vm.$el) {
  47633. vm.$el.__vue__ = null;
  47634. }
  47635. // release circular reference (#6759)
  47636. if (vm.$vnode) {
  47637. vm.$vnode.parent = null;
  47638. }
  47639. };
  47640. }
  47641. function mountComponent (
  47642. vm,
  47643. el,
  47644. hydrating
  47645. ) {
  47646. vm.$el = el;
  47647. if (!vm.$options.render) {
  47648. vm.$options.render = createEmptyVNode;
  47649. {
  47650. /* istanbul ignore if */
  47651. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  47652. vm.$options.el || el) {
  47653. warn(
  47654. 'You are using the runtime-only build of Vue where the template ' +
  47655. 'compiler is not available. Either pre-compile the templates into ' +
  47656. 'render functions, or use the compiler-included build.',
  47657. vm
  47658. );
  47659. } else {
  47660. warn(
  47661. 'Failed to mount component: template or render function not defined.',
  47662. vm
  47663. );
  47664. }
  47665. }
  47666. }
  47667. callHook(vm, 'beforeMount');
  47668. var updateComponent;
  47669. /* istanbul ignore if */
  47670. if (config.performance && mark) {
  47671. updateComponent = function () {
  47672. var name = vm._name;
  47673. var id = vm._uid;
  47674. var startTag = "vue-perf-start:" + id;
  47675. var endTag = "vue-perf-end:" + id;
  47676. mark(startTag);
  47677. var vnode = vm._render();
  47678. mark(endTag);
  47679. measure(("vue " + name + " render"), startTag, endTag);
  47680. mark(startTag);
  47681. vm._update(vnode, hydrating);
  47682. mark(endTag);
  47683. measure(("vue " + name + " patch"), startTag, endTag);
  47684. };
  47685. } else {
  47686. updateComponent = function () {
  47687. vm._update(vm._render(), hydrating);
  47688. };
  47689. }
  47690. // we set this to vm._watcher inside the watcher's constructor
  47691. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  47692. // component's mounted hook), which relies on vm._watcher being already defined
  47693. new Watcher(vm, updateComponent, noop, {
  47694. before: function before () {
  47695. if (vm._isMounted && !vm._isDestroyed) {
  47696. callHook(vm, 'beforeUpdate');
  47697. }
  47698. }
  47699. }, true /* isRenderWatcher */);
  47700. hydrating = false;
  47701. // manually mounted instance, call mounted on self
  47702. // mounted is called for render-created child components in its inserted hook
  47703. if (vm.$vnode == null) {
  47704. vm._isMounted = true;
  47705. callHook(vm, 'mounted');
  47706. }
  47707. return vm
  47708. }
  47709. function updateChildComponent (
  47710. vm,
  47711. propsData,
  47712. listeners,
  47713. parentVnode,
  47714. renderChildren
  47715. ) {
  47716. {
  47717. isUpdatingChildComponent = true;
  47718. }
  47719. // determine whether component has slot children
  47720. // we need to do this before overwriting $options._renderChildren.
  47721. // check if there are dynamic scopedSlots (hand-written or compiled but with
  47722. // dynamic slot names). Static scoped slots compiled from template has the
  47723. // "$stable" marker.
  47724. var newScopedSlots = parentVnode.data.scopedSlots;
  47725. var oldScopedSlots = vm.$scopedSlots;
  47726. var hasDynamicScopedSlot = !!(
  47727. (newScopedSlots && !newScopedSlots.$stable) ||
  47728. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  47729. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  47730. );
  47731. // Any static slot children from the parent may have changed during parent's
  47732. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  47733. // update is necessary to ensure correctness.
  47734. var needsForceUpdate = !!(
  47735. renderChildren || // has new static slots
  47736. vm.$options._renderChildren || // has old static slots
  47737. hasDynamicScopedSlot
  47738. );
  47739. vm.$options._parentVnode = parentVnode;
  47740. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  47741. if (vm._vnode) { // update child tree's parent
  47742. vm._vnode.parent = parentVnode;
  47743. }
  47744. vm.$options._renderChildren = renderChildren;
  47745. // update $attrs and $listeners hash
  47746. // these are also reactive so they may trigger child update if the child
  47747. // used them during render
  47748. vm.$attrs = parentVnode.data.attrs || emptyObject;
  47749. vm.$listeners = listeners || emptyObject;
  47750. // update props
  47751. if (propsData && vm.$options.props) {
  47752. toggleObserving(false);
  47753. var props = vm._props;
  47754. var propKeys = vm.$options._propKeys || [];
  47755. for (var i = 0; i < propKeys.length; i++) {
  47756. var key = propKeys[i];
  47757. var propOptions = vm.$options.props; // wtf flow?
  47758. props[key] = validateProp(key, propOptions, propsData, vm);
  47759. }
  47760. toggleObserving(true);
  47761. // keep a copy of raw propsData
  47762. vm.$options.propsData = propsData;
  47763. }
  47764. // update listeners
  47765. listeners = listeners || emptyObject;
  47766. var oldListeners = vm.$options._parentListeners;
  47767. vm.$options._parentListeners = listeners;
  47768. updateComponentListeners(vm, listeners, oldListeners);
  47769. // resolve slots + force update if has children
  47770. if (needsForceUpdate) {
  47771. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  47772. vm.$forceUpdate();
  47773. }
  47774. {
  47775. isUpdatingChildComponent = false;
  47776. }
  47777. }
  47778. function isInInactiveTree (vm) {
  47779. while (vm && (vm = vm.$parent)) {
  47780. if (vm._inactive) { return true }
  47781. }
  47782. return false
  47783. }
  47784. function activateChildComponent (vm, direct) {
  47785. if (direct) {
  47786. vm._directInactive = false;
  47787. if (isInInactiveTree(vm)) {
  47788. return
  47789. }
  47790. } else if (vm._directInactive) {
  47791. return
  47792. }
  47793. if (vm._inactive || vm._inactive === null) {
  47794. vm._inactive = false;
  47795. for (var i = 0; i < vm.$children.length; i++) {
  47796. activateChildComponent(vm.$children[i]);
  47797. }
  47798. callHook(vm, 'activated');
  47799. }
  47800. }
  47801. function deactivateChildComponent (vm, direct) {
  47802. if (direct) {
  47803. vm._directInactive = true;
  47804. if (isInInactiveTree(vm)) {
  47805. return
  47806. }
  47807. }
  47808. if (!vm._inactive) {
  47809. vm._inactive = true;
  47810. for (var i = 0; i < vm.$children.length; i++) {
  47811. deactivateChildComponent(vm.$children[i]);
  47812. }
  47813. callHook(vm, 'deactivated');
  47814. }
  47815. }
  47816. function callHook (vm, hook) {
  47817. // #7573 disable dep collection when invoking lifecycle hooks
  47818. pushTarget();
  47819. var handlers = vm.$options[hook];
  47820. var info = hook + " hook";
  47821. if (handlers) {
  47822. for (var i = 0, j = handlers.length; i < j; i++) {
  47823. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  47824. }
  47825. }
  47826. if (vm._hasHookEvent) {
  47827. vm.$emit('hook:' + hook);
  47828. }
  47829. popTarget();
  47830. }
  47831. /* */
  47832. var MAX_UPDATE_COUNT = 100;
  47833. var queue = [];
  47834. var activatedChildren = [];
  47835. var has = {};
  47836. var circular = {};
  47837. var waiting = false;
  47838. var flushing = false;
  47839. var index = 0;
  47840. /**
  47841. * Reset the scheduler's state.
  47842. */
  47843. function resetSchedulerState () {
  47844. index = queue.length = activatedChildren.length = 0;
  47845. has = {};
  47846. {
  47847. circular = {};
  47848. }
  47849. waiting = flushing = false;
  47850. }
  47851. // Async edge case #6566 requires saving the timestamp when event listeners are
  47852. // attached. However, calling performance.now() has a perf overhead especially
  47853. // if the page has thousands of event listeners. Instead, we take a timestamp
  47854. // every time the scheduler flushes and use that for all event listeners
  47855. // attached during that flush.
  47856. var currentFlushTimestamp = 0;
  47857. // Async edge case fix requires storing an event listener's attach timestamp.
  47858. var getNow = Date.now;
  47859. // Determine what event timestamp the browser is using. Annoyingly, the
  47860. // timestamp can either be hi-res (relative to page load) or low-res
  47861. // (relative to UNIX epoch), so in order to compare time we have to use the
  47862. // same timestamp type when saving the flush timestamp.
  47863. // All IE versions use low-res event timestamps, and have problematic clock
  47864. // implementations (#9632)
  47865. if (inBrowser && !isIE) {
  47866. var performance = window.performance;
  47867. if (
  47868. performance &&
  47869. typeof performance.now === 'function' &&
  47870. getNow() > document.createEvent('Event').timeStamp
  47871. ) {
  47872. // if the event timestamp, although evaluated AFTER the Date.now(), is
  47873. // smaller than it, it means the event is using a hi-res timestamp,
  47874. // and we need to use the hi-res version for event listener timestamps as
  47875. // well.
  47876. getNow = function () { return performance.now(); };
  47877. }
  47878. }
  47879. /**
  47880. * Flush both queues and run the watchers.
  47881. */
  47882. function flushSchedulerQueue () {
  47883. currentFlushTimestamp = getNow();
  47884. flushing = true;
  47885. var watcher, id;
  47886. // Sort queue before flush.
  47887. // This ensures that:
  47888. // 1. Components are updated from parent to child. (because parent is always
  47889. // created before the child)
  47890. // 2. A component's user watchers are run before its render watcher (because
  47891. // user watchers are created before the render watcher)
  47892. // 3. If a component is destroyed during a parent component's watcher run,
  47893. // its watchers can be skipped.
  47894. queue.sort(function (a, b) { return a.id - b.id; });
  47895. // do not cache length because more watchers might be pushed
  47896. // as we run existing watchers
  47897. for (index = 0; index < queue.length; index++) {
  47898. watcher = queue[index];
  47899. if (watcher.before) {
  47900. watcher.before();
  47901. }
  47902. id = watcher.id;
  47903. has[id] = null;
  47904. watcher.run();
  47905. // in dev build, check and stop circular updates.
  47906. if (has[id] != null) {
  47907. circular[id] = (circular[id] || 0) + 1;
  47908. if (circular[id] > MAX_UPDATE_COUNT) {
  47909. warn(
  47910. 'You may have an infinite update loop ' + (
  47911. watcher.user
  47912. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  47913. : "in a component render function."
  47914. ),
  47915. watcher.vm
  47916. );
  47917. break
  47918. }
  47919. }
  47920. }
  47921. // keep copies of post queues before resetting state
  47922. var activatedQueue = activatedChildren.slice();
  47923. var updatedQueue = queue.slice();
  47924. resetSchedulerState();
  47925. // call component updated and activated hooks
  47926. callActivatedHooks(activatedQueue);
  47927. callUpdatedHooks(updatedQueue);
  47928. // devtool hook
  47929. /* istanbul ignore if */
  47930. if (devtools && config.devtools) {
  47931. devtools.emit('flush');
  47932. }
  47933. }
  47934. function callUpdatedHooks (queue) {
  47935. var i = queue.length;
  47936. while (i--) {
  47937. var watcher = queue[i];
  47938. var vm = watcher.vm;
  47939. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  47940. callHook(vm, 'updated');
  47941. }
  47942. }
  47943. }
  47944. /**
  47945. * Queue a kept-alive component that was activated during patch.
  47946. * The queue will be processed after the entire tree has been patched.
  47947. */
  47948. function queueActivatedComponent (vm) {
  47949. // setting _inactive to false here so that a render function can
  47950. // rely on checking whether it's in an inactive tree (e.g. router-view)
  47951. vm._inactive = false;
  47952. activatedChildren.push(vm);
  47953. }
  47954. function callActivatedHooks (queue) {
  47955. for (var i = 0; i < queue.length; i++) {
  47956. queue[i]._inactive = true;
  47957. activateChildComponent(queue[i], true /* true */);
  47958. }
  47959. }
  47960. /**
  47961. * Push a watcher into the watcher queue.
  47962. * Jobs with duplicate IDs will be skipped unless it's
  47963. * pushed when the queue is being flushed.
  47964. */
  47965. function queueWatcher (watcher) {
  47966. var id = watcher.id;
  47967. if (has[id] == null) {
  47968. has[id] = true;
  47969. if (!flushing) {
  47970. queue.push(watcher);
  47971. } else {
  47972. // if already flushing, splice the watcher based on its id
  47973. // if already past its id, it will be run next immediately.
  47974. var i = queue.length - 1;
  47975. while (i > index && queue[i].id > watcher.id) {
  47976. i--;
  47977. }
  47978. queue.splice(i + 1, 0, watcher);
  47979. }
  47980. // queue the flush
  47981. if (!waiting) {
  47982. waiting = true;
  47983. if (!config.async) {
  47984. flushSchedulerQueue();
  47985. return
  47986. }
  47987. nextTick(flushSchedulerQueue);
  47988. }
  47989. }
  47990. }
  47991. /* */
  47992. var uid$2 = 0;
  47993. /**
  47994. * A watcher parses an expression, collects dependencies,
  47995. * and fires callback when the expression value changes.
  47996. * This is used for both the $watch() api and directives.
  47997. */
  47998. var Watcher = function Watcher (
  47999. vm,
  48000. expOrFn,
  48001. cb,
  48002. options,
  48003. isRenderWatcher
  48004. ) {
  48005. this.vm = vm;
  48006. if (isRenderWatcher) {
  48007. vm._watcher = this;
  48008. }
  48009. vm._watchers.push(this);
  48010. // options
  48011. if (options) {
  48012. this.deep = !!options.deep;
  48013. this.user = !!options.user;
  48014. this.lazy = !!options.lazy;
  48015. this.sync = !!options.sync;
  48016. this.before = options.before;
  48017. } else {
  48018. this.deep = this.user = this.lazy = this.sync = false;
  48019. }
  48020. this.cb = cb;
  48021. this.id = ++uid$2; // uid for batching
  48022. this.active = true;
  48023. this.dirty = this.lazy; // for lazy watchers
  48024. this.deps = [];
  48025. this.newDeps = [];
  48026. this.depIds = new _Set();
  48027. this.newDepIds = new _Set();
  48028. this.expression = expOrFn.toString();
  48029. // parse expression for getter
  48030. if (typeof expOrFn === 'function') {
  48031. this.getter = expOrFn;
  48032. } else {
  48033. this.getter = parsePath(expOrFn);
  48034. if (!this.getter) {
  48035. this.getter = noop;
  48036. warn(
  48037. "Failed watching path: \"" + expOrFn + "\" " +
  48038. 'Watcher only accepts simple dot-delimited paths. ' +
  48039. 'For full control, use a function instead.',
  48040. vm
  48041. );
  48042. }
  48043. }
  48044. this.value = this.lazy
  48045. ? undefined
  48046. : this.get();
  48047. };
  48048. /**
  48049. * Evaluate the getter, and re-collect dependencies.
  48050. */
  48051. Watcher.prototype.get = function get () {
  48052. pushTarget(this);
  48053. var value;
  48054. var vm = this.vm;
  48055. try {
  48056. value = this.getter.call(vm, vm);
  48057. } catch (e) {
  48058. if (this.user) {
  48059. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48060. } else {
  48061. throw e
  48062. }
  48063. } finally {
  48064. // "touch" every property so they are all tracked as
  48065. // dependencies for deep watching
  48066. if (this.deep) {
  48067. traverse(value);
  48068. }
  48069. popTarget();
  48070. this.cleanupDeps();
  48071. }
  48072. return value
  48073. };
  48074. /**
  48075. * Add a dependency to this directive.
  48076. */
  48077. Watcher.prototype.addDep = function addDep (dep) {
  48078. var id = dep.id;
  48079. if (!this.newDepIds.has(id)) {
  48080. this.newDepIds.add(id);
  48081. this.newDeps.push(dep);
  48082. if (!this.depIds.has(id)) {
  48083. dep.addSub(this);
  48084. }
  48085. }
  48086. };
  48087. /**
  48088. * Clean up for dependency collection.
  48089. */
  48090. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48091. var i = this.deps.length;
  48092. while (i--) {
  48093. var dep = this.deps[i];
  48094. if (!this.newDepIds.has(dep.id)) {
  48095. dep.removeSub(this);
  48096. }
  48097. }
  48098. var tmp = this.depIds;
  48099. this.depIds = this.newDepIds;
  48100. this.newDepIds = tmp;
  48101. this.newDepIds.clear();
  48102. tmp = this.deps;
  48103. this.deps = this.newDeps;
  48104. this.newDeps = tmp;
  48105. this.newDeps.length = 0;
  48106. };
  48107. /**
  48108. * Subscriber interface.
  48109. * Will be called when a dependency changes.
  48110. */
  48111. Watcher.prototype.update = function update () {
  48112. /* istanbul ignore else */
  48113. if (this.lazy) {
  48114. this.dirty = true;
  48115. } else if (this.sync) {
  48116. this.run();
  48117. } else {
  48118. queueWatcher(this);
  48119. }
  48120. };
  48121. /**
  48122. * Scheduler job interface.
  48123. * Will be called by the scheduler.
  48124. */
  48125. Watcher.prototype.run = function run () {
  48126. if (this.active) {
  48127. var value = this.get();
  48128. if (
  48129. value !== this.value ||
  48130. // Deep watchers and watchers on Object/Arrays should fire even
  48131. // when the value is the same, because the value may
  48132. // have mutated.
  48133. isObject(value) ||
  48134. this.deep
  48135. ) {
  48136. // set new value
  48137. var oldValue = this.value;
  48138. this.value = value;
  48139. if (this.user) {
  48140. try {
  48141. this.cb.call(this.vm, value, oldValue);
  48142. } catch (e) {
  48143. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48144. }
  48145. } else {
  48146. this.cb.call(this.vm, value, oldValue);
  48147. }
  48148. }
  48149. }
  48150. };
  48151. /**
  48152. * Evaluate the value of the watcher.
  48153. * This only gets called for lazy watchers.
  48154. */
  48155. Watcher.prototype.evaluate = function evaluate () {
  48156. this.value = this.get();
  48157. this.dirty = false;
  48158. };
  48159. /**
  48160. * Depend on all deps collected by this watcher.
  48161. */
  48162. Watcher.prototype.depend = function depend () {
  48163. var i = this.deps.length;
  48164. while (i--) {
  48165. this.deps[i].depend();
  48166. }
  48167. };
  48168. /**
  48169. * Remove self from all dependencies' subscriber list.
  48170. */
  48171. Watcher.prototype.teardown = function teardown () {
  48172. if (this.active) {
  48173. // remove self from vm's watcher list
  48174. // this is a somewhat expensive operation so we skip it
  48175. // if the vm is being destroyed.
  48176. if (!this.vm._isBeingDestroyed) {
  48177. remove(this.vm._watchers, this);
  48178. }
  48179. var i = this.deps.length;
  48180. while (i--) {
  48181. this.deps[i].removeSub(this);
  48182. }
  48183. this.active = false;
  48184. }
  48185. };
  48186. /* */
  48187. var sharedPropertyDefinition = {
  48188. enumerable: true,
  48189. configurable: true,
  48190. get: noop,
  48191. set: noop
  48192. };
  48193. function proxy (target, sourceKey, key) {
  48194. sharedPropertyDefinition.get = function proxyGetter () {
  48195. return this[sourceKey][key]
  48196. };
  48197. sharedPropertyDefinition.set = function proxySetter (val) {
  48198. this[sourceKey][key] = val;
  48199. };
  48200. Object.defineProperty(target, key, sharedPropertyDefinition);
  48201. }
  48202. function initState (vm) {
  48203. vm._watchers = [];
  48204. var opts = vm.$options;
  48205. if (opts.props) { initProps(vm, opts.props); }
  48206. if (opts.methods) { initMethods(vm, opts.methods); }
  48207. if (opts.data) {
  48208. initData(vm);
  48209. } else {
  48210. observe(vm._data = {}, true /* asRootData */);
  48211. }
  48212. if (opts.computed) { initComputed(vm, opts.computed); }
  48213. if (opts.watch && opts.watch !== nativeWatch) {
  48214. initWatch(vm, opts.watch);
  48215. }
  48216. }
  48217. function initProps (vm, propsOptions) {
  48218. var propsData = vm.$options.propsData || {};
  48219. var props = vm._props = {};
  48220. // cache prop keys so that future props updates can iterate using Array
  48221. // instead of dynamic object key enumeration.
  48222. var keys = vm.$options._propKeys = [];
  48223. var isRoot = !vm.$parent;
  48224. // root instance props should be converted
  48225. if (!isRoot) {
  48226. toggleObserving(false);
  48227. }
  48228. var loop = function ( key ) {
  48229. keys.push(key);
  48230. var value = validateProp(key, propsOptions, propsData, vm);
  48231. /* istanbul ignore else */
  48232. {
  48233. var hyphenatedKey = hyphenate(key);
  48234. if (isReservedAttribute(hyphenatedKey) ||
  48235. config.isReservedAttr(hyphenatedKey)) {
  48236. warn(
  48237. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48238. vm
  48239. );
  48240. }
  48241. defineReactive$$1(props, key, value, function () {
  48242. if (!isRoot && !isUpdatingChildComponent) {
  48243. warn(
  48244. "Avoid mutating a prop directly since the value will be " +
  48245. "overwritten whenever the parent component re-renders. " +
  48246. "Instead, use a data or computed property based on the prop's " +
  48247. "value. Prop being mutated: \"" + key + "\"",
  48248. vm
  48249. );
  48250. }
  48251. });
  48252. }
  48253. // static props are already proxied on the component's prototype
  48254. // during Vue.extend(). We only need to proxy props defined at
  48255. // instantiation here.
  48256. if (!(key in vm)) {
  48257. proxy(vm, "_props", key);
  48258. }
  48259. };
  48260. for (var key in propsOptions) loop( key );
  48261. toggleObserving(true);
  48262. }
  48263. function initData (vm) {
  48264. var data = vm.$options.data;
  48265. data = vm._data = typeof data === 'function'
  48266. ? getData(data, vm)
  48267. : data || {};
  48268. if (!isPlainObject(data)) {
  48269. data = {};
  48270. warn(
  48271. 'data functions should return an object:\n' +
  48272. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48273. vm
  48274. );
  48275. }
  48276. // proxy data on instance
  48277. var keys = Object.keys(data);
  48278. var props = vm.$options.props;
  48279. var methods = vm.$options.methods;
  48280. var i = keys.length;
  48281. while (i--) {
  48282. var key = keys[i];
  48283. {
  48284. if (methods && hasOwn(methods, key)) {
  48285. warn(
  48286. ("Method \"" + key + "\" has already been defined as a data property."),
  48287. vm
  48288. );
  48289. }
  48290. }
  48291. if (props && hasOwn(props, key)) {
  48292. warn(
  48293. "The data property \"" + key + "\" is already declared as a prop. " +
  48294. "Use prop default value instead.",
  48295. vm
  48296. );
  48297. } else if (!isReserved(key)) {
  48298. proxy(vm, "_data", key);
  48299. }
  48300. }
  48301. // observe data
  48302. observe(data, true /* asRootData */);
  48303. }
  48304. function getData (data, vm) {
  48305. // #7573 disable dep collection when invoking data getters
  48306. pushTarget();
  48307. try {
  48308. return data.call(vm, vm)
  48309. } catch (e) {
  48310. handleError(e, vm, "data()");
  48311. return {}
  48312. } finally {
  48313. popTarget();
  48314. }
  48315. }
  48316. var computedWatcherOptions = { lazy: true };
  48317. function initComputed (vm, computed) {
  48318. // $flow-disable-line
  48319. var watchers = vm._computedWatchers = Object.create(null);
  48320. // computed properties are just getters during SSR
  48321. var isSSR = isServerRendering();
  48322. for (var key in computed) {
  48323. var userDef = computed[key];
  48324. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48325. if (getter == null) {
  48326. warn(
  48327. ("Getter is missing for computed property \"" + key + "\"."),
  48328. vm
  48329. );
  48330. }
  48331. if (!isSSR) {
  48332. // create internal watcher for the computed property.
  48333. watchers[key] = new Watcher(
  48334. vm,
  48335. getter || noop,
  48336. noop,
  48337. computedWatcherOptions
  48338. );
  48339. }
  48340. // component-defined computed properties are already defined on the
  48341. // component prototype. We only need to define computed properties defined
  48342. // at instantiation here.
  48343. if (!(key in vm)) {
  48344. defineComputed(vm, key, userDef);
  48345. } else {
  48346. if (key in vm.$data) {
  48347. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48348. } else if (vm.$options.props && key in vm.$options.props) {
  48349. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48350. }
  48351. }
  48352. }
  48353. }
  48354. function defineComputed (
  48355. target,
  48356. key,
  48357. userDef
  48358. ) {
  48359. var shouldCache = !isServerRendering();
  48360. if (typeof userDef === 'function') {
  48361. sharedPropertyDefinition.get = shouldCache
  48362. ? createComputedGetter(key)
  48363. : createGetterInvoker(userDef);
  48364. sharedPropertyDefinition.set = noop;
  48365. } else {
  48366. sharedPropertyDefinition.get = userDef.get
  48367. ? shouldCache && userDef.cache !== false
  48368. ? createComputedGetter(key)
  48369. : createGetterInvoker(userDef.get)
  48370. : noop;
  48371. sharedPropertyDefinition.set = userDef.set || noop;
  48372. }
  48373. if (sharedPropertyDefinition.set === noop) {
  48374. sharedPropertyDefinition.set = function () {
  48375. warn(
  48376. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48377. this
  48378. );
  48379. };
  48380. }
  48381. Object.defineProperty(target, key, sharedPropertyDefinition);
  48382. }
  48383. function createComputedGetter (key) {
  48384. return function computedGetter () {
  48385. var watcher = this._computedWatchers && this._computedWatchers[key];
  48386. if (watcher) {
  48387. if (watcher.dirty) {
  48388. watcher.evaluate();
  48389. }
  48390. if (Dep.target) {
  48391. watcher.depend();
  48392. }
  48393. return watcher.value
  48394. }
  48395. }
  48396. }
  48397. function createGetterInvoker(fn) {
  48398. return function computedGetter () {
  48399. return fn.call(this, this)
  48400. }
  48401. }
  48402. function initMethods (vm, methods) {
  48403. var props = vm.$options.props;
  48404. for (var key in methods) {
  48405. {
  48406. if (typeof methods[key] !== 'function') {
  48407. warn(
  48408. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48409. "Did you reference the function correctly?",
  48410. vm
  48411. );
  48412. }
  48413. if (props && hasOwn(props, key)) {
  48414. warn(
  48415. ("Method \"" + key + "\" has already been defined as a prop."),
  48416. vm
  48417. );
  48418. }
  48419. if ((key in vm) && isReserved(key)) {
  48420. warn(
  48421. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48422. "Avoid defining component methods that start with _ or $."
  48423. );
  48424. }
  48425. }
  48426. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48427. }
  48428. }
  48429. function initWatch (vm, watch) {
  48430. for (var key in watch) {
  48431. var handler = watch[key];
  48432. if (Array.isArray(handler)) {
  48433. for (var i = 0; i < handler.length; i++) {
  48434. createWatcher(vm, key, handler[i]);
  48435. }
  48436. } else {
  48437. createWatcher(vm, key, handler);
  48438. }
  48439. }
  48440. }
  48441. function createWatcher (
  48442. vm,
  48443. expOrFn,
  48444. handler,
  48445. options
  48446. ) {
  48447. if (isPlainObject(handler)) {
  48448. options = handler;
  48449. handler = handler.handler;
  48450. }
  48451. if (typeof handler === 'string') {
  48452. handler = vm[handler];
  48453. }
  48454. return vm.$watch(expOrFn, handler, options)
  48455. }
  48456. function stateMixin (Vue) {
  48457. // flow somehow has problems with directly declared definition object
  48458. // when using Object.defineProperty, so we have to procedurally build up
  48459. // the object here.
  48460. var dataDef = {};
  48461. dataDef.get = function () { return this._data };
  48462. var propsDef = {};
  48463. propsDef.get = function () { return this._props };
  48464. {
  48465. dataDef.set = function () {
  48466. warn(
  48467. 'Avoid replacing instance root $data. ' +
  48468. 'Use nested data properties instead.',
  48469. this
  48470. );
  48471. };
  48472. propsDef.set = function () {
  48473. warn("$props is readonly.", this);
  48474. };
  48475. }
  48476. Object.defineProperty(Vue.prototype, '$data', dataDef);
  48477. Object.defineProperty(Vue.prototype, '$props', propsDef);
  48478. Vue.prototype.$set = set;
  48479. Vue.prototype.$delete = del;
  48480. Vue.prototype.$watch = function (
  48481. expOrFn,
  48482. cb,
  48483. options
  48484. ) {
  48485. var vm = this;
  48486. if (isPlainObject(cb)) {
  48487. return createWatcher(vm, expOrFn, cb, options)
  48488. }
  48489. options = options || {};
  48490. options.user = true;
  48491. var watcher = new Watcher(vm, expOrFn, cb, options);
  48492. if (options.immediate) {
  48493. try {
  48494. cb.call(vm, watcher.value);
  48495. } catch (error) {
  48496. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  48497. }
  48498. }
  48499. return function unwatchFn () {
  48500. watcher.teardown();
  48501. }
  48502. };
  48503. }
  48504. /* */
  48505. var uid$3 = 0;
  48506. function initMixin (Vue) {
  48507. Vue.prototype._init = function (options) {
  48508. var vm = this;
  48509. // a uid
  48510. vm._uid = uid$3++;
  48511. var startTag, endTag;
  48512. /* istanbul ignore if */
  48513. if (config.performance && mark) {
  48514. startTag = "vue-perf-start:" + (vm._uid);
  48515. endTag = "vue-perf-end:" + (vm._uid);
  48516. mark(startTag);
  48517. }
  48518. // a flag to avoid this being observed
  48519. vm._isVue = true;
  48520. // merge options
  48521. if (options && options._isComponent) {
  48522. // optimize internal component instantiation
  48523. // since dynamic options merging is pretty slow, and none of the
  48524. // internal component options needs special treatment.
  48525. initInternalComponent(vm, options);
  48526. } else {
  48527. vm.$options = mergeOptions(
  48528. resolveConstructorOptions(vm.constructor),
  48529. options || {},
  48530. vm
  48531. );
  48532. }
  48533. /* istanbul ignore else */
  48534. {
  48535. initProxy(vm);
  48536. }
  48537. // expose real self
  48538. vm._self = vm;
  48539. initLifecycle(vm);
  48540. initEvents(vm);
  48541. initRender(vm);
  48542. callHook(vm, 'beforeCreate');
  48543. initInjections(vm); // resolve injections before data/props
  48544. initState(vm);
  48545. initProvide(vm); // resolve provide after data/props
  48546. callHook(vm, 'created');
  48547. /* istanbul ignore if */
  48548. if (config.performance && mark) {
  48549. vm._name = formatComponentName(vm, false);
  48550. mark(endTag);
  48551. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  48552. }
  48553. if (vm.$options.el) {
  48554. vm.$mount(vm.$options.el);
  48555. }
  48556. };
  48557. }
  48558. function initInternalComponent (vm, options) {
  48559. var opts = vm.$options = Object.create(vm.constructor.options);
  48560. // doing this because it's faster than dynamic enumeration.
  48561. var parentVnode = options._parentVnode;
  48562. opts.parent = options.parent;
  48563. opts._parentVnode = parentVnode;
  48564. var vnodeComponentOptions = parentVnode.componentOptions;
  48565. opts.propsData = vnodeComponentOptions.propsData;
  48566. opts._parentListeners = vnodeComponentOptions.listeners;
  48567. opts._renderChildren = vnodeComponentOptions.children;
  48568. opts._componentTag = vnodeComponentOptions.tag;
  48569. if (options.render) {
  48570. opts.render = options.render;
  48571. opts.staticRenderFns = options.staticRenderFns;
  48572. }
  48573. }
  48574. function resolveConstructorOptions (Ctor) {
  48575. var options = Ctor.options;
  48576. if (Ctor.super) {
  48577. var superOptions = resolveConstructorOptions(Ctor.super);
  48578. var cachedSuperOptions = Ctor.superOptions;
  48579. if (superOptions !== cachedSuperOptions) {
  48580. // super option changed,
  48581. // need to resolve new options.
  48582. Ctor.superOptions = superOptions;
  48583. // check if there are any late-modified/attached options (#4976)
  48584. var modifiedOptions = resolveModifiedOptions(Ctor);
  48585. // update base extend options
  48586. if (modifiedOptions) {
  48587. extend(Ctor.extendOptions, modifiedOptions);
  48588. }
  48589. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  48590. if (options.name) {
  48591. options.components[options.name] = Ctor;
  48592. }
  48593. }
  48594. }
  48595. return options
  48596. }
  48597. function resolveModifiedOptions (Ctor) {
  48598. var modified;
  48599. var latest = Ctor.options;
  48600. var sealed = Ctor.sealedOptions;
  48601. for (var key in latest) {
  48602. if (latest[key] !== sealed[key]) {
  48603. if (!modified) { modified = {}; }
  48604. modified[key] = latest[key];
  48605. }
  48606. }
  48607. return modified
  48608. }
  48609. function Vue (options) {
  48610. if (!(this instanceof Vue)
  48611. ) {
  48612. warn('Vue is a constructor and should be called with the `new` keyword');
  48613. }
  48614. this._init(options);
  48615. }
  48616. initMixin(Vue);
  48617. stateMixin(Vue);
  48618. eventsMixin(Vue);
  48619. lifecycleMixin(Vue);
  48620. renderMixin(Vue);
  48621. /* */
  48622. function initUse (Vue) {
  48623. Vue.use = function (plugin) {
  48624. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  48625. if (installedPlugins.indexOf(plugin) > -1) {
  48626. return this
  48627. }
  48628. // additional parameters
  48629. var args = toArray(arguments, 1);
  48630. args.unshift(this);
  48631. if (typeof plugin.install === 'function') {
  48632. plugin.install.apply(plugin, args);
  48633. } else if (typeof plugin === 'function') {
  48634. plugin.apply(null, args);
  48635. }
  48636. installedPlugins.push(plugin);
  48637. return this
  48638. };
  48639. }
  48640. /* */
  48641. function initMixin$1 (Vue) {
  48642. Vue.mixin = function (mixin) {
  48643. this.options = mergeOptions(this.options, mixin);
  48644. return this
  48645. };
  48646. }
  48647. /* */
  48648. function initExtend (Vue) {
  48649. /**
  48650. * Each instance constructor, including Vue, has a unique
  48651. * cid. This enables us to create wrapped "child
  48652. * constructors" for prototypal inheritance and cache them.
  48653. */
  48654. Vue.cid = 0;
  48655. var cid = 1;
  48656. /**
  48657. * Class inheritance
  48658. */
  48659. Vue.extend = function (extendOptions) {
  48660. extendOptions = extendOptions || {};
  48661. var Super = this;
  48662. var SuperId = Super.cid;
  48663. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  48664. if (cachedCtors[SuperId]) {
  48665. return cachedCtors[SuperId]
  48666. }
  48667. var name = extendOptions.name || Super.options.name;
  48668. if (name) {
  48669. validateComponentName(name);
  48670. }
  48671. var Sub = function VueComponent (options) {
  48672. this._init(options);
  48673. };
  48674. Sub.prototype = Object.create(Super.prototype);
  48675. Sub.prototype.constructor = Sub;
  48676. Sub.cid = cid++;
  48677. Sub.options = mergeOptions(
  48678. Super.options,
  48679. extendOptions
  48680. );
  48681. Sub['super'] = Super;
  48682. // For props and computed properties, we define the proxy getters on
  48683. // the Vue instances at extension time, on the extended prototype. This
  48684. // avoids Object.defineProperty calls for each instance created.
  48685. if (Sub.options.props) {
  48686. initProps$1(Sub);
  48687. }
  48688. if (Sub.options.computed) {
  48689. initComputed$1(Sub);
  48690. }
  48691. // allow further extension/mixin/plugin usage
  48692. Sub.extend = Super.extend;
  48693. Sub.mixin = Super.mixin;
  48694. Sub.use = Super.use;
  48695. // create asset registers, so extended classes
  48696. // can have their private assets too.
  48697. ASSET_TYPES.forEach(function (type) {
  48698. Sub[type] = Super[type];
  48699. });
  48700. // enable recursive self-lookup
  48701. if (name) {
  48702. Sub.options.components[name] = Sub;
  48703. }
  48704. // keep a reference to the super options at extension time.
  48705. // later at instantiation we can check if Super's options have
  48706. // been updated.
  48707. Sub.superOptions = Super.options;
  48708. Sub.extendOptions = extendOptions;
  48709. Sub.sealedOptions = extend({}, Sub.options);
  48710. // cache constructor
  48711. cachedCtors[SuperId] = Sub;
  48712. return Sub
  48713. };
  48714. }
  48715. function initProps$1 (Comp) {
  48716. var props = Comp.options.props;
  48717. for (var key in props) {
  48718. proxy(Comp.prototype, "_props", key);
  48719. }
  48720. }
  48721. function initComputed$1 (Comp) {
  48722. var computed = Comp.options.computed;
  48723. for (var key in computed) {
  48724. defineComputed(Comp.prototype, key, computed[key]);
  48725. }
  48726. }
  48727. /* */
  48728. function initAssetRegisters (Vue) {
  48729. /**
  48730. * Create asset registration methods.
  48731. */
  48732. ASSET_TYPES.forEach(function (type) {
  48733. Vue[type] = function (
  48734. id,
  48735. definition
  48736. ) {
  48737. if (!definition) {
  48738. return this.options[type + 's'][id]
  48739. } else {
  48740. /* istanbul ignore if */
  48741. if (type === 'component') {
  48742. validateComponentName(id);
  48743. }
  48744. if (type === 'component' && isPlainObject(definition)) {
  48745. definition.name = definition.name || id;
  48746. definition = this.options._base.extend(definition);
  48747. }
  48748. if (type === 'directive' && typeof definition === 'function') {
  48749. definition = { bind: definition, update: definition };
  48750. }
  48751. this.options[type + 's'][id] = definition;
  48752. return definition
  48753. }
  48754. };
  48755. });
  48756. }
  48757. /* */
  48758. function getComponentName (opts) {
  48759. return opts && (opts.Ctor.options.name || opts.tag)
  48760. }
  48761. function matches (pattern, name) {
  48762. if (Array.isArray(pattern)) {
  48763. return pattern.indexOf(name) > -1
  48764. } else if (typeof pattern === 'string') {
  48765. return pattern.split(',').indexOf(name) > -1
  48766. } else if (isRegExp(pattern)) {
  48767. return pattern.test(name)
  48768. }
  48769. /* istanbul ignore next */
  48770. return false
  48771. }
  48772. function pruneCache (keepAliveInstance, filter) {
  48773. var cache = keepAliveInstance.cache;
  48774. var keys = keepAliveInstance.keys;
  48775. var _vnode = keepAliveInstance._vnode;
  48776. for (var key in cache) {
  48777. var cachedNode = cache[key];
  48778. if (cachedNode) {
  48779. var name = getComponentName(cachedNode.componentOptions);
  48780. if (name && !filter(name)) {
  48781. pruneCacheEntry(cache, key, keys, _vnode);
  48782. }
  48783. }
  48784. }
  48785. }
  48786. function pruneCacheEntry (
  48787. cache,
  48788. key,
  48789. keys,
  48790. current
  48791. ) {
  48792. var cached$$1 = cache[key];
  48793. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  48794. cached$$1.componentInstance.$destroy();
  48795. }
  48796. cache[key] = null;
  48797. remove(keys, key);
  48798. }
  48799. var patternTypes = [String, RegExp, Array];
  48800. var KeepAlive = {
  48801. name: 'keep-alive',
  48802. abstract: true,
  48803. props: {
  48804. include: patternTypes,
  48805. exclude: patternTypes,
  48806. max: [String, Number]
  48807. },
  48808. created: function created () {
  48809. this.cache = Object.create(null);
  48810. this.keys = [];
  48811. },
  48812. destroyed: function destroyed () {
  48813. for (var key in this.cache) {
  48814. pruneCacheEntry(this.cache, key, this.keys);
  48815. }
  48816. },
  48817. mounted: function mounted () {
  48818. var this$1 = this;
  48819. this.$watch('include', function (val) {
  48820. pruneCache(this$1, function (name) { return matches(val, name); });
  48821. });
  48822. this.$watch('exclude', function (val) {
  48823. pruneCache(this$1, function (name) { return !matches(val, name); });
  48824. });
  48825. },
  48826. render: function render () {
  48827. var slot = this.$slots.default;
  48828. var vnode = getFirstComponentChild(slot);
  48829. var componentOptions = vnode && vnode.componentOptions;
  48830. if (componentOptions) {
  48831. // check pattern
  48832. var name = getComponentName(componentOptions);
  48833. var ref = this;
  48834. var include = ref.include;
  48835. var exclude = ref.exclude;
  48836. if (
  48837. // not included
  48838. (include && (!name || !matches(include, name))) ||
  48839. // excluded
  48840. (exclude && name && matches(exclude, name))
  48841. ) {
  48842. return vnode
  48843. }
  48844. var ref$1 = this;
  48845. var cache = ref$1.cache;
  48846. var keys = ref$1.keys;
  48847. var key = vnode.key == null
  48848. // same constructor may get registered as different local components
  48849. // so cid alone is not enough (#3269)
  48850. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  48851. : vnode.key;
  48852. if (cache[key]) {
  48853. vnode.componentInstance = cache[key].componentInstance;
  48854. // make current key freshest
  48855. remove(keys, key);
  48856. keys.push(key);
  48857. } else {
  48858. cache[key] = vnode;
  48859. keys.push(key);
  48860. // prune oldest entry
  48861. if (this.max && keys.length > parseInt(this.max)) {
  48862. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  48863. }
  48864. }
  48865. vnode.data.keepAlive = true;
  48866. }
  48867. return vnode || (slot && slot[0])
  48868. }
  48869. };
  48870. var builtInComponents = {
  48871. KeepAlive: KeepAlive
  48872. };
  48873. /* */
  48874. function initGlobalAPI (Vue) {
  48875. // config
  48876. var configDef = {};
  48877. configDef.get = function () { return config; };
  48878. {
  48879. configDef.set = function () {
  48880. warn(
  48881. 'Do not replace the Vue.config object, set individual fields instead.'
  48882. );
  48883. };
  48884. }
  48885. Object.defineProperty(Vue, 'config', configDef);
  48886. // exposed util methods.
  48887. // NOTE: these are not considered part of the public API - avoid relying on
  48888. // them unless you are aware of the risk.
  48889. Vue.util = {
  48890. warn: warn,
  48891. extend: extend,
  48892. mergeOptions: mergeOptions,
  48893. defineReactive: defineReactive$$1
  48894. };
  48895. Vue.set = set;
  48896. Vue.delete = del;
  48897. Vue.nextTick = nextTick;
  48898. // 2.6 explicit observable API
  48899. Vue.observable = function (obj) {
  48900. observe(obj);
  48901. return obj
  48902. };
  48903. Vue.options = Object.create(null);
  48904. ASSET_TYPES.forEach(function (type) {
  48905. Vue.options[type + 's'] = Object.create(null);
  48906. });
  48907. // this is used to identify the "base" constructor to extend all plain-object
  48908. // components with in Weex's multi-instance scenarios.
  48909. Vue.options._base = Vue;
  48910. extend(Vue.options.components, builtInComponents);
  48911. initUse(Vue);
  48912. initMixin$1(Vue);
  48913. initExtend(Vue);
  48914. initAssetRegisters(Vue);
  48915. }
  48916. initGlobalAPI(Vue);
  48917. Object.defineProperty(Vue.prototype, '$isServer', {
  48918. get: isServerRendering
  48919. });
  48920. Object.defineProperty(Vue.prototype, '$ssrContext', {
  48921. get: function get () {
  48922. /* istanbul ignore next */
  48923. return this.$vnode && this.$vnode.ssrContext
  48924. }
  48925. });
  48926. // expose FunctionalRenderContext for ssr runtime helper installation
  48927. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  48928. value: FunctionalRenderContext
  48929. });
  48930. Vue.version = '2.6.11';
  48931. /* */
  48932. // these are reserved for web because they are directly compiled away
  48933. // during template compilation
  48934. var isReservedAttr = makeMap('style,class');
  48935. // attributes that should be using props for binding
  48936. var acceptValue = makeMap('input,textarea,option,select,progress');
  48937. var mustUseProp = function (tag, type, attr) {
  48938. return (
  48939. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  48940. (attr === 'selected' && tag === 'option') ||
  48941. (attr === 'checked' && tag === 'input') ||
  48942. (attr === 'muted' && tag === 'video')
  48943. )
  48944. };
  48945. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  48946. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  48947. var convertEnumeratedValue = function (key, value) {
  48948. return isFalsyAttrValue(value) || value === 'false'
  48949. ? 'false'
  48950. // allow arbitrary string value for contenteditable
  48951. : key === 'contenteditable' && isValidContentEditableValue(value)
  48952. ? value
  48953. : 'true'
  48954. };
  48955. var isBooleanAttr = makeMap(
  48956. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  48957. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  48958. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  48959. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  48960. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  48961. 'truespeed,typemustmatch,visible'
  48962. );
  48963. var xlinkNS = 'http://www.w3.org/1999/xlink';
  48964. var isXlink = function (name) {
  48965. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  48966. };
  48967. var getXlinkProp = function (name) {
  48968. return isXlink(name) ? name.slice(6, name.length) : ''
  48969. };
  48970. var isFalsyAttrValue = function (val) {
  48971. return val == null || val === false
  48972. };
  48973. /* */
  48974. function genClassForVnode (vnode) {
  48975. var data = vnode.data;
  48976. var parentNode = vnode;
  48977. var childNode = vnode;
  48978. while (isDef(childNode.componentInstance)) {
  48979. childNode = childNode.componentInstance._vnode;
  48980. if (childNode && childNode.data) {
  48981. data = mergeClassData(childNode.data, data);
  48982. }
  48983. }
  48984. while (isDef(parentNode = parentNode.parent)) {
  48985. if (parentNode && parentNode.data) {
  48986. data = mergeClassData(data, parentNode.data);
  48987. }
  48988. }
  48989. return renderClass(data.staticClass, data.class)
  48990. }
  48991. function mergeClassData (child, parent) {
  48992. return {
  48993. staticClass: concat(child.staticClass, parent.staticClass),
  48994. class: isDef(child.class)
  48995. ? [child.class, parent.class]
  48996. : parent.class
  48997. }
  48998. }
  48999. function renderClass (
  49000. staticClass,
  49001. dynamicClass
  49002. ) {
  49003. if (isDef(staticClass) || isDef(dynamicClass)) {
  49004. return concat(staticClass, stringifyClass(dynamicClass))
  49005. }
  49006. /* istanbul ignore next */
  49007. return ''
  49008. }
  49009. function concat (a, b) {
  49010. return a ? b ? (a + ' ' + b) : a : (b || '')
  49011. }
  49012. function stringifyClass (value) {
  49013. if (Array.isArray(value)) {
  49014. return stringifyArray(value)
  49015. }
  49016. if (isObject(value)) {
  49017. return stringifyObject(value)
  49018. }
  49019. if (typeof value === 'string') {
  49020. return value
  49021. }
  49022. /* istanbul ignore next */
  49023. return ''
  49024. }
  49025. function stringifyArray (value) {
  49026. var res = '';
  49027. var stringified;
  49028. for (var i = 0, l = value.length; i < l; i++) {
  49029. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49030. if (res) { res += ' '; }
  49031. res += stringified;
  49032. }
  49033. }
  49034. return res
  49035. }
  49036. function stringifyObject (value) {
  49037. var res = '';
  49038. for (var key in value) {
  49039. if (value[key]) {
  49040. if (res) { res += ' '; }
  49041. res += key;
  49042. }
  49043. }
  49044. return res
  49045. }
  49046. /* */
  49047. var namespaceMap = {
  49048. svg: 'http://www.w3.org/2000/svg',
  49049. math: 'http://www.w3.org/1998/Math/MathML'
  49050. };
  49051. var isHTMLTag = makeMap(
  49052. 'html,body,base,head,link,meta,style,title,' +
  49053. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49054. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49055. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49056. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49057. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49058. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49059. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49060. 'output,progress,select,textarea,' +
  49061. 'details,dialog,menu,menuitem,summary,' +
  49062. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49063. );
  49064. // this map is intentionally selective, only covering SVG elements that may
  49065. // contain child elements.
  49066. var isSVG = makeMap(
  49067. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49068. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49069. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49070. true
  49071. );
  49072. var isPreTag = function (tag) { return tag === 'pre'; };
  49073. var isReservedTag = function (tag) {
  49074. return isHTMLTag(tag) || isSVG(tag)
  49075. };
  49076. function getTagNamespace (tag) {
  49077. if (isSVG(tag)) {
  49078. return 'svg'
  49079. }
  49080. // basic support for MathML
  49081. // note it doesn't support other MathML elements being component roots
  49082. if (tag === 'math') {
  49083. return 'math'
  49084. }
  49085. }
  49086. var unknownElementCache = Object.create(null);
  49087. function isUnknownElement (tag) {
  49088. /* istanbul ignore if */
  49089. if (!inBrowser) {
  49090. return true
  49091. }
  49092. if (isReservedTag(tag)) {
  49093. return false
  49094. }
  49095. tag = tag.toLowerCase();
  49096. /* istanbul ignore if */
  49097. if (unknownElementCache[tag] != null) {
  49098. return unknownElementCache[tag]
  49099. }
  49100. var el = document.createElement(tag);
  49101. if (tag.indexOf('-') > -1) {
  49102. // http://stackoverflow.com/a/28210364/1070244
  49103. return (unknownElementCache[tag] = (
  49104. el.constructor === window.HTMLUnknownElement ||
  49105. el.constructor === window.HTMLElement
  49106. ))
  49107. } else {
  49108. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49109. }
  49110. }
  49111. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49112. /* */
  49113. /**
  49114. * Query an element selector if it's not an element already.
  49115. */
  49116. function query (el) {
  49117. if (typeof el === 'string') {
  49118. var selected = document.querySelector(el);
  49119. if (!selected) {
  49120. warn(
  49121. 'Cannot find element: ' + el
  49122. );
  49123. return document.createElement('div')
  49124. }
  49125. return selected
  49126. } else {
  49127. return el
  49128. }
  49129. }
  49130. /* */
  49131. function createElement$1 (tagName, vnode) {
  49132. var elm = document.createElement(tagName);
  49133. if (tagName !== 'select') {
  49134. return elm
  49135. }
  49136. // false or null will remove the attribute but undefined will not
  49137. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49138. elm.setAttribute('multiple', 'multiple');
  49139. }
  49140. return elm
  49141. }
  49142. function createElementNS (namespace, tagName) {
  49143. return document.createElementNS(namespaceMap[namespace], tagName)
  49144. }
  49145. function createTextNode (text) {
  49146. return document.createTextNode(text)
  49147. }
  49148. function createComment (text) {
  49149. return document.createComment(text)
  49150. }
  49151. function insertBefore (parentNode, newNode, referenceNode) {
  49152. parentNode.insertBefore(newNode, referenceNode);
  49153. }
  49154. function removeChild (node, child) {
  49155. node.removeChild(child);
  49156. }
  49157. function appendChild (node, child) {
  49158. node.appendChild(child);
  49159. }
  49160. function parentNode (node) {
  49161. return node.parentNode
  49162. }
  49163. function nextSibling (node) {
  49164. return node.nextSibling
  49165. }
  49166. function tagName (node) {
  49167. return node.tagName
  49168. }
  49169. function setTextContent (node, text) {
  49170. node.textContent = text;
  49171. }
  49172. function setStyleScope (node, scopeId) {
  49173. node.setAttribute(scopeId, '');
  49174. }
  49175. var nodeOps = /*#__PURE__*/Object.freeze({
  49176. createElement: createElement$1,
  49177. createElementNS: createElementNS,
  49178. createTextNode: createTextNode,
  49179. createComment: createComment,
  49180. insertBefore: insertBefore,
  49181. removeChild: removeChild,
  49182. appendChild: appendChild,
  49183. parentNode: parentNode,
  49184. nextSibling: nextSibling,
  49185. tagName: tagName,
  49186. setTextContent: setTextContent,
  49187. setStyleScope: setStyleScope
  49188. });
  49189. /* */
  49190. var ref = {
  49191. create: function create (_, vnode) {
  49192. registerRef(vnode);
  49193. },
  49194. update: function update (oldVnode, vnode) {
  49195. if (oldVnode.data.ref !== vnode.data.ref) {
  49196. registerRef(oldVnode, true);
  49197. registerRef(vnode);
  49198. }
  49199. },
  49200. destroy: function destroy (vnode) {
  49201. registerRef(vnode, true);
  49202. }
  49203. };
  49204. function registerRef (vnode, isRemoval) {
  49205. var key = vnode.data.ref;
  49206. if (!isDef(key)) { return }
  49207. var vm = vnode.context;
  49208. var ref = vnode.componentInstance || vnode.elm;
  49209. var refs = vm.$refs;
  49210. if (isRemoval) {
  49211. if (Array.isArray(refs[key])) {
  49212. remove(refs[key], ref);
  49213. } else if (refs[key] === ref) {
  49214. refs[key] = undefined;
  49215. }
  49216. } else {
  49217. if (vnode.data.refInFor) {
  49218. if (!Array.isArray(refs[key])) {
  49219. refs[key] = [ref];
  49220. } else if (refs[key].indexOf(ref) < 0) {
  49221. // $flow-disable-line
  49222. refs[key].push(ref);
  49223. }
  49224. } else {
  49225. refs[key] = ref;
  49226. }
  49227. }
  49228. }
  49229. /**
  49230. * Virtual DOM patching algorithm based on Snabbdom by
  49231. * Simon Friis Vindum (@paldepind)
  49232. * Licensed under the MIT License
  49233. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49234. *
  49235. * modified by Evan You (@yyx990803)
  49236. *
  49237. * Not type-checking this because this file is perf-critical and the cost
  49238. * of making flow understand it is not worth it.
  49239. */
  49240. var emptyNode = new VNode('', {}, []);
  49241. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49242. function sameVnode (a, b) {
  49243. return (
  49244. a.key === b.key && (
  49245. (
  49246. a.tag === b.tag &&
  49247. a.isComment === b.isComment &&
  49248. isDef(a.data) === isDef(b.data) &&
  49249. sameInputType(a, b)
  49250. ) || (
  49251. isTrue(a.isAsyncPlaceholder) &&
  49252. a.asyncFactory === b.asyncFactory &&
  49253. isUndef(b.asyncFactory.error)
  49254. )
  49255. )
  49256. )
  49257. }
  49258. function sameInputType (a, b) {
  49259. if (a.tag !== 'input') { return true }
  49260. var i;
  49261. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49262. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49263. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49264. }
  49265. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49266. var i, key;
  49267. var map = {};
  49268. for (i = beginIdx; i <= endIdx; ++i) {
  49269. key = children[i].key;
  49270. if (isDef(key)) { map[key] = i; }
  49271. }
  49272. return map
  49273. }
  49274. function createPatchFunction (backend) {
  49275. var i, j;
  49276. var cbs = {};
  49277. var modules = backend.modules;
  49278. var nodeOps = backend.nodeOps;
  49279. for (i = 0; i < hooks.length; ++i) {
  49280. cbs[hooks[i]] = [];
  49281. for (j = 0; j < modules.length; ++j) {
  49282. if (isDef(modules[j][hooks[i]])) {
  49283. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49284. }
  49285. }
  49286. }
  49287. function emptyNodeAt (elm) {
  49288. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49289. }
  49290. function createRmCb (childElm, listeners) {
  49291. function remove$$1 () {
  49292. if (--remove$$1.listeners === 0) {
  49293. removeNode(childElm);
  49294. }
  49295. }
  49296. remove$$1.listeners = listeners;
  49297. return remove$$1
  49298. }
  49299. function removeNode (el) {
  49300. var parent = nodeOps.parentNode(el);
  49301. // element may have already been removed due to v-html / v-text
  49302. if (isDef(parent)) {
  49303. nodeOps.removeChild(parent, el);
  49304. }
  49305. }
  49306. function isUnknownElement$$1 (vnode, inVPre) {
  49307. return (
  49308. !inVPre &&
  49309. !vnode.ns &&
  49310. !(
  49311. config.ignoredElements.length &&
  49312. config.ignoredElements.some(function (ignore) {
  49313. return isRegExp(ignore)
  49314. ? ignore.test(vnode.tag)
  49315. : ignore === vnode.tag
  49316. })
  49317. ) &&
  49318. config.isUnknownElement(vnode.tag)
  49319. )
  49320. }
  49321. var creatingElmInVPre = 0;
  49322. function createElm (
  49323. vnode,
  49324. insertedVnodeQueue,
  49325. parentElm,
  49326. refElm,
  49327. nested,
  49328. ownerArray,
  49329. index
  49330. ) {
  49331. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49332. // This vnode was used in a previous render!
  49333. // now it's used as a new node, overwriting its elm would cause
  49334. // potential patch errors down the road when it's used as an insertion
  49335. // reference node. Instead, we clone the node on-demand before creating
  49336. // associated DOM element for it.
  49337. vnode = ownerArray[index] = cloneVNode(vnode);
  49338. }
  49339. vnode.isRootInsert = !nested; // for transition enter check
  49340. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49341. return
  49342. }
  49343. var data = vnode.data;
  49344. var children = vnode.children;
  49345. var tag = vnode.tag;
  49346. if (isDef(tag)) {
  49347. {
  49348. if (data && data.pre) {
  49349. creatingElmInVPre++;
  49350. }
  49351. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49352. warn(
  49353. 'Unknown custom element: <' + tag + '> - did you ' +
  49354. 'register the component correctly? For recursive components, ' +
  49355. 'make sure to provide the "name" option.',
  49356. vnode.context
  49357. );
  49358. }
  49359. }
  49360. vnode.elm = vnode.ns
  49361. ? nodeOps.createElementNS(vnode.ns, tag)
  49362. : nodeOps.createElement(tag, vnode);
  49363. setScope(vnode);
  49364. /* istanbul ignore if */
  49365. {
  49366. createChildren(vnode, children, insertedVnodeQueue);
  49367. if (isDef(data)) {
  49368. invokeCreateHooks(vnode, insertedVnodeQueue);
  49369. }
  49370. insert(parentElm, vnode.elm, refElm);
  49371. }
  49372. if (data && data.pre) {
  49373. creatingElmInVPre--;
  49374. }
  49375. } else if (isTrue(vnode.isComment)) {
  49376. vnode.elm = nodeOps.createComment(vnode.text);
  49377. insert(parentElm, vnode.elm, refElm);
  49378. } else {
  49379. vnode.elm = nodeOps.createTextNode(vnode.text);
  49380. insert(parentElm, vnode.elm, refElm);
  49381. }
  49382. }
  49383. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49384. var i = vnode.data;
  49385. if (isDef(i)) {
  49386. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49387. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49388. i(vnode, false /* hydrating */);
  49389. }
  49390. // after calling the init hook, if the vnode is a child component
  49391. // it should've created a child instance and mounted it. the child
  49392. // component also has set the placeholder vnode's elm.
  49393. // in that case we can just return the element and be done.
  49394. if (isDef(vnode.componentInstance)) {
  49395. initComponent(vnode, insertedVnodeQueue);
  49396. insert(parentElm, vnode.elm, refElm);
  49397. if (isTrue(isReactivated)) {
  49398. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49399. }
  49400. return true
  49401. }
  49402. }
  49403. }
  49404. function initComponent (vnode, insertedVnodeQueue) {
  49405. if (isDef(vnode.data.pendingInsert)) {
  49406. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49407. vnode.data.pendingInsert = null;
  49408. }
  49409. vnode.elm = vnode.componentInstance.$el;
  49410. if (isPatchable(vnode)) {
  49411. invokeCreateHooks(vnode, insertedVnodeQueue);
  49412. setScope(vnode);
  49413. } else {
  49414. // empty component root.
  49415. // skip all element-related modules except for ref (#3455)
  49416. registerRef(vnode);
  49417. // make sure to invoke the insert hook
  49418. insertedVnodeQueue.push(vnode);
  49419. }
  49420. }
  49421. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49422. var i;
  49423. // hack for #4339: a reactivated component with inner transition
  49424. // does not trigger because the inner node's created hooks are not called
  49425. // again. It's not ideal to involve module-specific logic in here but
  49426. // there doesn't seem to be a better way to do it.
  49427. var innerNode = vnode;
  49428. while (innerNode.componentInstance) {
  49429. innerNode = innerNode.componentInstance._vnode;
  49430. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49431. for (i = 0; i < cbs.activate.length; ++i) {
  49432. cbs.activate[i](emptyNode, innerNode);
  49433. }
  49434. insertedVnodeQueue.push(innerNode);
  49435. break
  49436. }
  49437. }
  49438. // unlike a newly created component,
  49439. // a reactivated keep-alive component doesn't insert itself
  49440. insert(parentElm, vnode.elm, refElm);
  49441. }
  49442. function insert (parent, elm, ref$$1) {
  49443. if (isDef(parent)) {
  49444. if (isDef(ref$$1)) {
  49445. if (nodeOps.parentNode(ref$$1) === parent) {
  49446. nodeOps.insertBefore(parent, elm, ref$$1);
  49447. }
  49448. } else {
  49449. nodeOps.appendChild(parent, elm);
  49450. }
  49451. }
  49452. }
  49453. function createChildren (vnode, children, insertedVnodeQueue) {
  49454. if (Array.isArray(children)) {
  49455. {
  49456. checkDuplicateKeys(children);
  49457. }
  49458. for (var i = 0; i < children.length; ++i) {
  49459. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49460. }
  49461. } else if (isPrimitive(vnode.text)) {
  49462. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49463. }
  49464. }
  49465. function isPatchable (vnode) {
  49466. while (vnode.componentInstance) {
  49467. vnode = vnode.componentInstance._vnode;
  49468. }
  49469. return isDef(vnode.tag)
  49470. }
  49471. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  49472. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49473. cbs.create[i$1](emptyNode, vnode);
  49474. }
  49475. i = vnode.data.hook; // Reuse variable
  49476. if (isDef(i)) {
  49477. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  49478. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  49479. }
  49480. }
  49481. // set scope id attribute for scoped CSS.
  49482. // this is implemented as a special case to avoid the overhead
  49483. // of going through the normal attribute patching process.
  49484. function setScope (vnode) {
  49485. var i;
  49486. if (isDef(i = vnode.fnScopeId)) {
  49487. nodeOps.setStyleScope(vnode.elm, i);
  49488. } else {
  49489. var ancestor = vnode;
  49490. while (ancestor) {
  49491. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  49492. nodeOps.setStyleScope(vnode.elm, i);
  49493. }
  49494. ancestor = ancestor.parent;
  49495. }
  49496. }
  49497. // for slot content they should also get the scopeId from the host instance.
  49498. if (isDef(i = activeInstance) &&
  49499. i !== vnode.context &&
  49500. i !== vnode.fnContext &&
  49501. isDef(i = i.$options._scopeId)
  49502. ) {
  49503. nodeOps.setStyleScope(vnode.elm, i);
  49504. }
  49505. }
  49506. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  49507. for (; startIdx <= endIdx; ++startIdx) {
  49508. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  49509. }
  49510. }
  49511. function invokeDestroyHook (vnode) {
  49512. var i, j;
  49513. var data = vnode.data;
  49514. if (isDef(data)) {
  49515. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  49516. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  49517. }
  49518. if (isDef(i = vnode.children)) {
  49519. for (j = 0; j < vnode.children.length; ++j) {
  49520. invokeDestroyHook(vnode.children[j]);
  49521. }
  49522. }
  49523. }
  49524. function removeVnodes (vnodes, startIdx, endIdx) {
  49525. for (; startIdx <= endIdx; ++startIdx) {
  49526. var ch = vnodes[startIdx];
  49527. if (isDef(ch)) {
  49528. if (isDef(ch.tag)) {
  49529. removeAndInvokeRemoveHook(ch);
  49530. invokeDestroyHook(ch);
  49531. } else { // Text node
  49532. removeNode(ch.elm);
  49533. }
  49534. }
  49535. }
  49536. }
  49537. function removeAndInvokeRemoveHook (vnode, rm) {
  49538. if (isDef(rm) || isDef(vnode.data)) {
  49539. var i;
  49540. var listeners = cbs.remove.length + 1;
  49541. if (isDef(rm)) {
  49542. // we have a recursively passed down rm callback
  49543. // increase the listeners count
  49544. rm.listeners += listeners;
  49545. } else {
  49546. // directly removing
  49547. rm = createRmCb(vnode.elm, listeners);
  49548. }
  49549. // recursively invoke hooks on child component root node
  49550. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  49551. removeAndInvokeRemoveHook(i, rm);
  49552. }
  49553. for (i = 0; i < cbs.remove.length; ++i) {
  49554. cbs.remove[i](vnode, rm);
  49555. }
  49556. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  49557. i(vnode, rm);
  49558. } else {
  49559. rm();
  49560. }
  49561. } else {
  49562. removeNode(vnode.elm);
  49563. }
  49564. }
  49565. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  49566. var oldStartIdx = 0;
  49567. var newStartIdx = 0;
  49568. var oldEndIdx = oldCh.length - 1;
  49569. var oldStartVnode = oldCh[0];
  49570. var oldEndVnode = oldCh[oldEndIdx];
  49571. var newEndIdx = newCh.length - 1;
  49572. var newStartVnode = newCh[0];
  49573. var newEndVnode = newCh[newEndIdx];
  49574. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  49575. // removeOnly is a special flag used only by <transition-group>
  49576. // to ensure removed elements stay in correct relative positions
  49577. // during leaving transitions
  49578. var canMove = !removeOnly;
  49579. {
  49580. checkDuplicateKeys(newCh);
  49581. }
  49582. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  49583. if (isUndef(oldStartVnode)) {
  49584. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  49585. } else if (isUndef(oldEndVnode)) {
  49586. oldEndVnode = oldCh[--oldEndIdx];
  49587. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  49588. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49589. oldStartVnode = oldCh[++oldStartIdx];
  49590. newStartVnode = newCh[++newStartIdx];
  49591. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  49592. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49593. oldEndVnode = oldCh[--oldEndIdx];
  49594. newEndVnode = newCh[--newEndIdx];
  49595. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  49596. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49597. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  49598. oldStartVnode = oldCh[++oldStartIdx];
  49599. newEndVnode = newCh[--newEndIdx];
  49600. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  49601. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49602. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  49603. oldEndVnode = oldCh[--oldEndIdx];
  49604. newStartVnode = newCh[++newStartIdx];
  49605. } else {
  49606. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  49607. idxInOld = isDef(newStartVnode.key)
  49608. ? oldKeyToIdx[newStartVnode.key]
  49609. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  49610. if (isUndef(idxInOld)) { // New element
  49611. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49612. } else {
  49613. vnodeToMove = oldCh[idxInOld];
  49614. if (sameVnode(vnodeToMove, newStartVnode)) {
  49615. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49616. oldCh[idxInOld] = undefined;
  49617. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  49618. } else {
  49619. // same key but different element. treat as new element
  49620. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49621. }
  49622. }
  49623. newStartVnode = newCh[++newStartIdx];
  49624. }
  49625. }
  49626. if (oldStartIdx > oldEndIdx) {
  49627. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  49628. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  49629. } else if (newStartIdx > newEndIdx) {
  49630. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  49631. }
  49632. }
  49633. function checkDuplicateKeys (children) {
  49634. var seenKeys = {};
  49635. for (var i = 0; i < children.length; i++) {
  49636. var vnode = children[i];
  49637. var key = vnode.key;
  49638. if (isDef(key)) {
  49639. if (seenKeys[key]) {
  49640. warn(
  49641. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  49642. vnode.context
  49643. );
  49644. } else {
  49645. seenKeys[key] = true;
  49646. }
  49647. }
  49648. }
  49649. }
  49650. function findIdxInOld (node, oldCh, start, end) {
  49651. for (var i = start; i < end; i++) {
  49652. var c = oldCh[i];
  49653. if (isDef(c) && sameVnode(node, c)) { return i }
  49654. }
  49655. }
  49656. function patchVnode (
  49657. oldVnode,
  49658. vnode,
  49659. insertedVnodeQueue,
  49660. ownerArray,
  49661. index,
  49662. removeOnly
  49663. ) {
  49664. if (oldVnode === vnode) {
  49665. return
  49666. }
  49667. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49668. // clone reused vnode
  49669. vnode = ownerArray[index] = cloneVNode(vnode);
  49670. }
  49671. var elm = vnode.elm = oldVnode.elm;
  49672. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  49673. if (isDef(vnode.asyncFactory.resolved)) {
  49674. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  49675. } else {
  49676. vnode.isAsyncPlaceholder = true;
  49677. }
  49678. return
  49679. }
  49680. // reuse element for static trees.
  49681. // note we only do this if the vnode is cloned -
  49682. // if the new node is not cloned it means the render functions have been
  49683. // reset by the hot-reload-api and we need to do a proper re-render.
  49684. if (isTrue(vnode.isStatic) &&
  49685. isTrue(oldVnode.isStatic) &&
  49686. vnode.key === oldVnode.key &&
  49687. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  49688. ) {
  49689. vnode.componentInstance = oldVnode.componentInstance;
  49690. return
  49691. }
  49692. var i;
  49693. var data = vnode.data;
  49694. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  49695. i(oldVnode, vnode);
  49696. }
  49697. var oldCh = oldVnode.children;
  49698. var ch = vnode.children;
  49699. if (isDef(data) && isPatchable(vnode)) {
  49700. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  49701. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  49702. }
  49703. if (isUndef(vnode.text)) {
  49704. if (isDef(oldCh) && isDef(ch)) {
  49705. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  49706. } else if (isDef(ch)) {
  49707. {
  49708. checkDuplicateKeys(ch);
  49709. }
  49710. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  49711. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  49712. } else if (isDef(oldCh)) {
  49713. removeVnodes(oldCh, 0, oldCh.length - 1);
  49714. } else if (isDef(oldVnode.text)) {
  49715. nodeOps.setTextContent(elm, '');
  49716. }
  49717. } else if (oldVnode.text !== vnode.text) {
  49718. nodeOps.setTextContent(elm, vnode.text);
  49719. }
  49720. if (isDef(data)) {
  49721. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  49722. }
  49723. }
  49724. function invokeInsertHook (vnode, queue, initial) {
  49725. // delay insert hooks for component root nodes, invoke them after the
  49726. // element is really inserted
  49727. if (isTrue(initial) && isDef(vnode.parent)) {
  49728. vnode.parent.data.pendingInsert = queue;
  49729. } else {
  49730. for (var i = 0; i < queue.length; ++i) {
  49731. queue[i].data.hook.insert(queue[i]);
  49732. }
  49733. }
  49734. }
  49735. var hydrationBailed = false;
  49736. // list of modules that can skip create hook during hydration because they
  49737. // are already rendered on the client or has no need for initialization
  49738. // Note: style is excluded because it relies on initial clone for future
  49739. // deep updates (#7063).
  49740. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  49741. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  49742. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  49743. var i;
  49744. var tag = vnode.tag;
  49745. var data = vnode.data;
  49746. var children = vnode.children;
  49747. inVPre = inVPre || (data && data.pre);
  49748. vnode.elm = elm;
  49749. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  49750. vnode.isAsyncPlaceholder = true;
  49751. return true
  49752. }
  49753. // assert node match
  49754. {
  49755. if (!assertNodeMatch(elm, vnode, inVPre)) {
  49756. return false
  49757. }
  49758. }
  49759. if (isDef(data)) {
  49760. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  49761. if (isDef(i = vnode.componentInstance)) {
  49762. // child component. it should have hydrated its own tree.
  49763. initComponent(vnode, insertedVnodeQueue);
  49764. return true
  49765. }
  49766. }
  49767. if (isDef(tag)) {
  49768. if (isDef(children)) {
  49769. // empty element, allow client to pick up and populate children
  49770. if (!elm.hasChildNodes()) {
  49771. createChildren(vnode, children, insertedVnodeQueue);
  49772. } else {
  49773. // v-html and domProps: innerHTML
  49774. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  49775. if (i !== elm.innerHTML) {
  49776. /* istanbul ignore if */
  49777. if (typeof console !== 'undefined' &&
  49778. !hydrationBailed
  49779. ) {
  49780. hydrationBailed = true;
  49781. console.warn('Parent: ', elm);
  49782. console.warn('server innerHTML: ', i);
  49783. console.warn('client innerHTML: ', elm.innerHTML);
  49784. }
  49785. return false
  49786. }
  49787. } else {
  49788. // iterate and compare children lists
  49789. var childrenMatch = true;
  49790. var childNode = elm.firstChild;
  49791. for (var i$1 = 0; i$1 < children.length; i$1++) {
  49792. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  49793. childrenMatch = false;
  49794. break
  49795. }
  49796. childNode = childNode.nextSibling;
  49797. }
  49798. // if childNode is not null, it means the actual childNodes list is
  49799. // longer than the virtual children list.
  49800. if (!childrenMatch || childNode) {
  49801. /* istanbul ignore if */
  49802. if (typeof console !== 'undefined' &&
  49803. !hydrationBailed
  49804. ) {
  49805. hydrationBailed = true;
  49806. console.warn('Parent: ', elm);
  49807. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  49808. }
  49809. return false
  49810. }
  49811. }
  49812. }
  49813. }
  49814. if (isDef(data)) {
  49815. var fullInvoke = false;
  49816. for (var key in data) {
  49817. if (!isRenderedModule(key)) {
  49818. fullInvoke = true;
  49819. invokeCreateHooks(vnode, insertedVnodeQueue);
  49820. break
  49821. }
  49822. }
  49823. if (!fullInvoke && data['class']) {
  49824. // ensure collecting deps for deep class bindings for future updates
  49825. traverse(data['class']);
  49826. }
  49827. }
  49828. } else if (elm.data !== vnode.text) {
  49829. elm.data = vnode.text;
  49830. }
  49831. return true
  49832. }
  49833. function assertNodeMatch (node, vnode, inVPre) {
  49834. if (isDef(vnode.tag)) {
  49835. return vnode.tag.indexOf('vue-component') === 0 || (
  49836. !isUnknownElement$$1(vnode, inVPre) &&
  49837. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  49838. )
  49839. } else {
  49840. return node.nodeType === (vnode.isComment ? 8 : 3)
  49841. }
  49842. }
  49843. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  49844. if (isUndef(vnode)) {
  49845. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  49846. return
  49847. }
  49848. var isInitialPatch = false;
  49849. var insertedVnodeQueue = [];
  49850. if (isUndef(oldVnode)) {
  49851. // empty mount (likely as component), create new root element
  49852. isInitialPatch = true;
  49853. createElm(vnode, insertedVnodeQueue);
  49854. } else {
  49855. var isRealElement = isDef(oldVnode.nodeType);
  49856. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  49857. // patch existing root node
  49858. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  49859. } else {
  49860. if (isRealElement) {
  49861. // mounting to a real element
  49862. // check if this is server-rendered content and if we can perform
  49863. // a successful hydration.
  49864. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  49865. oldVnode.removeAttribute(SSR_ATTR);
  49866. hydrating = true;
  49867. }
  49868. if (isTrue(hydrating)) {
  49869. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  49870. invokeInsertHook(vnode, insertedVnodeQueue, true);
  49871. return oldVnode
  49872. } else {
  49873. warn(
  49874. 'The client-side rendered virtual DOM tree is not matching ' +
  49875. 'server-rendered content. This is likely caused by incorrect ' +
  49876. 'HTML markup, for example nesting block-level elements inside ' +
  49877. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  49878. 'full client-side render.'
  49879. );
  49880. }
  49881. }
  49882. // either not server-rendered, or hydration failed.
  49883. // create an empty node and replace it
  49884. oldVnode = emptyNodeAt(oldVnode);
  49885. }
  49886. // replacing existing element
  49887. var oldElm = oldVnode.elm;
  49888. var parentElm = nodeOps.parentNode(oldElm);
  49889. // create new node
  49890. createElm(
  49891. vnode,
  49892. insertedVnodeQueue,
  49893. // extremely rare edge case: do not insert if old element is in a
  49894. // leaving transition. Only happens when combining transition +
  49895. // keep-alive + HOCs. (#4590)
  49896. oldElm._leaveCb ? null : parentElm,
  49897. nodeOps.nextSibling(oldElm)
  49898. );
  49899. // update parent placeholder node element, recursively
  49900. if (isDef(vnode.parent)) {
  49901. var ancestor = vnode.parent;
  49902. var patchable = isPatchable(vnode);
  49903. while (ancestor) {
  49904. for (var i = 0; i < cbs.destroy.length; ++i) {
  49905. cbs.destroy[i](ancestor);
  49906. }
  49907. ancestor.elm = vnode.elm;
  49908. if (patchable) {
  49909. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49910. cbs.create[i$1](emptyNode, ancestor);
  49911. }
  49912. // #6513
  49913. // invoke insert hooks that may have been merged by create hooks.
  49914. // e.g. for directives that uses the "inserted" hook.
  49915. var insert = ancestor.data.hook.insert;
  49916. if (insert.merged) {
  49917. // start at index 1 to avoid re-invoking component mounted hook
  49918. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  49919. insert.fns[i$2]();
  49920. }
  49921. }
  49922. } else {
  49923. registerRef(ancestor);
  49924. }
  49925. ancestor = ancestor.parent;
  49926. }
  49927. }
  49928. // destroy old node
  49929. if (isDef(parentElm)) {
  49930. removeVnodes([oldVnode], 0, 0);
  49931. } else if (isDef(oldVnode.tag)) {
  49932. invokeDestroyHook(oldVnode);
  49933. }
  49934. }
  49935. }
  49936. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  49937. return vnode.elm
  49938. }
  49939. }
  49940. /* */
  49941. var directives = {
  49942. create: updateDirectives,
  49943. update: updateDirectives,
  49944. destroy: function unbindDirectives (vnode) {
  49945. updateDirectives(vnode, emptyNode);
  49946. }
  49947. };
  49948. function updateDirectives (oldVnode, vnode) {
  49949. if (oldVnode.data.directives || vnode.data.directives) {
  49950. _update(oldVnode, vnode);
  49951. }
  49952. }
  49953. function _update (oldVnode, vnode) {
  49954. var isCreate = oldVnode === emptyNode;
  49955. var isDestroy = vnode === emptyNode;
  49956. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  49957. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  49958. var dirsWithInsert = [];
  49959. var dirsWithPostpatch = [];
  49960. var key, oldDir, dir;
  49961. for (key in newDirs) {
  49962. oldDir = oldDirs[key];
  49963. dir = newDirs[key];
  49964. if (!oldDir) {
  49965. // new directive, bind
  49966. callHook$1(dir, 'bind', vnode, oldVnode);
  49967. if (dir.def && dir.def.inserted) {
  49968. dirsWithInsert.push(dir);
  49969. }
  49970. } else {
  49971. // existing directive, update
  49972. dir.oldValue = oldDir.value;
  49973. dir.oldArg = oldDir.arg;
  49974. callHook$1(dir, 'update', vnode, oldVnode);
  49975. if (dir.def && dir.def.componentUpdated) {
  49976. dirsWithPostpatch.push(dir);
  49977. }
  49978. }
  49979. }
  49980. if (dirsWithInsert.length) {
  49981. var callInsert = function () {
  49982. for (var i = 0; i < dirsWithInsert.length; i++) {
  49983. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  49984. }
  49985. };
  49986. if (isCreate) {
  49987. mergeVNodeHook(vnode, 'insert', callInsert);
  49988. } else {
  49989. callInsert();
  49990. }
  49991. }
  49992. if (dirsWithPostpatch.length) {
  49993. mergeVNodeHook(vnode, 'postpatch', function () {
  49994. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  49995. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  49996. }
  49997. });
  49998. }
  49999. if (!isCreate) {
  50000. for (key in oldDirs) {
  50001. if (!newDirs[key]) {
  50002. // no longer present, unbind
  50003. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50004. }
  50005. }
  50006. }
  50007. }
  50008. var emptyModifiers = Object.create(null);
  50009. function normalizeDirectives$1 (
  50010. dirs,
  50011. vm
  50012. ) {
  50013. var res = Object.create(null);
  50014. if (!dirs) {
  50015. // $flow-disable-line
  50016. return res
  50017. }
  50018. var i, dir;
  50019. for (i = 0; i < dirs.length; i++) {
  50020. dir = dirs[i];
  50021. if (!dir.modifiers) {
  50022. // $flow-disable-line
  50023. dir.modifiers = emptyModifiers;
  50024. }
  50025. res[getRawDirName(dir)] = dir;
  50026. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50027. }
  50028. // $flow-disable-line
  50029. return res
  50030. }
  50031. function getRawDirName (dir) {
  50032. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50033. }
  50034. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50035. var fn = dir.def && dir.def[hook];
  50036. if (fn) {
  50037. try {
  50038. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50039. } catch (e) {
  50040. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50041. }
  50042. }
  50043. }
  50044. var baseModules = [
  50045. ref,
  50046. directives
  50047. ];
  50048. /* */
  50049. function updateAttrs (oldVnode, vnode) {
  50050. var opts = vnode.componentOptions;
  50051. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50052. return
  50053. }
  50054. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50055. return
  50056. }
  50057. var key, cur, old;
  50058. var elm = vnode.elm;
  50059. var oldAttrs = oldVnode.data.attrs || {};
  50060. var attrs = vnode.data.attrs || {};
  50061. // clone observed objects, as the user probably wants to mutate it
  50062. if (isDef(attrs.__ob__)) {
  50063. attrs = vnode.data.attrs = extend({}, attrs);
  50064. }
  50065. for (key in attrs) {
  50066. cur = attrs[key];
  50067. old = oldAttrs[key];
  50068. if (old !== cur) {
  50069. setAttr(elm, key, cur);
  50070. }
  50071. }
  50072. // #4391: in IE9, setting type can reset value for input[type=radio]
  50073. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50074. /* istanbul ignore if */
  50075. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50076. setAttr(elm, 'value', attrs.value);
  50077. }
  50078. for (key in oldAttrs) {
  50079. if (isUndef(attrs[key])) {
  50080. if (isXlink(key)) {
  50081. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50082. } else if (!isEnumeratedAttr(key)) {
  50083. elm.removeAttribute(key);
  50084. }
  50085. }
  50086. }
  50087. }
  50088. function setAttr (el, key, value) {
  50089. if (el.tagName.indexOf('-') > -1) {
  50090. baseSetAttr(el, key, value);
  50091. } else if (isBooleanAttr(key)) {
  50092. // set attribute for blank value
  50093. // e.g. <option disabled>Select one</option>
  50094. if (isFalsyAttrValue(value)) {
  50095. el.removeAttribute(key);
  50096. } else {
  50097. // technically allowfullscreen is a boolean attribute for <iframe>,
  50098. // but Flash expects a value of "true" when used on <embed> tag
  50099. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50100. ? 'true'
  50101. : key;
  50102. el.setAttribute(key, value);
  50103. }
  50104. } else if (isEnumeratedAttr(key)) {
  50105. el.setAttribute(key, convertEnumeratedValue(key, value));
  50106. } else if (isXlink(key)) {
  50107. if (isFalsyAttrValue(value)) {
  50108. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50109. } else {
  50110. el.setAttributeNS(xlinkNS, key, value);
  50111. }
  50112. } else {
  50113. baseSetAttr(el, key, value);
  50114. }
  50115. }
  50116. function baseSetAttr (el, key, value) {
  50117. if (isFalsyAttrValue(value)) {
  50118. el.removeAttribute(key);
  50119. } else {
  50120. // #7138: IE10 & 11 fires input event when setting placeholder on
  50121. // <textarea>... block the first input event and remove the blocker
  50122. // immediately.
  50123. /* istanbul ignore if */
  50124. if (
  50125. isIE && !isIE9 &&
  50126. el.tagName === 'TEXTAREA' &&
  50127. key === 'placeholder' && value !== '' && !el.__ieph
  50128. ) {
  50129. var blocker = function (e) {
  50130. e.stopImmediatePropagation();
  50131. el.removeEventListener('input', blocker);
  50132. };
  50133. el.addEventListener('input', blocker);
  50134. // $flow-disable-line
  50135. el.__ieph = true; /* IE placeholder patched */
  50136. }
  50137. el.setAttribute(key, value);
  50138. }
  50139. }
  50140. var attrs = {
  50141. create: updateAttrs,
  50142. update: updateAttrs
  50143. };
  50144. /* */
  50145. function updateClass (oldVnode, vnode) {
  50146. var el = vnode.elm;
  50147. var data = vnode.data;
  50148. var oldData = oldVnode.data;
  50149. if (
  50150. isUndef(data.staticClass) &&
  50151. isUndef(data.class) && (
  50152. isUndef(oldData) || (
  50153. isUndef(oldData.staticClass) &&
  50154. isUndef(oldData.class)
  50155. )
  50156. )
  50157. ) {
  50158. return
  50159. }
  50160. var cls = genClassForVnode(vnode);
  50161. // handle transition classes
  50162. var transitionClass = el._transitionClasses;
  50163. if (isDef(transitionClass)) {
  50164. cls = concat(cls, stringifyClass(transitionClass));
  50165. }
  50166. // set the class
  50167. if (cls !== el._prevClass) {
  50168. el.setAttribute('class', cls);
  50169. el._prevClass = cls;
  50170. }
  50171. }
  50172. var klass = {
  50173. create: updateClass,
  50174. update: updateClass
  50175. };
  50176. /* */
  50177. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50178. function parseFilters (exp) {
  50179. var inSingle = false;
  50180. var inDouble = false;
  50181. var inTemplateString = false;
  50182. var inRegex = false;
  50183. var curly = 0;
  50184. var square = 0;
  50185. var paren = 0;
  50186. var lastFilterIndex = 0;
  50187. var c, prev, i, expression, filters;
  50188. for (i = 0; i < exp.length; i++) {
  50189. prev = c;
  50190. c = exp.charCodeAt(i);
  50191. if (inSingle) {
  50192. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50193. } else if (inDouble) {
  50194. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50195. } else if (inTemplateString) {
  50196. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50197. } else if (inRegex) {
  50198. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50199. } else if (
  50200. c === 0x7C && // pipe
  50201. exp.charCodeAt(i + 1) !== 0x7C &&
  50202. exp.charCodeAt(i - 1) !== 0x7C &&
  50203. !curly && !square && !paren
  50204. ) {
  50205. if (expression === undefined) {
  50206. // first filter, end of expression
  50207. lastFilterIndex = i + 1;
  50208. expression = exp.slice(0, i).trim();
  50209. } else {
  50210. pushFilter();
  50211. }
  50212. } else {
  50213. switch (c) {
  50214. case 0x22: inDouble = true; break // "
  50215. case 0x27: inSingle = true; break // '
  50216. case 0x60: inTemplateString = true; break // `
  50217. case 0x28: paren++; break // (
  50218. case 0x29: paren--; break // )
  50219. case 0x5B: square++; break // [
  50220. case 0x5D: square--; break // ]
  50221. case 0x7B: curly++; break // {
  50222. case 0x7D: curly--; break // }
  50223. }
  50224. if (c === 0x2f) { // /
  50225. var j = i - 1;
  50226. var p = (void 0);
  50227. // find first non-whitespace prev char
  50228. for (; j >= 0; j--) {
  50229. p = exp.charAt(j);
  50230. if (p !== ' ') { break }
  50231. }
  50232. if (!p || !validDivisionCharRE.test(p)) {
  50233. inRegex = true;
  50234. }
  50235. }
  50236. }
  50237. }
  50238. if (expression === undefined) {
  50239. expression = exp.slice(0, i).trim();
  50240. } else if (lastFilterIndex !== 0) {
  50241. pushFilter();
  50242. }
  50243. function pushFilter () {
  50244. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50245. lastFilterIndex = i + 1;
  50246. }
  50247. if (filters) {
  50248. for (i = 0; i < filters.length; i++) {
  50249. expression = wrapFilter(expression, filters[i]);
  50250. }
  50251. }
  50252. return expression
  50253. }
  50254. function wrapFilter (exp, filter) {
  50255. var i = filter.indexOf('(');
  50256. if (i < 0) {
  50257. // _f: resolveFilter
  50258. return ("_f(\"" + filter + "\")(" + exp + ")")
  50259. } else {
  50260. var name = filter.slice(0, i);
  50261. var args = filter.slice(i + 1);
  50262. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50263. }
  50264. }
  50265. /* */
  50266. /* eslint-disable no-unused-vars */
  50267. function baseWarn (msg, range) {
  50268. console.error(("[Vue compiler]: " + msg));
  50269. }
  50270. /* eslint-enable no-unused-vars */
  50271. function pluckModuleFunction (
  50272. modules,
  50273. key
  50274. ) {
  50275. return modules
  50276. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50277. : []
  50278. }
  50279. function addProp (el, name, value, range, dynamic) {
  50280. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50281. el.plain = false;
  50282. }
  50283. function addAttr (el, name, value, range, dynamic) {
  50284. var attrs = dynamic
  50285. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50286. : (el.attrs || (el.attrs = []));
  50287. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50288. el.plain = false;
  50289. }
  50290. // add a raw attr (use this in preTransforms)
  50291. function addRawAttr (el, name, value, range) {
  50292. el.attrsMap[name] = value;
  50293. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50294. }
  50295. function addDirective (
  50296. el,
  50297. name,
  50298. rawName,
  50299. value,
  50300. arg,
  50301. isDynamicArg,
  50302. modifiers,
  50303. range
  50304. ) {
  50305. (el.directives || (el.directives = [])).push(rangeSetItem({
  50306. name: name,
  50307. rawName: rawName,
  50308. value: value,
  50309. arg: arg,
  50310. isDynamicArg: isDynamicArg,
  50311. modifiers: modifiers
  50312. }, range));
  50313. el.plain = false;
  50314. }
  50315. function prependModifierMarker (symbol, name, dynamic) {
  50316. return dynamic
  50317. ? ("_p(" + name + ",\"" + symbol + "\")")
  50318. : symbol + name // mark the event as captured
  50319. }
  50320. function addHandler (
  50321. el,
  50322. name,
  50323. value,
  50324. modifiers,
  50325. important,
  50326. warn,
  50327. range,
  50328. dynamic
  50329. ) {
  50330. modifiers = modifiers || emptyObject;
  50331. // warn prevent and passive modifier
  50332. /* istanbul ignore if */
  50333. if (
  50334. warn &&
  50335. modifiers.prevent && modifiers.passive
  50336. ) {
  50337. warn(
  50338. 'passive and prevent can\'t be used together. ' +
  50339. 'Passive handler can\'t prevent default event.',
  50340. range
  50341. );
  50342. }
  50343. // normalize click.right and click.middle since they don't actually fire
  50344. // this is technically browser-specific, but at least for now browsers are
  50345. // the only target envs that have right/middle clicks.
  50346. if (modifiers.right) {
  50347. if (dynamic) {
  50348. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50349. } else if (name === 'click') {
  50350. name = 'contextmenu';
  50351. delete modifiers.right;
  50352. }
  50353. } else if (modifiers.middle) {
  50354. if (dynamic) {
  50355. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50356. } else if (name === 'click') {
  50357. name = 'mouseup';
  50358. }
  50359. }
  50360. // check capture modifier
  50361. if (modifiers.capture) {
  50362. delete modifiers.capture;
  50363. name = prependModifierMarker('!', name, dynamic);
  50364. }
  50365. if (modifiers.once) {
  50366. delete modifiers.once;
  50367. name = prependModifierMarker('~', name, dynamic);
  50368. }
  50369. /* istanbul ignore if */
  50370. if (modifiers.passive) {
  50371. delete modifiers.passive;
  50372. name = prependModifierMarker('&', name, dynamic);
  50373. }
  50374. var events;
  50375. if (modifiers.native) {
  50376. delete modifiers.native;
  50377. events = el.nativeEvents || (el.nativeEvents = {});
  50378. } else {
  50379. events = el.events || (el.events = {});
  50380. }
  50381. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50382. if (modifiers !== emptyObject) {
  50383. newHandler.modifiers = modifiers;
  50384. }
  50385. var handlers = events[name];
  50386. /* istanbul ignore if */
  50387. if (Array.isArray(handlers)) {
  50388. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50389. } else if (handlers) {
  50390. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50391. } else {
  50392. events[name] = newHandler;
  50393. }
  50394. el.plain = false;
  50395. }
  50396. function getRawBindingAttr (
  50397. el,
  50398. name
  50399. ) {
  50400. return el.rawAttrsMap[':' + name] ||
  50401. el.rawAttrsMap['v-bind:' + name] ||
  50402. el.rawAttrsMap[name]
  50403. }
  50404. function getBindingAttr (
  50405. el,
  50406. name,
  50407. getStatic
  50408. ) {
  50409. var dynamicValue =
  50410. getAndRemoveAttr(el, ':' + name) ||
  50411. getAndRemoveAttr(el, 'v-bind:' + name);
  50412. if (dynamicValue != null) {
  50413. return parseFilters(dynamicValue)
  50414. } else if (getStatic !== false) {
  50415. var staticValue = getAndRemoveAttr(el, name);
  50416. if (staticValue != null) {
  50417. return JSON.stringify(staticValue)
  50418. }
  50419. }
  50420. }
  50421. // note: this only removes the attr from the Array (attrsList) so that it
  50422. // doesn't get processed by processAttrs.
  50423. // By default it does NOT remove it from the map (attrsMap) because the map is
  50424. // needed during codegen.
  50425. function getAndRemoveAttr (
  50426. el,
  50427. name,
  50428. removeFromMap
  50429. ) {
  50430. var val;
  50431. if ((val = el.attrsMap[name]) != null) {
  50432. var list = el.attrsList;
  50433. for (var i = 0, l = list.length; i < l; i++) {
  50434. if (list[i].name === name) {
  50435. list.splice(i, 1);
  50436. break
  50437. }
  50438. }
  50439. }
  50440. if (removeFromMap) {
  50441. delete el.attrsMap[name];
  50442. }
  50443. return val
  50444. }
  50445. function getAndRemoveAttrByRegex (
  50446. el,
  50447. name
  50448. ) {
  50449. var list = el.attrsList;
  50450. for (var i = 0, l = list.length; i < l; i++) {
  50451. var attr = list[i];
  50452. if (name.test(attr.name)) {
  50453. list.splice(i, 1);
  50454. return attr
  50455. }
  50456. }
  50457. }
  50458. function rangeSetItem (
  50459. item,
  50460. range
  50461. ) {
  50462. if (range) {
  50463. if (range.start != null) {
  50464. item.start = range.start;
  50465. }
  50466. if (range.end != null) {
  50467. item.end = range.end;
  50468. }
  50469. }
  50470. return item
  50471. }
  50472. /* */
  50473. /**
  50474. * Cross-platform code generation for component v-model
  50475. */
  50476. function genComponentModel (
  50477. el,
  50478. value,
  50479. modifiers
  50480. ) {
  50481. var ref = modifiers || {};
  50482. var number = ref.number;
  50483. var trim = ref.trim;
  50484. var baseValueExpression = '$$v';
  50485. var valueExpression = baseValueExpression;
  50486. if (trim) {
  50487. valueExpression =
  50488. "(typeof " + baseValueExpression + " === 'string'" +
  50489. "? " + baseValueExpression + ".trim()" +
  50490. ": " + baseValueExpression + ")";
  50491. }
  50492. if (number) {
  50493. valueExpression = "_n(" + valueExpression + ")";
  50494. }
  50495. var assignment = genAssignmentCode(value, valueExpression);
  50496. el.model = {
  50497. value: ("(" + value + ")"),
  50498. expression: JSON.stringify(value),
  50499. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  50500. };
  50501. }
  50502. /**
  50503. * Cross-platform codegen helper for generating v-model value assignment code.
  50504. */
  50505. function genAssignmentCode (
  50506. value,
  50507. assignment
  50508. ) {
  50509. var res = parseModel(value);
  50510. if (res.key === null) {
  50511. return (value + "=" + assignment)
  50512. } else {
  50513. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  50514. }
  50515. }
  50516. /**
  50517. * Parse a v-model expression into a base path and a final key segment.
  50518. * Handles both dot-path and possible square brackets.
  50519. *
  50520. * Possible cases:
  50521. *
  50522. * - test
  50523. * - test[key]
  50524. * - test[test1[key]]
  50525. * - test["a"][key]
  50526. * - xxx.test[a[a].test1[key]]
  50527. * - test.xxx.a["asa"][test1[key]]
  50528. *
  50529. */
  50530. var len, str, chr, index$1, expressionPos, expressionEndPos;
  50531. function parseModel (val) {
  50532. // Fix https://github.com/vuejs/vue/pull/7730
  50533. // allow v-model="obj.val " (trailing whitespace)
  50534. val = val.trim();
  50535. len = val.length;
  50536. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  50537. index$1 = val.lastIndexOf('.');
  50538. if (index$1 > -1) {
  50539. return {
  50540. exp: val.slice(0, index$1),
  50541. key: '"' + val.slice(index$1 + 1) + '"'
  50542. }
  50543. } else {
  50544. return {
  50545. exp: val,
  50546. key: null
  50547. }
  50548. }
  50549. }
  50550. str = val;
  50551. index$1 = expressionPos = expressionEndPos = 0;
  50552. while (!eof()) {
  50553. chr = next();
  50554. /* istanbul ignore if */
  50555. if (isStringStart(chr)) {
  50556. parseString(chr);
  50557. } else if (chr === 0x5B) {
  50558. parseBracket(chr);
  50559. }
  50560. }
  50561. return {
  50562. exp: val.slice(0, expressionPos),
  50563. key: val.slice(expressionPos + 1, expressionEndPos)
  50564. }
  50565. }
  50566. function next () {
  50567. return str.charCodeAt(++index$1)
  50568. }
  50569. function eof () {
  50570. return index$1 >= len
  50571. }
  50572. function isStringStart (chr) {
  50573. return chr === 0x22 || chr === 0x27
  50574. }
  50575. function parseBracket (chr) {
  50576. var inBracket = 1;
  50577. expressionPos = index$1;
  50578. while (!eof()) {
  50579. chr = next();
  50580. if (isStringStart(chr)) {
  50581. parseString(chr);
  50582. continue
  50583. }
  50584. if (chr === 0x5B) { inBracket++; }
  50585. if (chr === 0x5D) { inBracket--; }
  50586. if (inBracket === 0) {
  50587. expressionEndPos = index$1;
  50588. break
  50589. }
  50590. }
  50591. }
  50592. function parseString (chr) {
  50593. var stringQuote = chr;
  50594. while (!eof()) {
  50595. chr = next();
  50596. if (chr === stringQuote) {
  50597. break
  50598. }
  50599. }
  50600. }
  50601. /* */
  50602. var warn$1;
  50603. // in some cases, the event used has to be determined at runtime
  50604. // so we used some reserved tokens during compile.
  50605. var RANGE_TOKEN = '__r';
  50606. var CHECKBOX_RADIO_TOKEN = '__c';
  50607. function model (
  50608. el,
  50609. dir,
  50610. _warn
  50611. ) {
  50612. warn$1 = _warn;
  50613. var value = dir.value;
  50614. var modifiers = dir.modifiers;
  50615. var tag = el.tag;
  50616. var type = el.attrsMap.type;
  50617. {
  50618. // inputs with type="file" are read only and setting the input's
  50619. // value will throw an error.
  50620. if (tag === 'input' && type === 'file') {
  50621. warn$1(
  50622. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  50623. "File inputs are read only. Use a v-on:change listener instead.",
  50624. el.rawAttrsMap['v-model']
  50625. );
  50626. }
  50627. }
  50628. if (el.component) {
  50629. genComponentModel(el, value, modifiers);
  50630. // component v-model doesn't need extra runtime
  50631. return false
  50632. } else if (tag === 'select') {
  50633. genSelect(el, value, modifiers);
  50634. } else if (tag === 'input' && type === 'checkbox') {
  50635. genCheckboxModel(el, value, modifiers);
  50636. } else if (tag === 'input' && type === 'radio') {
  50637. genRadioModel(el, value, modifiers);
  50638. } else if (tag === 'input' || tag === 'textarea') {
  50639. genDefaultModel(el, value, modifiers);
  50640. } else if (!config.isReservedTag(tag)) {
  50641. genComponentModel(el, value, modifiers);
  50642. // component v-model doesn't need extra runtime
  50643. return false
  50644. } else {
  50645. warn$1(
  50646. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  50647. "v-model is not supported on this element type. " +
  50648. 'If you are working with contenteditable, it\'s recommended to ' +
  50649. 'wrap a library dedicated for that purpose inside a custom component.',
  50650. el.rawAttrsMap['v-model']
  50651. );
  50652. }
  50653. // ensure runtime directive metadata
  50654. return true
  50655. }
  50656. function genCheckboxModel (
  50657. el,
  50658. value,
  50659. modifiers
  50660. ) {
  50661. var number = modifiers && modifiers.number;
  50662. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50663. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  50664. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  50665. addProp(el, 'checked',
  50666. "Array.isArray(" + value + ")" +
  50667. "?_i(" + value + "," + valueBinding + ")>-1" + (
  50668. trueValueBinding === 'true'
  50669. ? (":(" + value + ")")
  50670. : (":_q(" + value + "," + trueValueBinding + ")")
  50671. )
  50672. );
  50673. addHandler(el, 'change',
  50674. "var $$a=" + value + "," +
  50675. '$$el=$event.target,' +
  50676. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  50677. 'if(Array.isArray($$a)){' +
  50678. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  50679. '$$i=_i($$a,$$v);' +
  50680. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  50681. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  50682. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  50683. null, true
  50684. );
  50685. }
  50686. function genRadioModel (
  50687. el,
  50688. value,
  50689. modifiers
  50690. ) {
  50691. var number = modifiers && modifiers.number;
  50692. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50693. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  50694. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  50695. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  50696. }
  50697. function genSelect (
  50698. el,
  50699. value,
  50700. modifiers
  50701. ) {
  50702. var number = modifiers && modifiers.number;
  50703. var selectedVal = "Array.prototype.filter" +
  50704. ".call($event.target.options,function(o){return o.selected})" +
  50705. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  50706. "return " + (number ? '_n(val)' : 'val') + "})";
  50707. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  50708. var code = "var $$selectedVal = " + selectedVal + ";";
  50709. code = code + " " + (genAssignmentCode(value, assignment));
  50710. addHandler(el, 'change', code, null, true);
  50711. }
  50712. function genDefaultModel (
  50713. el,
  50714. value,
  50715. modifiers
  50716. ) {
  50717. var type = el.attrsMap.type;
  50718. // warn if v-bind:value conflicts with v-model
  50719. // except for inputs with v-bind:type
  50720. {
  50721. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  50722. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  50723. if (value$1 && !typeBinding) {
  50724. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  50725. warn$1(
  50726. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  50727. 'because the latter already expands to a value binding internally',
  50728. el.rawAttrsMap[binding]
  50729. );
  50730. }
  50731. }
  50732. var ref = modifiers || {};
  50733. var lazy = ref.lazy;
  50734. var number = ref.number;
  50735. var trim = ref.trim;
  50736. var needCompositionGuard = !lazy && type !== 'range';
  50737. var event = lazy
  50738. ? 'change'
  50739. : type === 'range'
  50740. ? RANGE_TOKEN
  50741. : 'input';
  50742. var valueExpression = '$event.target.value';
  50743. if (trim) {
  50744. valueExpression = "$event.target.value.trim()";
  50745. }
  50746. if (number) {
  50747. valueExpression = "_n(" + valueExpression + ")";
  50748. }
  50749. var code = genAssignmentCode(value, valueExpression);
  50750. if (needCompositionGuard) {
  50751. code = "if($event.target.composing)return;" + code;
  50752. }
  50753. addProp(el, 'value', ("(" + value + ")"));
  50754. addHandler(el, event, code, null, true);
  50755. if (trim || number) {
  50756. addHandler(el, 'blur', '$forceUpdate()');
  50757. }
  50758. }
  50759. /* */
  50760. // normalize v-model event tokens that can only be determined at runtime.
  50761. // it's important to place the event as the first in the array because
  50762. // the whole point is ensuring the v-model callback gets called before
  50763. // user-attached handlers.
  50764. function normalizeEvents (on) {
  50765. /* istanbul ignore if */
  50766. if (isDef(on[RANGE_TOKEN])) {
  50767. // IE input[type=range] only supports `change` event
  50768. var event = isIE ? 'change' : 'input';
  50769. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  50770. delete on[RANGE_TOKEN];
  50771. }
  50772. // This was originally intended to fix #4521 but no longer necessary
  50773. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  50774. /* istanbul ignore if */
  50775. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  50776. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  50777. delete on[CHECKBOX_RADIO_TOKEN];
  50778. }
  50779. }
  50780. var target$1;
  50781. function createOnceHandler$1 (event, handler, capture) {
  50782. var _target = target$1; // save current target element in closure
  50783. return function onceHandler () {
  50784. var res = handler.apply(null, arguments);
  50785. if (res !== null) {
  50786. remove$2(event, onceHandler, capture, _target);
  50787. }
  50788. }
  50789. }
  50790. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  50791. // implementation and does not fire microtasks in between event propagation, so
  50792. // safe to exclude.
  50793. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  50794. function add$1 (
  50795. name,
  50796. handler,
  50797. capture,
  50798. passive
  50799. ) {
  50800. // async edge case #6566: inner click event triggers patch, event handler
  50801. // attached to outer element during patch, and triggered again. This
  50802. // happens because browsers fire microtask ticks between event propagation.
  50803. // the solution is simple: we save the timestamp when a handler is attached,
  50804. // and the handler would only fire if the event passed to it was fired
  50805. // AFTER it was attached.
  50806. if (useMicrotaskFix) {
  50807. var attachedTimestamp = currentFlushTimestamp;
  50808. var original = handler;
  50809. handler = original._wrapper = function (e) {
  50810. if (
  50811. // no bubbling, should always fire.
  50812. // this is just a safety net in case event.timeStamp is unreliable in
  50813. // certain weird environments...
  50814. e.target === e.currentTarget ||
  50815. // event is fired after handler attachment
  50816. e.timeStamp >= attachedTimestamp ||
  50817. // bail for environments that have buggy event.timeStamp implementations
  50818. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  50819. // #9681 QtWebEngine event.timeStamp is negative value
  50820. e.timeStamp <= 0 ||
  50821. // #9448 bail if event is fired in another document in a multi-page
  50822. // electron/nw.js app, since event.timeStamp will be using a different
  50823. // starting reference
  50824. e.target.ownerDocument !== document
  50825. ) {
  50826. return original.apply(this, arguments)
  50827. }
  50828. };
  50829. }
  50830. target$1.addEventListener(
  50831. name,
  50832. handler,
  50833. supportsPassive
  50834. ? { capture: capture, passive: passive }
  50835. : capture
  50836. );
  50837. }
  50838. function remove$2 (
  50839. name,
  50840. handler,
  50841. capture,
  50842. _target
  50843. ) {
  50844. (_target || target$1).removeEventListener(
  50845. name,
  50846. handler._wrapper || handler,
  50847. capture
  50848. );
  50849. }
  50850. function updateDOMListeners (oldVnode, vnode) {
  50851. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  50852. return
  50853. }
  50854. var on = vnode.data.on || {};
  50855. var oldOn = oldVnode.data.on || {};
  50856. target$1 = vnode.elm;
  50857. normalizeEvents(on);
  50858. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  50859. target$1 = undefined;
  50860. }
  50861. var events = {
  50862. create: updateDOMListeners,
  50863. update: updateDOMListeners
  50864. };
  50865. /* */
  50866. var svgContainer;
  50867. function updateDOMProps (oldVnode, vnode) {
  50868. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  50869. return
  50870. }
  50871. var key, cur;
  50872. var elm = vnode.elm;
  50873. var oldProps = oldVnode.data.domProps || {};
  50874. var props = vnode.data.domProps || {};
  50875. // clone observed objects, as the user probably wants to mutate it
  50876. if (isDef(props.__ob__)) {
  50877. props = vnode.data.domProps = extend({}, props);
  50878. }
  50879. for (key in oldProps) {
  50880. if (!(key in props)) {
  50881. elm[key] = '';
  50882. }
  50883. }
  50884. for (key in props) {
  50885. cur = props[key];
  50886. // ignore children if the node has textContent or innerHTML,
  50887. // as these will throw away existing DOM nodes and cause removal errors
  50888. // on subsequent patches (#3360)
  50889. if (key === 'textContent' || key === 'innerHTML') {
  50890. if (vnode.children) { vnode.children.length = 0; }
  50891. if (cur === oldProps[key]) { continue }
  50892. // #6601 work around Chrome version <= 55 bug where single textNode
  50893. // replaced by innerHTML/textContent retains its parentNode property
  50894. if (elm.childNodes.length === 1) {
  50895. elm.removeChild(elm.childNodes[0]);
  50896. }
  50897. }
  50898. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  50899. // store value as _value as well since
  50900. // non-string values will be stringified
  50901. elm._value = cur;
  50902. // avoid resetting cursor position when value is the same
  50903. var strCur = isUndef(cur) ? '' : String(cur);
  50904. if (shouldUpdateValue(elm, strCur)) {
  50905. elm.value = strCur;
  50906. }
  50907. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  50908. // IE doesn't support innerHTML for SVG elements
  50909. svgContainer = svgContainer || document.createElement('div');
  50910. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  50911. var svg = svgContainer.firstChild;
  50912. while (elm.firstChild) {
  50913. elm.removeChild(elm.firstChild);
  50914. }
  50915. while (svg.firstChild) {
  50916. elm.appendChild(svg.firstChild);
  50917. }
  50918. } else if (
  50919. // skip the update if old and new VDOM state is the same.
  50920. // `value` is handled separately because the DOM value may be temporarily
  50921. // out of sync with VDOM state due to focus, composition and modifiers.
  50922. // This #4521 by skipping the unnecesarry `checked` update.
  50923. cur !== oldProps[key]
  50924. ) {
  50925. // some property updates can throw
  50926. // e.g. `value` on <progress> w/ non-finite value
  50927. try {
  50928. elm[key] = cur;
  50929. } catch (e) {}
  50930. }
  50931. }
  50932. }
  50933. // check platforms/web/util/attrs.js acceptValue
  50934. function shouldUpdateValue (elm, checkVal) {
  50935. return (!elm.composing && (
  50936. elm.tagName === 'OPTION' ||
  50937. isNotInFocusAndDirty(elm, checkVal) ||
  50938. isDirtyWithModifiers(elm, checkVal)
  50939. ))
  50940. }
  50941. function isNotInFocusAndDirty (elm, checkVal) {
  50942. // return true when textbox (.number and .trim) loses focus and its value is
  50943. // not equal to the updated value
  50944. var notInFocus = true;
  50945. // #6157
  50946. // work around IE bug when accessing document.activeElement in an iframe
  50947. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  50948. return notInFocus && elm.value !== checkVal
  50949. }
  50950. function isDirtyWithModifiers (elm, newVal) {
  50951. var value = elm.value;
  50952. var modifiers = elm._vModifiers; // injected by v-model runtime
  50953. if (isDef(modifiers)) {
  50954. if (modifiers.number) {
  50955. return toNumber(value) !== toNumber(newVal)
  50956. }
  50957. if (modifiers.trim) {
  50958. return value.trim() !== newVal.trim()
  50959. }
  50960. }
  50961. return value !== newVal
  50962. }
  50963. var domProps = {
  50964. create: updateDOMProps,
  50965. update: updateDOMProps
  50966. };
  50967. /* */
  50968. var parseStyleText = cached(function (cssText) {
  50969. var res = {};
  50970. var listDelimiter = /;(?![^(]*\))/g;
  50971. var propertyDelimiter = /:(.+)/;
  50972. cssText.split(listDelimiter).forEach(function (item) {
  50973. if (item) {
  50974. var tmp = item.split(propertyDelimiter);
  50975. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  50976. }
  50977. });
  50978. return res
  50979. });
  50980. // merge static and dynamic style data on the same vnode
  50981. function normalizeStyleData (data) {
  50982. var style = normalizeStyleBinding(data.style);
  50983. // static style is pre-processed into an object during compilation
  50984. // and is always a fresh object, so it's safe to merge into it
  50985. return data.staticStyle
  50986. ? extend(data.staticStyle, style)
  50987. : style
  50988. }
  50989. // normalize possible array / string values into Object
  50990. function normalizeStyleBinding (bindingStyle) {
  50991. if (Array.isArray(bindingStyle)) {
  50992. return toObject(bindingStyle)
  50993. }
  50994. if (typeof bindingStyle === 'string') {
  50995. return parseStyleText(bindingStyle)
  50996. }
  50997. return bindingStyle
  50998. }
  50999. /**
  51000. * parent component style should be after child's
  51001. * so that parent component's style could override it
  51002. */
  51003. function getStyle (vnode, checkChild) {
  51004. var res = {};
  51005. var styleData;
  51006. if (checkChild) {
  51007. var childNode = vnode;
  51008. while (childNode.componentInstance) {
  51009. childNode = childNode.componentInstance._vnode;
  51010. if (
  51011. childNode && childNode.data &&
  51012. (styleData = normalizeStyleData(childNode.data))
  51013. ) {
  51014. extend(res, styleData);
  51015. }
  51016. }
  51017. }
  51018. if ((styleData = normalizeStyleData(vnode.data))) {
  51019. extend(res, styleData);
  51020. }
  51021. var parentNode = vnode;
  51022. while ((parentNode = parentNode.parent)) {
  51023. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51024. extend(res, styleData);
  51025. }
  51026. }
  51027. return res
  51028. }
  51029. /* */
  51030. var cssVarRE = /^--/;
  51031. var importantRE = /\s*!important$/;
  51032. var setProp = function (el, name, val) {
  51033. /* istanbul ignore if */
  51034. if (cssVarRE.test(name)) {
  51035. el.style.setProperty(name, val);
  51036. } else if (importantRE.test(val)) {
  51037. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51038. } else {
  51039. var normalizedName = normalize(name);
  51040. if (Array.isArray(val)) {
  51041. // Support values array created by autoprefixer, e.g.
  51042. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51043. // Set them one by one, and the browser will only set those it can recognize
  51044. for (var i = 0, len = val.length; i < len; i++) {
  51045. el.style[normalizedName] = val[i];
  51046. }
  51047. } else {
  51048. el.style[normalizedName] = val;
  51049. }
  51050. }
  51051. };
  51052. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51053. var emptyStyle;
  51054. var normalize = cached(function (prop) {
  51055. emptyStyle = emptyStyle || document.createElement('div').style;
  51056. prop = camelize(prop);
  51057. if (prop !== 'filter' && (prop in emptyStyle)) {
  51058. return prop
  51059. }
  51060. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51061. for (var i = 0; i < vendorNames.length; i++) {
  51062. var name = vendorNames[i] + capName;
  51063. if (name in emptyStyle) {
  51064. return name
  51065. }
  51066. }
  51067. });
  51068. function updateStyle (oldVnode, vnode) {
  51069. var data = vnode.data;
  51070. var oldData = oldVnode.data;
  51071. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51072. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51073. ) {
  51074. return
  51075. }
  51076. var cur, name;
  51077. var el = vnode.elm;
  51078. var oldStaticStyle = oldData.staticStyle;
  51079. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51080. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51081. var oldStyle = oldStaticStyle || oldStyleBinding;
  51082. var style = normalizeStyleBinding(vnode.data.style) || {};
  51083. // store normalized style under a different key for next diff
  51084. // make sure to clone it if it's reactive, since the user likely wants
  51085. // to mutate it.
  51086. vnode.data.normalizedStyle = isDef(style.__ob__)
  51087. ? extend({}, style)
  51088. : style;
  51089. var newStyle = getStyle(vnode, true);
  51090. for (name in oldStyle) {
  51091. if (isUndef(newStyle[name])) {
  51092. setProp(el, name, '');
  51093. }
  51094. }
  51095. for (name in newStyle) {
  51096. cur = newStyle[name];
  51097. if (cur !== oldStyle[name]) {
  51098. // ie9 setting to null has no effect, must use empty string
  51099. setProp(el, name, cur == null ? '' : cur);
  51100. }
  51101. }
  51102. }
  51103. var style = {
  51104. create: updateStyle,
  51105. update: updateStyle
  51106. };
  51107. /* */
  51108. var whitespaceRE = /\s+/;
  51109. /**
  51110. * Add class with compatibility for SVG since classList is not supported on
  51111. * SVG elements in IE
  51112. */
  51113. function addClass (el, cls) {
  51114. /* istanbul ignore if */
  51115. if (!cls || !(cls = cls.trim())) {
  51116. return
  51117. }
  51118. /* istanbul ignore else */
  51119. if (el.classList) {
  51120. if (cls.indexOf(' ') > -1) {
  51121. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51122. } else {
  51123. el.classList.add(cls);
  51124. }
  51125. } else {
  51126. var cur = " " + (el.getAttribute('class') || '') + " ";
  51127. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51128. el.setAttribute('class', (cur + cls).trim());
  51129. }
  51130. }
  51131. }
  51132. /**
  51133. * Remove class with compatibility for SVG since classList is not supported on
  51134. * SVG elements in IE
  51135. */
  51136. function removeClass (el, cls) {
  51137. /* istanbul ignore if */
  51138. if (!cls || !(cls = cls.trim())) {
  51139. return
  51140. }
  51141. /* istanbul ignore else */
  51142. if (el.classList) {
  51143. if (cls.indexOf(' ') > -1) {
  51144. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51145. } else {
  51146. el.classList.remove(cls);
  51147. }
  51148. if (!el.classList.length) {
  51149. el.removeAttribute('class');
  51150. }
  51151. } else {
  51152. var cur = " " + (el.getAttribute('class') || '') + " ";
  51153. var tar = ' ' + cls + ' ';
  51154. while (cur.indexOf(tar) >= 0) {
  51155. cur = cur.replace(tar, ' ');
  51156. }
  51157. cur = cur.trim();
  51158. if (cur) {
  51159. el.setAttribute('class', cur);
  51160. } else {
  51161. el.removeAttribute('class');
  51162. }
  51163. }
  51164. }
  51165. /* */
  51166. function resolveTransition (def$$1) {
  51167. if (!def$$1) {
  51168. return
  51169. }
  51170. /* istanbul ignore else */
  51171. if (typeof def$$1 === 'object') {
  51172. var res = {};
  51173. if (def$$1.css !== false) {
  51174. extend(res, autoCssTransition(def$$1.name || 'v'));
  51175. }
  51176. extend(res, def$$1);
  51177. return res
  51178. } else if (typeof def$$1 === 'string') {
  51179. return autoCssTransition(def$$1)
  51180. }
  51181. }
  51182. var autoCssTransition = cached(function (name) {
  51183. return {
  51184. enterClass: (name + "-enter"),
  51185. enterToClass: (name + "-enter-to"),
  51186. enterActiveClass: (name + "-enter-active"),
  51187. leaveClass: (name + "-leave"),
  51188. leaveToClass: (name + "-leave-to"),
  51189. leaveActiveClass: (name + "-leave-active")
  51190. }
  51191. });
  51192. var hasTransition = inBrowser && !isIE9;
  51193. var TRANSITION = 'transition';
  51194. var ANIMATION = 'animation';
  51195. // Transition property/event sniffing
  51196. var transitionProp = 'transition';
  51197. var transitionEndEvent = 'transitionend';
  51198. var animationProp = 'animation';
  51199. var animationEndEvent = 'animationend';
  51200. if (hasTransition) {
  51201. /* istanbul ignore if */
  51202. if (window.ontransitionend === undefined &&
  51203. window.onwebkittransitionend !== undefined
  51204. ) {
  51205. transitionProp = 'WebkitTransition';
  51206. transitionEndEvent = 'webkitTransitionEnd';
  51207. }
  51208. if (window.onanimationend === undefined &&
  51209. window.onwebkitanimationend !== undefined
  51210. ) {
  51211. animationProp = 'WebkitAnimation';
  51212. animationEndEvent = 'webkitAnimationEnd';
  51213. }
  51214. }
  51215. // binding to window is necessary to make hot reload work in IE in strict mode
  51216. var raf = inBrowser
  51217. ? window.requestAnimationFrame
  51218. ? window.requestAnimationFrame.bind(window)
  51219. : setTimeout
  51220. : /* istanbul ignore next */ function (fn) { return fn(); };
  51221. function nextFrame (fn) {
  51222. raf(function () {
  51223. raf(fn);
  51224. });
  51225. }
  51226. function addTransitionClass (el, cls) {
  51227. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51228. if (transitionClasses.indexOf(cls) < 0) {
  51229. transitionClasses.push(cls);
  51230. addClass(el, cls);
  51231. }
  51232. }
  51233. function removeTransitionClass (el, cls) {
  51234. if (el._transitionClasses) {
  51235. remove(el._transitionClasses, cls);
  51236. }
  51237. removeClass(el, cls);
  51238. }
  51239. function whenTransitionEnds (
  51240. el,
  51241. expectedType,
  51242. cb
  51243. ) {
  51244. var ref = getTransitionInfo(el, expectedType);
  51245. var type = ref.type;
  51246. var timeout = ref.timeout;
  51247. var propCount = ref.propCount;
  51248. if (!type) { return cb() }
  51249. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51250. var ended = 0;
  51251. var end = function () {
  51252. el.removeEventListener(event, onEnd);
  51253. cb();
  51254. };
  51255. var onEnd = function (e) {
  51256. if (e.target === el) {
  51257. if (++ended >= propCount) {
  51258. end();
  51259. }
  51260. }
  51261. };
  51262. setTimeout(function () {
  51263. if (ended < propCount) {
  51264. end();
  51265. }
  51266. }, timeout + 1);
  51267. el.addEventListener(event, onEnd);
  51268. }
  51269. var transformRE = /\b(transform|all)(,|$)/;
  51270. function getTransitionInfo (el, expectedType) {
  51271. var styles = window.getComputedStyle(el);
  51272. // JSDOM may return undefined for transition properties
  51273. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51274. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51275. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51276. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51277. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51278. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51279. var type;
  51280. var timeout = 0;
  51281. var propCount = 0;
  51282. /* istanbul ignore if */
  51283. if (expectedType === TRANSITION) {
  51284. if (transitionTimeout > 0) {
  51285. type = TRANSITION;
  51286. timeout = transitionTimeout;
  51287. propCount = transitionDurations.length;
  51288. }
  51289. } else if (expectedType === ANIMATION) {
  51290. if (animationTimeout > 0) {
  51291. type = ANIMATION;
  51292. timeout = animationTimeout;
  51293. propCount = animationDurations.length;
  51294. }
  51295. } else {
  51296. timeout = Math.max(transitionTimeout, animationTimeout);
  51297. type = timeout > 0
  51298. ? transitionTimeout > animationTimeout
  51299. ? TRANSITION
  51300. : ANIMATION
  51301. : null;
  51302. propCount = type
  51303. ? type === TRANSITION
  51304. ? transitionDurations.length
  51305. : animationDurations.length
  51306. : 0;
  51307. }
  51308. var hasTransform =
  51309. type === TRANSITION &&
  51310. transformRE.test(styles[transitionProp + 'Property']);
  51311. return {
  51312. type: type,
  51313. timeout: timeout,
  51314. propCount: propCount,
  51315. hasTransform: hasTransform
  51316. }
  51317. }
  51318. function getTimeout (delays, durations) {
  51319. /* istanbul ignore next */
  51320. while (delays.length < durations.length) {
  51321. delays = delays.concat(delays);
  51322. }
  51323. return Math.max.apply(null, durations.map(function (d, i) {
  51324. return toMs(d) + toMs(delays[i])
  51325. }))
  51326. }
  51327. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51328. // in a locale-dependent way, using a comma instead of a dot.
  51329. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51330. // as a floor function) causing unexpected behaviors
  51331. function toMs (s) {
  51332. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51333. }
  51334. /* */
  51335. function enter (vnode, toggleDisplay) {
  51336. var el = vnode.elm;
  51337. // call leave callback now
  51338. if (isDef(el._leaveCb)) {
  51339. el._leaveCb.cancelled = true;
  51340. el._leaveCb();
  51341. }
  51342. var data = resolveTransition(vnode.data.transition);
  51343. if (isUndef(data)) {
  51344. return
  51345. }
  51346. /* istanbul ignore if */
  51347. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51348. return
  51349. }
  51350. var css = data.css;
  51351. var type = data.type;
  51352. var enterClass = data.enterClass;
  51353. var enterToClass = data.enterToClass;
  51354. var enterActiveClass = data.enterActiveClass;
  51355. var appearClass = data.appearClass;
  51356. var appearToClass = data.appearToClass;
  51357. var appearActiveClass = data.appearActiveClass;
  51358. var beforeEnter = data.beforeEnter;
  51359. var enter = data.enter;
  51360. var afterEnter = data.afterEnter;
  51361. var enterCancelled = data.enterCancelled;
  51362. var beforeAppear = data.beforeAppear;
  51363. var appear = data.appear;
  51364. var afterAppear = data.afterAppear;
  51365. var appearCancelled = data.appearCancelled;
  51366. var duration = data.duration;
  51367. // activeInstance will always be the <transition> component managing this
  51368. // transition. One edge case to check is when the <transition> is placed
  51369. // as the root node of a child component. In that case we need to check
  51370. // <transition>'s parent for appear check.
  51371. var context = activeInstance;
  51372. var transitionNode = activeInstance.$vnode;
  51373. while (transitionNode && transitionNode.parent) {
  51374. context = transitionNode.context;
  51375. transitionNode = transitionNode.parent;
  51376. }
  51377. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51378. if (isAppear && !appear && appear !== '') {
  51379. return
  51380. }
  51381. var startClass = isAppear && appearClass
  51382. ? appearClass
  51383. : enterClass;
  51384. var activeClass = isAppear && appearActiveClass
  51385. ? appearActiveClass
  51386. : enterActiveClass;
  51387. var toClass = isAppear && appearToClass
  51388. ? appearToClass
  51389. : enterToClass;
  51390. var beforeEnterHook = isAppear
  51391. ? (beforeAppear || beforeEnter)
  51392. : beforeEnter;
  51393. var enterHook = isAppear
  51394. ? (typeof appear === 'function' ? appear : enter)
  51395. : enter;
  51396. var afterEnterHook = isAppear
  51397. ? (afterAppear || afterEnter)
  51398. : afterEnter;
  51399. var enterCancelledHook = isAppear
  51400. ? (appearCancelled || enterCancelled)
  51401. : enterCancelled;
  51402. var explicitEnterDuration = toNumber(
  51403. isObject(duration)
  51404. ? duration.enter
  51405. : duration
  51406. );
  51407. if (explicitEnterDuration != null) {
  51408. checkDuration(explicitEnterDuration, 'enter', vnode);
  51409. }
  51410. var expectsCSS = css !== false && !isIE9;
  51411. var userWantsControl = getHookArgumentsLength(enterHook);
  51412. var cb = el._enterCb = once(function () {
  51413. if (expectsCSS) {
  51414. removeTransitionClass(el, toClass);
  51415. removeTransitionClass(el, activeClass);
  51416. }
  51417. if (cb.cancelled) {
  51418. if (expectsCSS) {
  51419. removeTransitionClass(el, startClass);
  51420. }
  51421. enterCancelledHook && enterCancelledHook(el);
  51422. } else {
  51423. afterEnterHook && afterEnterHook(el);
  51424. }
  51425. el._enterCb = null;
  51426. });
  51427. if (!vnode.data.show) {
  51428. // remove pending leave element on enter by injecting an insert hook
  51429. mergeVNodeHook(vnode, 'insert', function () {
  51430. var parent = el.parentNode;
  51431. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51432. if (pendingNode &&
  51433. pendingNode.tag === vnode.tag &&
  51434. pendingNode.elm._leaveCb
  51435. ) {
  51436. pendingNode.elm._leaveCb();
  51437. }
  51438. enterHook && enterHook(el, cb);
  51439. });
  51440. }
  51441. // start enter transition
  51442. beforeEnterHook && beforeEnterHook(el);
  51443. if (expectsCSS) {
  51444. addTransitionClass(el, startClass);
  51445. addTransitionClass(el, activeClass);
  51446. nextFrame(function () {
  51447. removeTransitionClass(el, startClass);
  51448. if (!cb.cancelled) {
  51449. addTransitionClass(el, toClass);
  51450. if (!userWantsControl) {
  51451. if (isValidDuration(explicitEnterDuration)) {
  51452. setTimeout(cb, explicitEnterDuration);
  51453. } else {
  51454. whenTransitionEnds(el, type, cb);
  51455. }
  51456. }
  51457. }
  51458. });
  51459. }
  51460. if (vnode.data.show) {
  51461. toggleDisplay && toggleDisplay();
  51462. enterHook && enterHook(el, cb);
  51463. }
  51464. if (!expectsCSS && !userWantsControl) {
  51465. cb();
  51466. }
  51467. }
  51468. function leave (vnode, rm) {
  51469. var el = vnode.elm;
  51470. // call enter callback now
  51471. if (isDef(el._enterCb)) {
  51472. el._enterCb.cancelled = true;
  51473. el._enterCb();
  51474. }
  51475. var data = resolveTransition(vnode.data.transition);
  51476. if (isUndef(data) || el.nodeType !== 1) {
  51477. return rm()
  51478. }
  51479. /* istanbul ignore if */
  51480. if (isDef(el._leaveCb)) {
  51481. return
  51482. }
  51483. var css = data.css;
  51484. var type = data.type;
  51485. var leaveClass = data.leaveClass;
  51486. var leaveToClass = data.leaveToClass;
  51487. var leaveActiveClass = data.leaveActiveClass;
  51488. var beforeLeave = data.beforeLeave;
  51489. var leave = data.leave;
  51490. var afterLeave = data.afterLeave;
  51491. var leaveCancelled = data.leaveCancelled;
  51492. var delayLeave = data.delayLeave;
  51493. var duration = data.duration;
  51494. var expectsCSS = css !== false && !isIE9;
  51495. var userWantsControl = getHookArgumentsLength(leave);
  51496. var explicitLeaveDuration = toNumber(
  51497. isObject(duration)
  51498. ? duration.leave
  51499. : duration
  51500. );
  51501. if (isDef(explicitLeaveDuration)) {
  51502. checkDuration(explicitLeaveDuration, 'leave', vnode);
  51503. }
  51504. var cb = el._leaveCb = once(function () {
  51505. if (el.parentNode && el.parentNode._pending) {
  51506. el.parentNode._pending[vnode.key] = null;
  51507. }
  51508. if (expectsCSS) {
  51509. removeTransitionClass(el, leaveToClass);
  51510. removeTransitionClass(el, leaveActiveClass);
  51511. }
  51512. if (cb.cancelled) {
  51513. if (expectsCSS) {
  51514. removeTransitionClass(el, leaveClass);
  51515. }
  51516. leaveCancelled && leaveCancelled(el);
  51517. } else {
  51518. rm();
  51519. afterLeave && afterLeave(el);
  51520. }
  51521. el._leaveCb = null;
  51522. });
  51523. if (delayLeave) {
  51524. delayLeave(performLeave);
  51525. } else {
  51526. performLeave();
  51527. }
  51528. function performLeave () {
  51529. // the delayed leave may have already been cancelled
  51530. if (cb.cancelled) {
  51531. return
  51532. }
  51533. // record leaving element
  51534. if (!vnode.data.show && el.parentNode) {
  51535. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  51536. }
  51537. beforeLeave && beforeLeave(el);
  51538. if (expectsCSS) {
  51539. addTransitionClass(el, leaveClass);
  51540. addTransitionClass(el, leaveActiveClass);
  51541. nextFrame(function () {
  51542. removeTransitionClass(el, leaveClass);
  51543. if (!cb.cancelled) {
  51544. addTransitionClass(el, leaveToClass);
  51545. if (!userWantsControl) {
  51546. if (isValidDuration(explicitLeaveDuration)) {
  51547. setTimeout(cb, explicitLeaveDuration);
  51548. } else {
  51549. whenTransitionEnds(el, type, cb);
  51550. }
  51551. }
  51552. }
  51553. });
  51554. }
  51555. leave && leave(el, cb);
  51556. if (!expectsCSS && !userWantsControl) {
  51557. cb();
  51558. }
  51559. }
  51560. }
  51561. // only used in dev mode
  51562. function checkDuration (val, name, vnode) {
  51563. if (typeof val !== 'number') {
  51564. warn(
  51565. "<transition> explicit " + name + " duration is not a valid number - " +
  51566. "got " + (JSON.stringify(val)) + ".",
  51567. vnode.context
  51568. );
  51569. } else if (isNaN(val)) {
  51570. warn(
  51571. "<transition> explicit " + name + " duration is NaN - " +
  51572. 'the duration expression might be incorrect.',
  51573. vnode.context
  51574. );
  51575. }
  51576. }
  51577. function isValidDuration (val) {
  51578. return typeof val === 'number' && !isNaN(val)
  51579. }
  51580. /**
  51581. * Normalize a transition hook's argument length. The hook may be:
  51582. * - a merged hook (invoker) with the original in .fns
  51583. * - a wrapped component method (check ._length)
  51584. * - a plain function (.length)
  51585. */
  51586. function getHookArgumentsLength (fn) {
  51587. if (isUndef(fn)) {
  51588. return false
  51589. }
  51590. var invokerFns = fn.fns;
  51591. if (isDef(invokerFns)) {
  51592. // invoker
  51593. return getHookArgumentsLength(
  51594. Array.isArray(invokerFns)
  51595. ? invokerFns[0]
  51596. : invokerFns
  51597. )
  51598. } else {
  51599. return (fn._length || fn.length) > 1
  51600. }
  51601. }
  51602. function _enter (_, vnode) {
  51603. if (vnode.data.show !== true) {
  51604. enter(vnode);
  51605. }
  51606. }
  51607. var transition = inBrowser ? {
  51608. create: _enter,
  51609. activate: _enter,
  51610. remove: function remove$$1 (vnode, rm) {
  51611. /* istanbul ignore else */
  51612. if (vnode.data.show !== true) {
  51613. leave(vnode, rm);
  51614. } else {
  51615. rm();
  51616. }
  51617. }
  51618. } : {};
  51619. var platformModules = [
  51620. attrs,
  51621. klass,
  51622. events,
  51623. domProps,
  51624. style,
  51625. transition
  51626. ];
  51627. /* */
  51628. // the directive module should be applied last, after all
  51629. // built-in modules have been applied.
  51630. var modules = platformModules.concat(baseModules);
  51631. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  51632. /**
  51633. * Not type checking this file because flow doesn't like attaching
  51634. * properties to Elements.
  51635. */
  51636. /* istanbul ignore if */
  51637. if (isIE9) {
  51638. // http://www.matts411.com/post/internet-explorer-9-oninput/
  51639. document.addEventListener('selectionchange', function () {
  51640. var el = document.activeElement;
  51641. if (el && el.vmodel) {
  51642. trigger(el, 'input');
  51643. }
  51644. });
  51645. }
  51646. var directive = {
  51647. inserted: function inserted (el, binding, vnode, oldVnode) {
  51648. if (vnode.tag === 'select') {
  51649. // #6903
  51650. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  51651. mergeVNodeHook(vnode, 'postpatch', function () {
  51652. directive.componentUpdated(el, binding, vnode);
  51653. });
  51654. } else {
  51655. setSelected(el, binding, vnode.context);
  51656. }
  51657. el._vOptions = [].map.call(el.options, getValue);
  51658. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  51659. el._vModifiers = binding.modifiers;
  51660. if (!binding.modifiers.lazy) {
  51661. el.addEventListener('compositionstart', onCompositionStart);
  51662. el.addEventListener('compositionend', onCompositionEnd);
  51663. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  51664. // switching focus before confirming composition choice
  51665. // this also fixes the issue where some browsers e.g. iOS Chrome
  51666. // fires "change" instead of "input" on autocomplete.
  51667. el.addEventListener('change', onCompositionEnd);
  51668. /* istanbul ignore if */
  51669. if (isIE9) {
  51670. el.vmodel = true;
  51671. }
  51672. }
  51673. }
  51674. },
  51675. componentUpdated: function componentUpdated (el, binding, vnode) {
  51676. if (vnode.tag === 'select') {
  51677. setSelected(el, binding, vnode.context);
  51678. // in case the options rendered by v-for have changed,
  51679. // it's possible that the value is out-of-sync with the rendered options.
  51680. // detect such cases and filter out values that no longer has a matching
  51681. // option in the DOM.
  51682. var prevOptions = el._vOptions;
  51683. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  51684. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  51685. // trigger change event if
  51686. // no matching option found for at least one value
  51687. var needReset = el.multiple
  51688. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  51689. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  51690. if (needReset) {
  51691. trigger(el, 'change');
  51692. }
  51693. }
  51694. }
  51695. }
  51696. };
  51697. function setSelected (el, binding, vm) {
  51698. actuallySetSelected(el, binding, vm);
  51699. /* istanbul ignore if */
  51700. if (isIE || isEdge) {
  51701. setTimeout(function () {
  51702. actuallySetSelected(el, binding, vm);
  51703. }, 0);
  51704. }
  51705. }
  51706. function actuallySetSelected (el, binding, vm) {
  51707. var value = binding.value;
  51708. var isMultiple = el.multiple;
  51709. if (isMultiple && !Array.isArray(value)) {
  51710. warn(
  51711. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  51712. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  51713. vm
  51714. );
  51715. return
  51716. }
  51717. var selected, option;
  51718. for (var i = 0, l = el.options.length; i < l; i++) {
  51719. option = el.options[i];
  51720. if (isMultiple) {
  51721. selected = looseIndexOf(value, getValue(option)) > -1;
  51722. if (option.selected !== selected) {
  51723. option.selected = selected;
  51724. }
  51725. } else {
  51726. if (looseEqual(getValue(option), value)) {
  51727. if (el.selectedIndex !== i) {
  51728. el.selectedIndex = i;
  51729. }
  51730. return
  51731. }
  51732. }
  51733. }
  51734. if (!isMultiple) {
  51735. el.selectedIndex = -1;
  51736. }
  51737. }
  51738. function hasNoMatchingOption (value, options) {
  51739. return options.every(function (o) { return !looseEqual(o, value); })
  51740. }
  51741. function getValue (option) {
  51742. return '_value' in option
  51743. ? option._value
  51744. : option.value
  51745. }
  51746. function onCompositionStart (e) {
  51747. e.target.composing = true;
  51748. }
  51749. function onCompositionEnd (e) {
  51750. // prevent triggering an input event for no reason
  51751. if (!e.target.composing) { return }
  51752. e.target.composing = false;
  51753. trigger(e.target, 'input');
  51754. }
  51755. function trigger (el, type) {
  51756. var e = document.createEvent('HTMLEvents');
  51757. e.initEvent(type, true, true);
  51758. el.dispatchEvent(e);
  51759. }
  51760. /* */
  51761. // recursively search for possible transition defined inside the component root
  51762. function locateNode (vnode) {
  51763. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  51764. ? locateNode(vnode.componentInstance._vnode)
  51765. : vnode
  51766. }
  51767. var show = {
  51768. bind: function bind (el, ref, vnode) {
  51769. var value = ref.value;
  51770. vnode = locateNode(vnode);
  51771. var transition$$1 = vnode.data && vnode.data.transition;
  51772. var originalDisplay = el.__vOriginalDisplay =
  51773. el.style.display === 'none' ? '' : el.style.display;
  51774. if (value && transition$$1) {
  51775. vnode.data.show = true;
  51776. enter(vnode, function () {
  51777. el.style.display = originalDisplay;
  51778. });
  51779. } else {
  51780. el.style.display = value ? originalDisplay : 'none';
  51781. }
  51782. },
  51783. update: function update (el, ref, vnode) {
  51784. var value = ref.value;
  51785. var oldValue = ref.oldValue;
  51786. /* istanbul ignore if */
  51787. if (!value === !oldValue) { return }
  51788. vnode = locateNode(vnode);
  51789. var transition$$1 = vnode.data && vnode.data.transition;
  51790. if (transition$$1) {
  51791. vnode.data.show = true;
  51792. if (value) {
  51793. enter(vnode, function () {
  51794. el.style.display = el.__vOriginalDisplay;
  51795. });
  51796. } else {
  51797. leave(vnode, function () {
  51798. el.style.display = 'none';
  51799. });
  51800. }
  51801. } else {
  51802. el.style.display = value ? el.__vOriginalDisplay : 'none';
  51803. }
  51804. },
  51805. unbind: function unbind (
  51806. el,
  51807. binding,
  51808. vnode,
  51809. oldVnode,
  51810. isDestroy
  51811. ) {
  51812. if (!isDestroy) {
  51813. el.style.display = el.__vOriginalDisplay;
  51814. }
  51815. }
  51816. };
  51817. var platformDirectives = {
  51818. model: directive,
  51819. show: show
  51820. };
  51821. /* */
  51822. var transitionProps = {
  51823. name: String,
  51824. appear: Boolean,
  51825. css: Boolean,
  51826. mode: String,
  51827. type: String,
  51828. enterClass: String,
  51829. leaveClass: String,
  51830. enterToClass: String,
  51831. leaveToClass: String,
  51832. enterActiveClass: String,
  51833. leaveActiveClass: String,
  51834. appearClass: String,
  51835. appearActiveClass: String,
  51836. appearToClass: String,
  51837. duration: [Number, String, Object]
  51838. };
  51839. // in case the child is also an abstract component, e.g. <keep-alive>
  51840. // we want to recursively retrieve the real component to be rendered
  51841. function getRealChild (vnode) {
  51842. var compOptions = vnode && vnode.componentOptions;
  51843. if (compOptions && compOptions.Ctor.options.abstract) {
  51844. return getRealChild(getFirstComponentChild(compOptions.children))
  51845. } else {
  51846. return vnode
  51847. }
  51848. }
  51849. function extractTransitionData (comp) {
  51850. var data = {};
  51851. var options = comp.$options;
  51852. // props
  51853. for (var key in options.propsData) {
  51854. data[key] = comp[key];
  51855. }
  51856. // events.
  51857. // extract listeners and pass them directly to the transition methods
  51858. var listeners = options._parentListeners;
  51859. for (var key$1 in listeners) {
  51860. data[camelize(key$1)] = listeners[key$1];
  51861. }
  51862. return data
  51863. }
  51864. function placeholder (h, rawChild) {
  51865. if (/\d-keep-alive$/.test(rawChild.tag)) {
  51866. return h('keep-alive', {
  51867. props: rawChild.componentOptions.propsData
  51868. })
  51869. }
  51870. }
  51871. function hasParentTransition (vnode) {
  51872. while ((vnode = vnode.parent)) {
  51873. if (vnode.data.transition) {
  51874. return true
  51875. }
  51876. }
  51877. }
  51878. function isSameChild (child, oldChild) {
  51879. return oldChild.key === child.key && oldChild.tag === child.tag
  51880. }
  51881. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  51882. var isVShowDirective = function (d) { return d.name === 'show'; };
  51883. var Transition = {
  51884. name: 'transition',
  51885. props: transitionProps,
  51886. abstract: true,
  51887. render: function render (h) {
  51888. var this$1 = this;
  51889. var children = this.$slots.default;
  51890. if (!children) {
  51891. return
  51892. }
  51893. // filter out text nodes (possible whitespaces)
  51894. children = children.filter(isNotTextNode);
  51895. /* istanbul ignore if */
  51896. if (!children.length) {
  51897. return
  51898. }
  51899. // warn multiple elements
  51900. if (children.length > 1) {
  51901. warn(
  51902. '<transition> can only be used on a single element. Use ' +
  51903. '<transition-group> for lists.',
  51904. this.$parent
  51905. );
  51906. }
  51907. var mode = this.mode;
  51908. // warn invalid mode
  51909. if (mode && mode !== 'in-out' && mode !== 'out-in'
  51910. ) {
  51911. warn(
  51912. 'invalid <transition> mode: ' + mode,
  51913. this.$parent
  51914. );
  51915. }
  51916. var rawChild = children[0];
  51917. // if this is a component root node and the component's
  51918. // parent container node also has transition, skip.
  51919. if (hasParentTransition(this.$vnode)) {
  51920. return rawChild
  51921. }
  51922. // apply transition data to child
  51923. // use getRealChild() to ignore abstract components e.g. keep-alive
  51924. var child = getRealChild(rawChild);
  51925. /* istanbul ignore if */
  51926. if (!child) {
  51927. return rawChild
  51928. }
  51929. if (this._leaving) {
  51930. return placeholder(h, rawChild)
  51931. }
  51932. // ensure a key that is unique to the vnode type and to this transition
  51933. // component instance. This key will be used to remove pending leaving nodes
  51934. // during entering.
  51935. var id = "__transition-" + (this._uid) + "-";
  51936. child.key = child.key == null
  51937. ? child.isComment
  51938. ? id + 'comment'
  51939. : id + child.tag
  51940. : isPrimitive(child.key)
  51941. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  51942. : child.key;
  51943. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  51944. var oldRawChild = this._vnode;
  51945. var oldChild = getRealChild(oldRawChild);
  51946. // mark v-show
  51947. // so that the transition module can hand over the control to the directive
  51948. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  51949. child.data.show = true;
  51950. }
  51951. if (
  51952. oldChild &&
  51953. oldChild.data &&
  51954. !isSameChild(child, oldChild) &&
  51955. !isAsyncPlaceholder(oldChild) &&
  51956. // #6687 component root is a comment node
  51957. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  51958. ) {
  51959. // replace old child transition data with fresh one
  51960. // important for dynamic transitions!
  51961. var oldData = oldChild.data.transition = extend({}, data);
  51962. // handle transition mode
  51963. if (mode === 'out-in') {
  51964. // return placeholder node and queue update when leave finishes
  51965. this._leaving = true;
  51966. mergeVNodeHook(oldData, 'afterLeave', function () {
  51967. this$1._leaving = false;
  51968. this$1.$forceUpdate();
  51969. });
  51970. return placeholder(h, rawChild)
  51971. } else if (mode === 'in-out') {
  51972. if (isAsyncPlaceholder(child)) {
  51973. return oldRawChild
  51974. }
  51975. var delayedLeave;
  51976. var performLeave = function () { delayedLeave(); };
  51977. mergeVNodeHook(data, 'afterEnter', performLeave);
  51978. mergeVNodeHook(data, 'enterCancelled', performLeave);
  51979. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  51980. }
  51981. }
  51982. return rawChild
  51983. }
  51984. };
  51985. /* */
  51986. var props = extend({
  51987. tag: String,
  51988. moveClass: String
  51989. }, transitionProps);
  51990. delete props.mode;
  51991. var TransitionGroup = {
  51992. props: props,
  51993. beforeMount: function beforeMount () {
  51994. var this$1 = this;
  51995. var update = this._update;
  51996. this._update = function (vnode, hydrating) {
  51997. var restoreActiveInstance = setActiveInstance(this$1);
  51998. // force removing pass
  51999. this$1.__patch__(
  52000. this$1._vnode,
  52001. this$1.kept,
  52002. false, // hydrating
  52003. true // removeOnly (!important, avoids unnecessary moves)
  52004. );
  52005. this$1._vnode = this$1.kept;
  52006. restoreActiveInstance();
  52007. update.call(this$1, vnode, hydrating);
  52008. };
  52009. },
  52010. render: function render (h) {
  52011. var tag = this.tag || this.$vnode.data.tag || 'span';
  52012. var map = Object.create(null);
  52013. var prevChildren = this.prevChildren = this.children;
  52014. var rawChildren = this.$slots.default || [];
  52015. var children = this.children = [];
  52016. var transitionData = extractTransitionData(this);
  52017. for (var i = 0; i < rawChildren.length; i++) {
  52018. var c = rawChildren[i];
  52019. if (c.tag) {
  52020. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52021. children.push(c);
  52022. map[c.key] = c
  52023. ;(c.data || (c.data = {})).transition = transitionData;
  52024. } else {
  52025. var opts = c.componentOptions;
  52026. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52027. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52028. }
  52029. }
  52030. }
  52031. if (prevChildren) {
  52032. var kept = [];
  52033. var removed = [];
  52034. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52035. var c$1 = prevChildren[i$1];
  52036. c$1.data.transition = transitionData;
  52037. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52038. if (map[c$1.key]) {
  52039. kept.push(c$1);
  52040. } else {
  52041. removed.push(c$1);
  52042. }
  52043. }
  52044. this.kept = h(tag, null, kept);
  52045. this.removed = removed;
  52046. }
  52047. return h(tag, null, children)
  52048. },
  52049. updated: function updated () {
  52050. var children = this.prevChildren;
  52051. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52052. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52053. return
  52054. }
  52055. // we divide the work into three loops to avoid mixing DOM reads and writes
  52056. // in each iteration - which helps prevent layout thrashing.
  52057. children.forEach(callPendingCbs);
  52058. children.forEach(recordPosition);
  52059. children.forEach(applyTranslation);
  52060. // force reflow to put everything in position
  52061. // assign to this to avoid being removed in tree-shaking
  52062. // $flow-disable-line
  52063. this._reflow = document.body.offsetHeight;
  52064. children.forEach(function (c) {
  52065. if (c.data.moved) {
  52066. var el = c.elm;
  52067. var s = el.style;
  52068. addTransitionClass(el, moveClass);
  52069. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52070. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52071. if (e && e.target !== el) {
  52072. return
  52073. }
  52074. if (!e || /transform$/.test(e.propertyName)) {
  52075. el.removeEventListener(transitionEndEvent, cb);
  52076. el._moveCb = null;
  52077. removeTransitionClass(el, moveClass);
  52078. }
  52079. });
  52080. }
  52081. });
  52082. },
  52083. methods: {
  52084. hasMove: function hasMove (el, moveClass) {
  52085. /* istanbul ignore if */
  52086. if (!hasTransition) {
  52087. return false
  52088. }
  52089. /* istanbul ignore if */
  52090. if (this._hasMove) {
  52091. return this._hasMove
  52092. }
  52093. // Detect whether an element with the move class applied has
  52094. // CSS transitions. Since the element may be inside an entering
  52095. // transition at this very moment, we make a clone of it and remove
  52096. // all other transition classes applied to ensure only the move class
  52097. // is applied.
  52098. var clone = el.cloneNode();
  52099. if (el._transitionClasses) {
  52100. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52101. }
  52102. addClass(clone, moveClass);
  52103. clone.style.display = 'none';
  52104. this.$el.appendChild(clone);
  52105. var info = getTransitionInfo(clone);
  52106. this.$el.removeChild(clone);
  52107. return (this._hasMove = info.hasTransform)
  52108. }
  52109. }
  52110. };
  52111. function callPendingCbs (c) {
  52112. /* istanbul ignore if */
  52113. if (c.elm._moveCb) {
  52114. c.elm._moveCb();
  52115. }
  52116. /* istanbul ignore if */
  52117. if (c.elm._enterCb) {
  52118. c.elm._enterCb();
  52119. }
  52120. }
  52121. function recordPosition (c) {
  52122. c.data.newPos = c.elm.getBoundingClientRect();
  52123. }
  52124. function applyTranslation (c) {
  52125. var oldPos = c.data.pos;
  52126. var newPos = c.data.newPos;
  52127. var dx = oldPos.left - newPos.left;
  52128. var dy = oldPos.top - newPos.top;
  52129. if (dx || dy) {
  52130. c.data.moved = true;
  52131. var s = c.elm.style;
  52132. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52133. s.transitionDuration = '0s';
  52134. }
  52135. }
  52136. var platformComponents = {
  52137. Transition: Transition,
  52138. TransitionGroup: TransitionGroup
  52139. };
  52140. /* */
  52141. // install platform specific utils
  52142. Vue.config.mustUseProp = mustUseProp;
  52143. Vue.config.isReservedTag = isReservedTag;
  52144. Vue.config.isReservedAttr = isReservedAttr;
  52145. Vue.config.getTagNamespace = getTagNamespace;
  52146. Vue.config.isUnknownElement = isUnknownElement;
  52147. // install platform runtime directives & components
  52148. extend(Vue.options.directives, platformDirectives);
  52149. extend(Vue.options.components, platformComponents);
  52150. // install platform patch function
  52151. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52152. // public mount method
  52153. Vue.prototype.$mount = function (
  52154. el,
  52155. hydrating
  52156. ) {
  52157. el = el && inBrowser ? query(el) : undefined;
  52158. return mountComponent(this, el, hydrating)
  52159. };
  52160. // devtools global hook
  52161. /* istanbul ignore next */
  52162. if (inBrowser) {
  52163. setTimeout(function () {
  52164. if (config.devtools) {
  52165. if (devtools) {
  52166. devtools.emit('init', Vue);
  52167. } else {
  52168. console[console.info ? 'info' : 'log'](
  52169. 'Download the Vue Devtools extension for a better development experience:\n' +
  52170. 'https://github.com/vuejs/vue-devtools'
  52171. );
  52172. }
  52173. }
  52174. if (config.productionTip !== false &&
  52175. typeof console !== 'undefined'
  52176. ) {
  52177. console[console.info ? 'info' : 'log'](
  52178. "You are running Vue in development mode.\n" +
  52179. "Make sure to turn on production mode when deploying for production.\n" +
  52180. "See more tips at https://vuejs.org/guide/deployment.html"
  52181. );
  52182. }
  52183. }, 0);
  52184. }
  52185. /* */
  52186. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52187. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52188. var buildRegex = cached(function (delimiters) {
  52189. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52190. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52191. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52192. });
  52193. function parseText (
  52194. text,
  52195. delimiters
  52196. ) {
  52197. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52198. if (!tagRE.test(text)) {
  52199. return
  52200. }
  52201. var tokens = [];
  52202. var rawTokens = [];
  52203. var lastIndex = tagRE.lastIndex = 0;
  52204. var match, index, tokenValue;
  52205. while ((match = tagRE.exec(text))) {
  52206. index = match.index;
  52207. // push text token
  52208. if (index > lastIndex) {
  52209. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52210. tokens.push(JSON.stringify(tokenValue));
  52211. }
  52212. // tag token
  52213. var exp = parseFilters(match[1].trim());
  52214. tokens.push(("_s(" + exp + ")"));
  52215. rawTokens.push({ '@binding': exp });
  52216. lastIndex = index + match[0].length;
  52217. }
  52218. if (lastIndex < text.length) {
  52219. rawTokens.push(tokenValue = text.slice(lastIndex));
  52220. tokens.push(JSON.stringify(tokenValue));
  52221. }
  52222. return {
  52223. expression: tokens.join('+'),
  52224. tokens: rawTokens
  52225. }
  52226. }
  52227. /* */
  52228. function transformNode (el, options) {
  52229. var warn = options.warn || baseWarn;
  52230. var staticClass = getAndRemoveAttr(el, 'class');
  52231. if (staticClass) {
  52232. var res = parseText(staticClass, options.delimiters);
  52233. if (res) {
  52234. warn(
  52235. "class=\"" + staticClass + "\": " +
  52236. 'Interpolation inside attributes has been removed. ' +
  52237. 'Use v-bind or the colon shorthand instead. For example, ' +
  52238. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52239. el.rawAttrsMap['class']
  52240. );
  52241. }
  52242. }
  52243. if (staticClass) {
  52244. el.staticClass = JSON.stringify(staticClass);
  52245. }
  52246. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52247. if (classBinding) {
  52248. el.classBinding = classBinding;
  52249. }
  52250. }
  52251. function genData (el) {
  52252. var data = '';
  52253. if (el.staticClass) {
  52254. data += "staticClass:" + (el.staticClass) + ",";
  52255. }
  52256. if (el.classBinding) {
  52257. data += "class:" + (el.classBinding) + ",";
  52258. }
  52259. return data
  52260. }
  52261. var klass$1 = {
  52262. staticKeys: ['staticClass'],
  52263. transformNode: transformNode,
  52264. genData: genData
  52265. };
  52266. /* */
  52267. function transformNode$1 (el, options) {
  52268. var warn = options.warn || baseWarn;
  52269. var staticStyle = getAndRemoveAttr(el, 'style');
  52270. if (staticStyle) {
  52271. /* istanbul ignore if */
  52272. {
  52273. var res = parseText(staticStyle, options.delimiters);
  52274. if (res) {
  52275. warn(
  52276. "style=\"" + staticStyle + "\": " +
  52277. 'Interpolation inside attributes has been removed. ' +
  52278. 'Use v-bind or the colon shorthand instead. For example, ' +
  52279. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52280. el.rawAttrsMap['style']
  52281. );
  52282. }
  52283. }
  52284. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52285. }
  52286. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52287. if (styleBinding) {
  52288. el.styleBinding = styleBinding;
  52289. }
  52290. }
  52291. function genData$1 (el) {
  52292. var data = '';
  52293. if (el.staticStyle) {
  52294. data += "staticStyle:" + (el.staticStyle) + ",";
  52295. }
  52296. if (el.styleBinding) {
  52297. data += "style:(" + (el.styleBinding) + "),";
  52298. }
  52299. return data
  52300. }
  52301. var style$1 = {
  52302. staticKeys: ['staticStyle'],
  52303. transformNode: transformNode$1,
  52304. genData: genData$1
  52305. };
  52306. /* */
  52307. var decoder;
  52308. var he = {
  52309. decode: function decode (html) {
  52310. decoder = decoder || document.createElement('div');
  52311. decoder.innerHTML = html;
  52312. return decoder.textContent
  52313. }
  52314. };
  52315. /* */
  52316. var isUnaryTag = makeMap(
  52317. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52318. 'link,meta,param,source,track,wbr'
  52319. );
  52320. // Elements that you can, intentionally, leave open
  52321. // (and which close themselves)
  52322. var canBeLeftOpenTag = makeMap(
  52323. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52324. );
  52325. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52326. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52327. var isNonPhrasingTag = makeMap(
  52328. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52329. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52330. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52331. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52332. 'title,tr,track'
  52333. );
  52334. /**
  52335. * Not type-checking this file because it's mostly vendor code.
  52336. */
  52337. // Regular Expressions for parsing tags and attributes
  52338. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52339. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52340. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52341. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52342. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52343. var startTagClose = /^\s*(\/?)>/;
  52344. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52345. var doctype = /^<!DOCTYPE [^>]+>/i;
  52346. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52347. var comment = /^<!\--/;
  52348. var conditionalComment = /^<!\[/;
  52349. // Special Elements (can contain anything)
  52350. var isPlainTextElement = makeMap('script,style,textarea', true);
  52351. var reCache = {};
  52352. var decodingMap = {
  52353. '&lt;': '<',
  52354. '&gt;': '>',
  52355. '&quot;': '"',
  52356. '&amp;': '&',
  52357. '&#10;': '\n',
  52358. '&#9;': '\t',
  52359. '&#39;': "'"
  52360. };
  52361. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52362. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52363. // #5992
  52364. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52365. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52366. function decodeAttr (value, shouldDecodeNewlines) {
  52367. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52368. return value.replace(re, function (match) { return decodingMap[match]; })
  52369. }
  52370. function parseHTML (html, options) {
  52371. var stack = [];
  52372. var expectHTML = options.expectHTML;
  52373. var isUnaryTag$$1 = options.isUnaryTag || no;
  52374. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52375. var index = 0;
  52376. var last, lastTag;
  52377. while (html) {
  52378. last = html;
  52379. // Make sure we're not in a plaintext content element like script/style
  52380. if (!lastTag || !isPlainTextElement(lastTag)) {
  52381. var textEnd = html.indexOf('<');
  52382. if (textEnd === 0) {
  52383. // Comment:
  52384. if (comment.test(html)) {
  52385. var commentEnd = html.indexOf('-->');
  52386. if (commentEnd >= 0) {
  52387. if (options.shouldKeepComment) {
  52388. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52389. }
  52390. advance(commentEnd + 3);
  52391. continue
  52392. }
  52393. }
  52394. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52395. if (conditionalComment.test(html)) {
  52396. var conditionalEnd = html.indexOf(']>');
  52397. if (conditionalEnd >= 0) {
  52398. advance(conditionalEnd + 2);
  52399. continue
  52400. }
  52401. }
  52402. // Doctype:
  52403. var doctypeMatch = html.match(doctype);
  52404. if (doctypeMatch) {
  52405. advance(doctypeMatch[0].length);
  52406. continue
  52407. }
  52408. // End tag:
  52409. var endTagMatch = html.match(endTag);
  52410. if (endTagMatch) {
  52411. var curIndex = index;
  52412. advance(endTagMatch[0].length);
  52413. parseEndTag(endTagMatch[1], curIndex, index);
  52414. continue
  52415. }
  52416. // Start tag:
  52417. var startTagMatch = parseStartTag();
  52418. if (startTagMatch) {
  52419. handleStartTag(startTagMatch);
  52420. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52421. advance(1);
  52422. }
  52423. continue
  52424. }
  52425. }
  52426. var text = (void 0), rest = (void 0), next = (void 0);
  52427. if (textEnd >= 0) {
  52428. rest = html.slice(textEnd);
  52429. while (
  52430. !endTag.test(rest) &&
  52431. !startTagOpen.test(rest) &&
  52432. !comment.test(rest) &&
  52433. !conditionalComment.test(rest)
  52434. ) {
  52435. // < in plain text, be forgiving and treat it as text
  52436. next = rest.indexOf('<', 1);
  52437. if (next < 0) { break }
  52438. textEnd += next;
  52439. rest = html.slice(textEnd);
  52440. }
  52441. text = html.substring(0, textEnd);
  52442. }
  52443. if (textEnd < 0) {
  52444. text = html;
  52445. }
  52446. if (text) {
  52447. advance(text.length);
  52448. }
  52449. if (options.chars && text) {
  52450. options.chars(text, index - text.length, index);
  52451. }
  52452. } else {
  52453. var endTagLength = 0;
  52454. var stackedTag = lastTag.toLowerCase();
  52455. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52456. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52457. endTagLength = endTag.length;
  52458. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52459. text = text
  52460. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52461. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52462. }
  52463. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52464. text = text.slice(1);
  52465. }
  52466. if (options.chars) {
  52467. options.chars(text);
  52468. }
  52469. return ''
  52470. });
  52471. index += html.length - rest$1.length;
  52472. html = rest$1;
  52473. parseEndTag(stackedTag, index - endTagLength, index);
  52474. }
  52475. if (html === last) {
  52476. options.chars && options.chars(html);
  52477. if (!stack.length && options.warn) {
  52478. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  52479. }
  52480. break
  52481. }
  52482. }
  52483. // Clean up any remaining tags
  52484. parseEndTag();
  52485. function advance (n) {
  52486. index += n;
  52487. html = html.substring(n);
  52488. }
  52489. function parseStartTag () {
  52490. var start = html.match(startTagOpen);
  52491. if (start) {
  52492. var match = {
  52493. tagName: start[1],
  52494. attrs: [],
  52495. start: index
  52496. };
  52497. advance(start[0].length);
  52498. var end, attr;
  52499. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  52500. attr.start = index;
  52501. advance(attr[0].length);
  52502. attr.end = index;
  52503. match.attrs.push(attr);
  52504. }
  52505. if (end) {
  52506. match.unarySlash = end[1];
  52507. advance(end[0].length);
  52508. match.end = index;
  52509. return match
  52510. }
  52511. }
  52512. }
  52513. function handleStartTag (match) {
  52514. var tagName = match.tagName;
  52515. var unarySlash = match.unarySlash;
  52516. if (expectHTML) {
  52517. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  52518. parseEndTag(lastTag);
  52519. }
  52520. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  52521. parseEndTag(tagName);
  52522. }
  52523. }
  52524. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  52525. var l = match.attrs.length;
  52526. var attrs = new Array(l);
  52527. for (var i = 0; i < l; i++) {
  52528. var args = match.attrs[i];
  52529. var value = args[3] || args[4] || args[5] || '';
  52530. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  52531. ? options.shouldDecodeNewlinesForHref
  52532. : options.shouldDecodeNewlines;
  52533. attrs[i] = {
  52534. name: args[1],
  52535. value: decodeAttr(value, shouldDecodeNewlines)
  52536. };
  52537. if (options.outputSourceRange) {
  52538. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  52539. attrs[i].end = args.end;
  52540. }
  52541. }
  52542. if (!unary) {
  52543. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  52544. lastTag = tagName;
  52545. }
  52546. if (options.start) {
  52547. options.start(tagName, attrs, unary, match.start, match.end);
  52548. }
  52549. }
  52550. function parseEndTag (tagName, start, end) {
  52551. var pos, lowerCasedTagName;
  52552. if (start == null) { start = index; }
  52553. if (end == null) { end = index; }
  52554. // Find the closest opened tag of the same type
  52555. if (tagName) {
  52556. lowerCasedTagName = tagName.toLowerCase();
  52557. for (pos = stack.length - 1; pos >= 0; pos--) {
  52558. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  52559. break
  52560. }
  52561. }
  52562. } else {
  52563. // If no tag name is provided, clean shop
  52564. pos = 0;
  52565. }
  52566. if (pos >= 0) {
  52567. // Close all the open elements, up the stack
  52568. for (var i = stack.length - 1; i >= pos; i--) {
  52569. if (i > pos || !tagName &&
  52570. options.warn
  52571. ) {
  52572. options.warn(
  52573. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  52574. { start: stack[i].start, end: stack[i].end }
  52575. );
  52576. }
  52577. if (options.end) {
  52578. options.end(stack[i].tag, start, end);
  52579. }
  52580. }
  52581. // Remove the open elements from the stack
  52582. stack.length = pos;
  52583. lastTag = pos && stack[pos - 1].tag;
  52584. } else if (lowerCasedTagName === 'br') {
  52585. if (options.start) {
  52586. options.start(tagName, [], true, start, end);
  52587. }
  52588. } else if (lowerCasedTagName === 'p') {
  52589. if (options.start) {
  52590. options.start(tagName, [], false, start, end);
  52591. }
  52592. if (options.end) {
  52593. options.end(tagName, start, end);
  52594. }
  52595. }
  52596. }
  52597. }
  52598. /* */
  52599. var onRE = /^@|^v-on:/;
  52600. var dirRE = /^v-|^@|^:|^#/;
  52601. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  52602. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  52603. var stripParensRE = /^\(|\)$/g;
  52604. var dynamicArgRE = /^\[.*\]$/;
  52605. var argRE = /:(.*)$/;
  52606. var bindRE = /^:|^\.|^v-bind:/;
  52607. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  52608. var slotRE = /^v-slot(:|$)|^#/;
  52609. var lineBreakRE = /[\r\n]/;
  52610. var whitespaceRE$1 = /\s+/g;
  52611. var invalidAttributeRE = /[\s"'<>\/=]/;
  52612. var decodeHTMLCached = cached(he.decode);
  52613. var emptySlotScopeToken = "_empty_";
  52614. // configurable state
  52615. var warn$2;
  52616. var delimiters;
  52617. var transforms;
  52618. var preTransforms;
  52619. var postTransforms;
  52620. var platformIsPreTag;
  52621. var platformMustUseProp;
  52622. var platformGetTagNamespace;
  52623. var maybeComponent;
  52624. function createASTElement (
  52625. tag,
  52626. attrs,
  52627. parent
  52628. ) {
  52629. return {
  52630. type: 1,
  52631. tag: tag,
  52632. attrsList: attrs,
  52633. attrsMap: makeAttrsMap(attrs),
  52634. rawAttrsMap: {},
  52635. parent: parent,
  52636. children: []
  52637. }
  52638. }
  52639. /**
  52640. * Convert HTML string to AST.
  52641. */
  52642. function parse (
  52643. template,
  52644. options
  52645. ) {
  52646. warn$2 = options.warn || baseWarn;
  52647. platformIsPreTag = options.isPreTag || no;
  52648. platformMustUseProp = options.mustUseProp || no;
  52649. platformGetTagNamespace = options.getTagNamespace || no;
  52650. var isReservedTag = options.isReservedTag || no;
  52651. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  52652. transforms = pluckModuleFunction(options.modules, 'transformNode');
  52653. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  52654. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  52655. delimiters = options.delimiters;
  52656. var stack = [];
  52657. var preserveWhitespace = options.preserveWhitespace !== false;
  52658. var whitespaceOption = options.whitespace;
  52659. var root;
  52660. var currentParent;
  52661. var inVPre = false;
  52662. var inPre = false;
  52663. var warned = false;
  52664. function warnOnce (msg, range) {
  52665. if (!warned) {
  52666. warned = true;
  52667. warn$2(msg, range);
  52668. }
  52669. }
  52670. function closeElement (element) {
  52671. trimEndingWhitespace(element);
  52672. if (!inVPre && !element.processed) {
  52673. element = processElement(element, options);
  52674. }
  52675. // tree management
  52676. if (!stack.length && element !== root) {
  52677. // allow root elements with v-if, v-else-if and v-else
  52678. if (root.if && (element.elseif || element.else)) {
  52679. {
  52680. checkRootConstraints(element);
  52681. }
  52682. addIfCondition(root, {
  52683. exp: element.elseif,
  52684. block: element
  52685. });
  52686. } else {
  52687. warnOnce(
  52688. "Component template should contain exactly one root element. " +
  52689. "If you are using v-if on multiple elements, " +
  52690. "use v-else-if to chain them instead.",
  52691. { start: element.start }
  52692. );
  52693. }
  52694. }
  52695. if (currentParent && !element.forbidden) {
  52696. if (element.elseif || element.else) {
  52697. processIfConditions(element, currentParent);
  52698. } else {
  52699. if (element.slotScope) {
  52700. // scoped slot
  52701. // keep it in the children list so that v-else(-if) conditions can
  52702. // find it as the prev node.
  52703. var name = element.slotTarget || '"default"'
  52704. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  52705. }
  52706. currentParent.children.push(element);
  52707. element.parent = currentParent;
  52708. }
  52709. }
  52710. // final children cleanup
  52711. // filter out scoped slots
  52712. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  52713. // remove trailing whitespace node again
  52714. trimEndingWhitespace(element);
  52715. // check pre state
  52716. if (element.pre) {
  52717. inVPre = false;
  52718. }
  52719. if (platformIsPreTag(element.tag)) {
  52720. inPre = false;
  52721. }
  52722. // apply post-transforms
  52723. for (var i = 0; i < postTransforms.length; i++) {
  52724. postTransforms[i](element, options);
  52725. }
  52726. }
  52727. function trimEndingWhitespace (el) {
  52728. // remove trailing whitespace node
  52729. if (!inPre) {
  52730. var lastNode;
  52731. while (
  52732. (lastNode = el.children[el.children.length - 1]) &&
  52733. lastNode.type === 3 &&
  52734. lastNode.text === ' '
  52735. ) {
  52736. el.children.pop();
  52737. }
  52738. }
  52739. }
  52740. function checkRootConstraints (el) {
  52741. if (el.tag === 'slot' || el.tag === 'template') {
  52742. warnOnce(
  52743. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  52744. 'contain multiple nodes.',
  52745. { start: el.start }
  52746. );
  52747. }
  52748. if (el.attrsMap.hasOwnProperty('v-for')) {
  52749. warnOnce(
  52750. 'Cannot use v-for on stateful component root element because ' +
  52751. 'it renders multiple elements.',
  52752. el.rawAttrsMap['v-for']
  52753. );
  52754. }
  52755. }
  52756. parseHTML(template, {
  52757. warn: warn$2,
  52758. expectHTML: options.expectHTML,
  52759. isUnaryTag: options.isUnaryTag,
  52760. canBeLeftOpenTag: options.canBeLeftOpenTag,
  52761. shouldDecodeNewlines: options.shouldDecodeNewlines,
  52762. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  52763. shouldKeepComment: options.comments,
  52764. outputSourceRange: options.outputSourceRange,
  52765. start: function start (tag, attrs, unary, start$1, end) {
  52766. // check namespace.
  52767. // inherit parent ns if there is one
  52768. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  52769. // handle IE svg bug
  52770. /* istanbul ignore if */
  52771. if (isIE && ns === 'svg') {
  52772. attrs = guardIESVGBug(attrs);
  52773. }
  52774. var element = createASTElement(tag, attrs, currentParent);
  52775. if (ns) {
  52776. element.ns = ns;
  52777. }
  52778. {
  52779. if (options.outputSourceRange) {
  52780. element.start = start$1;
  52781. element.end = end;
  52782. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  52783. cumulated[attr.name] = attr;
  52784. return cumulated
  52785. }, {});
  52786. }
  52787. attrs.forEach(function (attr) {
  52788. if (invalidAttributeRE.test(attr.name)) {
  52789. warn$2(
  52790. "Invalid dynamic argument expression: attribute names cannot contain " +
  52791. "spaces, quotes, <, >, / or =.",
  52792. {
  52793. start: attr.start + attr.name.indexOf("["),
  52794. end: attr.start + attr.name.length
  52795. }
  52796. );
  52797. }
  52798. });
  52799. }
  52800. if (isForbiddenTag(element) && !isServerRendering()) {
  52801. element.forbidden = true;
  52802. warn$2(
  52803. 'Templates should only be responsible for mapping the state to the ' +
  52804. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  52805. "<" + tag + ">" + ', as they will not be parsed.',
  52806. { start: element.start }
  52807. );
  52808. }
  52809. // apply pre-transforms
  52810. for (var i = 0; i < preTransforms.length; i++) {
  52811. element = preTransforms[i](element, options) || element;
  52812. }
  52813. if (!inVPre) {
  52814. processPre(element);
  52815. if (element.pre) {
  52816. inVPre = true;
  52817. }
  52818. }
  52819. if (platformIsPreTag(element.tag)) {
  52820. inPre = true;
  52821. }
  52822. if (inVPre) {
  52823. processRawAttrs(element);
  52824. } else if (!element.processed) {
  52825. // structural directives
  52826. processFor(element);
  52827. processIf(element);
  52828. processOnce(element);
  52829. }
  52830. if (!root) {
  52831. root = element;
  52832. {
  52833. checkRootConstraints(root);
  52834. }
  52835. }
  52836. if (!unary) {
  52837. currentParent = element;
  52838. stack.push(element);
  52839. } else {
  52840. closeElement(element);
  52841. }
  52842. },
  52843. end: function end (tag, start, end$1) {
  52844. var element = stack[stack.length - 1];
  52845. // pop stack
  52846. stack.length -= 1;
  52847. currentParent = stack[stack.length - 1];
  52848. if (options.outputSourceRange) {
  52849. element.end = end$1;
  52850. }
  52851. closeElement(element);
  52852. },
  52853. chars: function chars (text, start, end) {
  52854. if (!currentParent) {
  52855. {
  52856. if (text === template) {
  52857. warnOnce(
  52858. 'Component template requires a root element, rather than just text.',
  52859. { start: start }
  52860. );
  52861. } else if ((text = text.trim())) {
  52862. warnOnce(
  52863. ("text \"" + text + "\" outside root element will be ignored."),
  52864. { start: start }
  52865. );
  52866. }
  52867. }
  52868. return
  52869. }
  52870. // IE textarea placeholder bug
  52871. /* istanbul ignore if */
  52872. if (isIE &&
  52873. currentParent.tag === 'textarea' &&
  52874. currentParent.attrsMap.placeholder === text
  52875. ) {
  52876. return
  52877. }
  52878. var children = currentParent.children;
  52879. if (inPre || text.trim()) {
  52880. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  52881. } else if (!children.length) {
  52882. // remove the whitespace-only node right after an opening tag
  52883. text = '';
  52884. } else if (whitespaceOption) {
  52885. if (whitespaceOption === 'condense') {
  52886. // in condense mode, remove the whitespace node if it contains
  52887. // line break, otherwise condense to a single space
  52888. text = lineBreakRE.test(text) ? '' : ' ';
  52889. } else {
  52890. text = ' ';
  52891. }
  52892. } else {
  52893. text = preserveWhitespace ? ' ' : '';
  52894. }
  52895. if (text) {
  52896. if (!inPre && whitespaceOption === 'condense') {
  52897. // condense consecutive whitespaces into single space
  52898. text = text.replace(whitespaceRE$1, ' ');
  52899. }
  52900. var res;
  52901. var child;
  52902. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  52903. child = {
  52904. type: 2,
  52905. expression: res.expression,
  52906. tokens: res.tokens,
  52907. text: text
  52908. };
  52909. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  52910. child = {
  52911. type: 3,
  52912. text: text
  52913. };
  52914. }
  52915. if (child) {
  52916. if (options.outputSourceRange) {
  52917. child.start = start;
  52918. child.end = end;
  52919. }
  52920. children.push(child);
  52921. }
  52922. }
  52923. },
  52924. comment: function comment (text, start, end) {
  52925. // adding anyting as a sibling to the root node is forbidden
  52926. // comments should still be allowed, but ignored
  52927. if (currentParent) {
  52928. var child = {
  52929. type: 3,
  52930. text: text,
  52931. isComment: true
  52932. };
  52933. if (options.outputSourceRange) {
  52934. child.start = start;
  52935. child.end = end;
  52936. }
  52937. currentParent.children.push(child);
  52938. }
  52939. }
  52940. });
  52941. return root
  52942. }
  52943. function processPre (el) {
  52944. if (getAndRemoveAttr(el, 'v-pre') != null) {
  52945. el.pre = true;
  52946. }
  52947. }
  52948. function processRawAttrs (el) {
  52949. var list = el.attrsList;
  52950. var len = list.length;
  52951. if (len) {
  52952. var attrs = el.attrs = new Array(len);
  52953. for (var i = 0; i < len; i++) {
  52954. attrs[i] = {
  52955. name: list[i].name,
  52956. value: JSON.stringify(list[i].value)
  52957. };
  52958. if (list[i].start != null) {
  52959. attrs[i].start = list[i].start;
  52960. attrs[i].end = list[i].end;
  52961. }
  52962. }
  52963. } else if (!el.pre) {
  52964. // non root node in pre blocks with no attributes
  52965. el.plain = true;
  52966. }
  52967. }
  52968. function processElement (
  52969. element,
  52970. options
  52971. ) {
  52972. processKey(element);
  52973. // determine whether this is a plain element after
  52974. // removing structural attributes
  52975. element.plain = (
  52976. !element.key &&
  52977. !element.scopedSlots &&
  52978. !element.attrsList.length
  52979. );
  52980. processRef(element);
  52981. processSlotContent(element);
  52982. processSlotOutlet(element);
  52983. processComponent(element);
  52984. for (var i = 0; i < transforms.length; i++) {
  52985. element = transforms[i](element, options) || element;
  52986. }
  52987. processAttrs(element);
  52988. return element
  52989. }
  52990. function processKey (el) {
  52991. var exp = getBindingAttr(el, 'key');
  52992. if (exp) {
  52993. {
  52994. if (el.tag === 'template') {
  52995. warn$2(
  52996. "<template> cannot be keyed. Place the key on real elements instead.",
  52997. getRawBindingAttr(el, 'key')
  52998. );
  52999. }
  53000. if (el.for) {
  53001. var iterator = el.iterator2 || el.iterator1;
  53002. var parent = el.parent;
  53003. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53004. warn$2(
  53005. "Do not use v-for index as key on <transition-group> children, " +
  53006. "this is the same as not using keys.",
  53007. getRawBindingAttr(el, 'key'),
  53008. true /* tip */
  53009. );
  53010. }
  53011. }
  53012. }
  53013. el.key = exp;
  53014. }
  53015. }
  53016. function processRef (el) {
  53017. var ref = getBindingAttr(el, 'ref');
  53018. if (ref) {
  53019. el.ref = ref;
  53020. el.refInFor = checkInFor(el);
  53021. }
  53022. }
  53023. function processFor (el) {
  53024. var exp;
  53025. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53026. var res = parseFor(exp);
  53027. if (res) {
  53028. extend(el, res);
  53029. } else {
  53030. warn$2(
  53031. ("Invalid v-for expression: " + exp),
  53032. el.rawAttrsMap['v-for']
  53033. );
  53034. }
  53035. }
  53036. }
  53037. function parseFor (exp) {
  53038. var inMatch = exp.match(forAliasRE);
  53039. if (!inMatch) { return }
  53040. var res = {};
  53041. res.for = inMatch[2].trim();
  53042. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53043. var iteratorMatch = alias.match(forIteratorRE);
  53044. if (iteratorMatch) {
  53045. res.alias = alias.replace(forIteratorRE, '').trim();
  53046. res.iterator1 = iteratorMatch[1].trim();
  53047. if (iteratorMatch[2]) {
  53048. res.iterator2 = iteratorMatch[2].trim();
  53049. }
  53050. } else {
  53051. res.alias = alias;
  53052. }
  53053. return res
  53054. }
  53055. function processIf (el) {
  53056. var exp = getAndRemoveAttr(el, 'v-if');
  53057. if (exp) {
  53058. el.if = exp;
  53059. addIfCondition(el, {
  53060. exp: exp,
  53061. block: el
  53062. });
  53063. } else {
  53064. if (getAndRemoveAttr(el, 'v-else') != null) {
  53065. el.else = true;
  53066. }
  53067. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53068. if (elseif) {
  53069. el.elseif = elseif;
  53070. }
  53071. }
  53072. }
  53073. function processIfConditions (el, parent) {
  53074. var prev = findPrevElement(parent.children);
  53075. if (prev && prev.if) {
  53076. addIfCondition(prev, {
  53077. exp: el.elseif,
  53078. block: el
  53079. });
  53080. } else {
  53081. warn$2(
  53082. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53083. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53084. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53085. );
  53086. }
  53087. }
  53088. function findPrevElement (children) {
  53089. var i = children.length;
  53090. while (i--) {
  53091. if (children[i].type === 1) {
  53092. return children[i]
  53093. } else {
  53094. if (children[i].text !== ' ') {
  53095. warn$2(
  53096. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53097. "will be ignored.",
  53098. children[i]
  53099. );
  53100. }
  53101. children.pop();
  53102. }
  53103. }
  53104. }
  53105. function addIfCondition (el, condition) {
  53106. if (!el.ifConditions) {
  53107. el.ifConditions = [];
  53108. }
  53109. el.ifConditions.push(condition);
  53110. }
  53111. function processOnce (el) {
  53112. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53113. if (once$$1 != null) {
  53114. el.once = true;
  53115. }
  53116. }
  53117. // handle content being passed to a component as slot,
  53118. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53119. function processSlotContent (el) {
  53120. var slotScope;
  53121. if (el.tag === 'template') {
  53122. slotScope = getAndRemoveAttr(el, 'scope');
  53123. /* istanbul ignore if */
  53124. if (slotScope) {
  53125. warn$2(
  53126. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53127. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53128. "can also be used on plain elements in addition to <template> to " +
  53129. "denote scoped slots.",
  53130. el.rawAttrsMap['scope'],
  53131. true
  53132. );
  53133. }
  53134. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53135. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53136. /* istanbul ignore if */
  53137. if (el.attrsMap['v-for']) {
  53138. warn$2(
  53139. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53140. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53141. "scoped slot to make it clearer.",
  53142. el.rawAttrsMap['slot-scope'],
  53143. true
  53144. );
  53145. }
  53146. el.slotScope = slotScope;
  53147. }
  53148. // slot="xxx"
  53149. var slotTarget = getBindingAttr(el, 'slot');
  53150. if (slotTarget) {
  53151. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53152. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53153. // preserve slot as an attribute for native shadow DOM compat
  53154. // only for non-scoped slots.
  53155. if (el.tag !== 'template' && !el.slotScope) {
  53156. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53157. }
  53158. }
  53159. // 2.6 v-slot syntax
  53160. {
  53161. if (el.tag === 'template') {
  53162. // v-slot on <template>
  53163. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53164. if (slotBinding) {
  53165. {
  53166. if (el.slotTarget || el.slotScope) {
  53167. warn$2(
  53168. "Unexpected mixed usage of different slot syntaxes.",
  53169. el
  53170. );
  53171. }
  53172. if (el.parent && !maybeComponent(el.parent)) {
  53173. warn$2(
  53174. "<template v-slot> can only appear at the root level inside " +
  53175. "the receiving component",
  53176. el
  53177. );
  53178. }
  53179. }
  53180. var ref = getSlotName(slotBinding);
  53181. var name = ref.name;
  53182. var dynamic = ref.dynamic;
  53183. el.slotTarget = name;
  53184. el.slotTargetDynamic = dynamic;
  53185. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53186. }
  53187. } else {
  53188. // v-slot on component, denotes default slot
  53189. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53190. if (slotBinding$1) {
  53191. {
  53192. if (!maybeComponent(el)) {
  53193. warn$2(
  53194. "v-slot can only be used on components or <template>.",
  53195. slotBinding$1
  53196. );
  53197. }
  53198. if (el.slotScope || el.slotTarget) {
  53199. warn$2(
  53200. "Unexpected mixed usage of different slot syntaxes.",
  53201. el
  53202. );
  53203. }
  53204. if (el.scopedSlots) {
  53205. warn$2(
  53206. "To avoid scope ambiguity, the default slot should also use " +
  53207. "<template> syntax when there are other named slots.",
  53208. slotBinding$1
  53209. );
  53210. }
  53211. }
  53212. // add the component's children to its default slot
  53213. var slots = el.scopedSlots || (el.scopedSlots = {});
  53214. var ref$1 = getSlotName(slotBinding$1);
  53215. var name$1 = ref$1.name;
  53216. var dynamic$1 = ref$1.dynamic;
  53217. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53218. slotContainer.slotTarget = name$1;
  53219. slotContainer.slotTargetDynamic = dynamic$1;
  53220. slotContainer.children = el.children.filter(function (c) {
  53221. if (!c.slotScope) {
  53222. c.parent = slotContainer;
  53223. return true
  53224. }
  53225. });
  53226. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53227. // remove children as they are returned from scopedSlots now
  53228. el.children = [];
  53229. // mark el non-plain so data gets generated
  53230. el.plain = false;
  53231. }
  53232. }
  53233. }
  53234. }
  53235. function getSlotName (binding) {
  53236. var name = binding.name.replace(slotRE, '');
  53237. if (!name) {
  53238. if (binding.name[0] !== '#') {
  53239. name = 'default';
  53240. } else {
  53241. warn$2(
  53242. "v-slot shorthand syntax requires a slot name.",
  53243. binding
  53244. );
  53245. }
  53246. }
  53247. return dynamicArgRE.test(name)
  53248. // dynamic [name]
  53249. ? { name: name.slice(1, -1), dynamic: true }
  53250. // static name
  53251. : { name: ("\"" + name + "\""), dynamic: false }
  53252. }
  53253. // handle <slot/> outlets
  53254. function processSlotOutlet (el) {
  53255. if (el.tag === 'slot') {
  53256. el.slotName = getBindingAttr(el, 'name');
  53257. if (el.key) {
  53258. warn$2(
  53259. "`key` does not work on <slot> because slots are abstract outlets " +
  53260. "and can possibly expand into multiple elements. " +
  53261. "Use the key on a wrapping element instead.",
  53262. getRawBindingAttr(el, 'key')
  53263. );
  53264. }
  53265. }
  53266. }
  53267. function processComponent (el) {
  53268. var binding;
  53269. if ((binding = getBindingAttr(el, 'is'))) {
  53270. el.component = binding;
  53271. }
  53272. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53273. el.inlineTemplate = true;
  53274. }
  53275. }
  53276. function processAttrs (el) {
  53277. var list = el.attrsList;
  53278. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53279. for (i = 0, l = list.length; i < l; i++) {
  53280. name = rawName = list[i].name;
  53281. value = list[i].value;
  53282. if (dirRE.test(name)) {
  53283. // mark element as dynamic
  53284. el.hasBindings = true;
  53285. // modifiers
  53286. modifiers = parseModifiers(name.replace(dirRE, ''));
  53287. // support .foo shorthand syntax for the .prop modifier
  53288. if (modifiers) {
  53289. name = name.replace(modifierRE, '');
  53290. }
  53291. if (bindRE.test(name)) { // v-bind
  53292. name = name.replace(bindRE, '');
  53293. value = parseFilters(value);
  53294. isDynamic = dynamicArgRE.test(name);
  53295. if (isDynamic) {
  53296. name = name.slice(1, -1);
  53297. }
  53298. if (
  53299. value.trim().length === 0
  53300. ) {
  53301. warn$2(
  53302. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53303. );
  53304. }
  53305. if (modifiers) {
  53306. if (modifiers.prop && !isDynamic) {
  53307. name = camelize(name);
  53308. if (name === 'innerHtml') { name = 'innerHTML'; }
  53309. }
  53310. if (modifiers.camel && !isDynamic) {
  53311. name = camelize(name);
  53312. }
  53313. if (modifiers.sync) {
  53314. syncGen = genAssignmentCode(value, "$event");
  53315. if (!isDynamic) {
  53316. addHandler(
  53317. el,
  53318. ("update:" + (camelize(name))),
  53319. syncGen,
  53320. null,
  53321. false,
  53322. warn$2,
  53323. list[i]
  53324. );
  53325. if (hyphenate(name) !== camelize(name)) {
  53326. addHandler(
  53327. el,
  53328. ("update:" + (hyphenate(name))),
  53329. syncGen,
  53330. null,
  53331. false,
  53332. warn$2,
  53333. list[i]
  53334. );
  53335. }
  53336. } else {
  53337. // handler w/ dynamic event name
  53338. addHandler(
  53339. el,
  53340. ("\"update:\"+(" + name + ")"),
  53341. syncGen,
  53342. null,
  53343. false,
  53344. warn$2,
  53345. list[i],
  53346. true // dynamic
  53347. );
  53348. }
  53349. }
  53350. }
  53351. if ((modifiers && modifiers.prop) || (
  53352. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53353. )) {
  53354. addProp(el, name, value, list[i], isDynamic);
  53355. } else {
  53356. addAttr(el, name, value, list[i], isDynamic);
  53357. }
  53358. } else if (onRE.test(name)) { // v-on
  53359. name = name.replace(onRE, '');
  53360. isDynamic = dynamicArgRE.test(name);
  53361. if (isDynamic) {
  53362. name = name.slice(1, -1);
  53363. }
  53364. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53365. } else { // normal directives
  53366. name = name.replace(dirRE, '');
  53367. // parse arg
  53368. var argMatch = name.match(argRE);
  53369. var arg = argMatch && argMatch[1];
  53370. isDynamic = false;
  53371. if (arg) {
  53372. name = name.slice(0, -(arg.length + 1));
  53373. if (dynamicArgRE.test(arg)) {
  53374. arg = arg.slice(1, -1);
  53375. isDynamic = true;
  53376. }
  53377. }
  53378. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53379. if (name === 'model') {
  53380. checkForAliasModel(el, value);
  53381. }
  53382. }
  53383. } else {
  53384. // literal attribute
  53385. {
  53386. var res = parseText(value, delimiters);
  53387. if (res) {
  53388. warn$2(
  53389. name + "=\"" + value + "\": " +
  53390. 'Interpolation inside attributes has been removed. ' +
  53391. 'Use v-bind or the colon shorthand instead. For example, ' +
  53392. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53393. list[i]
  53394. );
  53395. }
  53396. }
  53397. addAttr(el, name, JSON.stringify(value), list[i]);
  53398. // #6887 firefox doesn't update muted state if set via attribute
  53399. // even immediately after element creation
  53400. if (!el.component &&
  53401. name === 'muted' &&
  53402. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53403. addProp(el, name, 'true', list[i]);
  53404. }
  53405. }
  53406. }
  53407. }
  53408. function checkInFor (el) {
  53409. var parent = el;
  53410. while (parent) {
  53411. if (parent.for !== undefined) {
  53412. return true
  53413. }
  53414. parent = parent.parent;
  53415. }
  53416. return false
  53417. }
  53418. function parseModifiers (name) {
  53419. var match = name.match(modifierRE);
  53420. if (match) {
  53421. var ret = {};
  53422. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53423. return ret
  53424. }
  53425. }
  53426. function makeAttrsMap (attrs) {
  53427. var map = {};
  53428. for (var i = 0, l = attrs.length; i < l; i++) {
  53429. if (
  53430. map[attrs[i].name] && !isIE && !isEdge
  53431. ) {
  53432. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53433. }
  53434. map[attrs[i].name] = attrs[i].value;
  53435. }
  53436. return map
  53437. }
  53438. // for script (e.g. type="x/template") or style, do not decode content
  53439. function isTextTag (el) {
  53440. return el.tag === 'script' || el.tag === 'style'
  53441. }
  53442. function isForbiddenTag (el) {
  53443. return (
  53444. el.tag === 'style' ||
  53445. (el.tag === 'script' && (
  53446. !el.attrsMap.type ||
  53447. el.attrsMap.type === 'text/javascript'
  53448. ))
  53449. )
  53450. }
  53451. var ieNSBug = /^xmlns:NS\d+/;
  53452. var ieNSPrefix = /^NS\d+:/;
  53453. /* istanbul ignore next */
  53454. function guardIESVGBug (attrs) {
  53455. var res = [];
  53456. for (var i = 0; i < attrs.length; i++) {
  53457. var attr = attrs[i];
  53458. if (!ieNSBug.test(attr.name)) {
  53459. attr.name = attr.name.replace(ieNSPrefix, '');
  53460. res.push(attr);
  53461. }
  53462. }
  53463. return res
  53464. }
  53465. function checkForAliasModel (el, value) {
  53466. var _el = el;
  53467. while (_el) {
  53468. if (_el.for && _el.alias === value) {
  53469. warn$2(
  53470. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53471. "You are binding v-model directly to a v-for iteration alias. " +
  53472. "This will not be able to modify the v-for source array because " +
  53473. "writing to the alias is like modifying a function local variable. " +
  53474. "Consider using an array of objects and use v-model on an object property instead.",
  53475. el.rawAttrsMap['v-model']
  53476. );
  53477. }
  53478. _el = _el.parent;
  53479. }
  53480. }
  53481. /* */
  53482. function preTransformNode (el, options) {
  53483. if (el.tag === 'input') {
  53484. var map = el.attrsMap;
  53485. if (!map['v-model']) {
  53486. return
  53487. }
  53488. var typeBinding;
  53489. if (map[':type'] || map['v-bind:type']) {
  53490. typeBinding = getBindingAttr(el, 'type');
  53491. }
  53492. if (!map.type && !typeBinding && map['v-bind']) {
  53493. typeBinding = "(" + (map['v-bind']) + ").type";
  53494. }
  53495. if (typeBinding) {
  53496. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  53497. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  53498. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  53499. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  53500. // 1. checkbox
  53501. var branch0 = cloneASTElement(el);
  53502. // process for on the main node
  53503. processFor(branch0);
  53504. addRawAttr(branch0, 'type', 'checkbox');
  53505. processElement(branch0, options);
  53506. branch0.processed = true; // prevent it from double-processed
  53507. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  53508. addIfCondition(branch0, {
  53509. exp: branch0.if,
  53510. block: branch0
  53511. });
  53512. // 2. add radio else-if condition
  53513. var branch1 = cloneASTElement(el);
  53514. getAndRemoveAttr(branch1, 'v-for', true);
  53515. addRawAttr(branch1, 'type', 'radio');
  53516. processElement(branch1, options);
  53517. addIfCondition(branch0, {
  53518. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  53519. block: branch1
  53520. });
  53521. // 3. other
  53522. var branch2 = cloneASTElement(el);
  53523. getAndRemoveAttr(branch2, 'v-for', true);
  53524. addRawAttr(branch2, ':type', typeBinding);
  53525. processElement(branch2, options);
  53526. addIfCondition(branch0, {
  53527. exp: ifCondition,
  53528. block: branch2
  53529. });
  53530. if (hasElse) {
  53531. branch0.else = true;
  53532. } else if (elseIfCondition) {
  53533. branch0.elseif = elseIfCondition;
  53534. }
  53535. return branch0
  53536. }
  53537. }
  53538. }
  53539. function cloneASTElement (el) {
  53540. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  53541. }
  53542. var model$1 = {
  53543. preTransformNode: preTransformNode
  53544. };
  53545. var modules$1 = [
  53546. klass$1,
  53547. style$1,
  53548. model$1
  53549. ];
  53550. /* */
  53551. function text (el, dir) {
  53552. if (dir.value) {
  53553. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  53554. }
  53555. }
  53556. /* */
  53557. function html (el, dir) {
  53558. if (dir.value) {
  53559. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  53560. }
  53561. }
  53562. var directives$1 = {
  53563. model: model,
  53564. text: text,
  53565. html: html
  53566. };
  53567. /* */
  53568. var baseOptions = {
  53569. expectHTML: true,
  53570. modules: modules$1,
  53571. directives: directives$1,
  53572. isPreTag: isPreTag,
  53573. isUnaryTag: isUnaryTag,
  53574. mustUseProp: mustUseProp,
  53575. canBeLeftOpenTag: canBeLeftOpenTag,
  53576. isReservedTag: isReservedTag,
  53577. getTagNamespace: getTagNamespace,
  53578. staticKeys: genStaticKeys(modules$1)
  53579. };
  53580. /* */
  53581. var isStaticKey;
  53582. var isPlatformReservedTag;
  53583. var genStaticKeysCached = cached(genStaticKeys$1);
  53584. /**
  53585. * Goal of the optimizer: walk the generated template AST tree
  53586. * and detect sub-trees that are purely static, i.e. parts of
  53587. * the DOM that never needs to change.
  53588. *
  53589. * Once we detect these sub-trees, we can:
  53590. *
  53591. * 1. Hoist them into constants, so that we no longer need to
  53592. * create fresh nodes for them on each re-render;
  53593. * 2. Completely skip them in the patching process.
  53594. */
  53595. function optimize (root, options) {
  53596. if (!root) { return }
  53597. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  53598. isPlatformReservedTag = options.isReservedTag || no;
  53599. // first pass: mark all non-static nodes.
  53600. markStatic$1(root);
  53601. // second pass: mark static roots.
  53602. markStaticRoots(root, false);
  53603. }
  53604. function genStaticKeys$1 (keys) {
  53605. return makeMap(
  53606. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  53607. (keys ? ',' + keys : '')
  53608. )
  53609. }
  53610. function markStatic$1 (node) {
  53611. node.static = isStatic(node);
  53612. if (node.type === 1) {
  53613. // do not make component slot content static. this avoids
  53614. // 1. components not able to mutate slot nodes
  53615. // 2. static slot content fails for hot-reloading
  53616. if (
  53617. !isPlatformReservedTag(node.tag) &&
  53618. node.tag !== 'slot' &&
  53619. node.attrsMap['inline-template'] == null
  53620. ) {
  53621. return
  53622. }
  53623. for (var i = 0, l = node.children.length; i < l; i++) {
  53624. var child = node.children[i];
  53625. markStatic$1(child);
  53626. if (!child.static) {
  53627. node.static = false;
  53628. }
  53629. }
  53630. if (node.ifConditions) {
  53631. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53632. var block = node.ifConditions[i$1].block;
  53633. markStatic$1(block);
  53634. if (!block.static) {
  53635. node.static = false;
  53636. }
  53637. }
  53638. }
  53639. }
  53640. }
  53641. function markStaticRoots (node, isInFor) {
  53642. if (node.type === 1) {
  53643. if (node.static || node.once) {
  53644. node.staticInFor = isInFor;
  53645. }
  53646. // For a node to qualify as a static root, it should have children that
  53647. // are not just static text. Otherwise the cost of hoisting out will
  53648. // outweigh the benefits and it's better off to just always render it fresh.
  53649. if (node.static && node.children.length && !(
  53650. node.children.length === 1 &&
  53651. node.children[0].type === 3
  53652. )) {
  53653. node.staticRoot = true;
  53654. return
  53655. } else {
  53656. node.staticRoot = false;
  53657. }
  53658. if (node.children) {
  53659. for (var i = 0, l = node.children.length; i < l; i++) {
  53660. markStaticRoots(node.children[i], isInFor || !!node.for);
  53661. }
  53662. }
  53663. if (node.ifConditions) {
  53664. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53665. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  53666. }
  53667. }
  53668. }
  53669. }
  53670. function isStatic (node) {
  53671. if (node.type === 2) { // expression
  53672. return false
  53673. }
  53674. if (node.type === 3) { // text
  53675. return true
  53676. }
  53677. return !!(node.pre || (
  53678. !node.hasBindings && // no dynamic bindings
  53679. !node.if && !node.for && // not v-if or v-for or v-else
  53680. !isBuiltInTag(node.tag) && // not a built-in
  53681. isPlatformReservedTag(node.tag) && // not a component
  53682. !isDirectChildOfTemplateFor(node) &&
  53683. Object.keys(node).every(isStaticKey)
  53684. ))
  53685. }
  53686. function isDirectChildOfTemplateFor (node) {
  53687. while (node.parent) {
  53688. node = node.parent;
  53689. if (node.tag !== 'template') {
  53690. return false
  53691. }
  53692. if (node.for) {
  53693. return true
  53694. }
  53695. }
  53696. return false
  53697. }
  53698. /* */
  53699. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  53700. var fnInvokeRE = /\([^)]*?\);*$/;
  53701. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  53702. // KeyboardEvent.keyCode aliases
  53703. var keyCodes = {
  53704. esc: 27,
  53705. tab: 9,
  53706. enter: 13,
  53707. space: 32,
  53708. up: 38,
  53709. left: 37,
  53710. right: 39,
  53711. down: 40,
  53712. 'delete': [8, 46]
  53713. };
  53714. // KeyboardEvent.key aliases
  53715. var keyNames = {
  53716. // #7880: IE11 and Edge use `Esc` for Escape key name.
  53717. esc: ['Esc', 'Escape'],
  53718. tab: 'Tab',
  53719. enter: 'Enter',
  53720. // #9112: IE11 uses `Spacebar` for Space key name.
  53721. space: [' ', 'Spacebar'],
  53722. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  53723. up: ['Up', 'ArrowUp'],
  53724. left: ['Left', 'ArrowLeft'],
  53725. right: ['Right', 'ArrowRight'],
  53726. down: ['Down', 'ArrowDown'],
  53727. // #9112: IE11 uses `Del` for Delete key name.
  53728. 'delete': ['Backspace', 'Delete', 'Del']
  53729. };
  53730. // #4868: modifiers that prevent the execution of the listener
  53731. // need to explicitly return null so that we can determine whether to remove
  53732. // the listener for .once
  53733. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  53734. var modifierCode = {
  53735. stop: '$event.stopPropagation();',
  53736. prevent: '$event.preventDefault();',
  53737. self: genGuard("$event.target !== $event.currentTarget"),
  53738. ctrl: genGuard("!$event.ctrlKey"),
  53739. shift: genGuard("!$event.shiftKey"),
  53740. alt: genGuard("!$event.altKey"),
  53741. meta: genGuard("!$event.metaKey"),
  53742. left: genGuard("'button' in $event && $event.button !== 0"),
  53743. middle: genGuard("'button' in $event && $event.button !== 1"),
  53744. right: genGuard("'button' in $event && $event.button !== 2")
  53745. };
  53746. function genHandlers (
  53747. events,
  53748. isNative
  53749. ) {
  53750. var prefix = isNative ? 'nativeOn:' : 'on:';
  53751. var staticHandlers = "";
  53752. var dynamicHandlers = "";
  53753. for (var name in events) {
  53754. var handlerCode = genHandler(events[name]);
  53755. if (events[name] && events[name].dynamic) {
  53756. dynamicHandlers += name + "," + handlerCode + ",";
  53757. } else {
  53758. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  53759. }
  53760. }
  53761. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  53762. if (dynamicHandlers) {
  53763. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  53764. } else {
  53765. return prefix + staticHandlers
  53766. }
  53767. }
  53768. function genHandler (handler) {
  53769. if (!handler) {
  53770. return 'function(){}'
  53771. }
  53772. if (Array.isArray(handler)) {
  53773. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  53774. }
  53775. var isMethodPath = simplePathRE.test(handler.value);
  53776. var isFunctionExpression = fnExpRE.test(handler.value);
  53777. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  53778. if (!handler.modifiers) {
  53779. if (isMethodPath || isFunctionExpression) {
  53780. return handler.value
  53781. }
  53782. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  53783. } else {
  53784. var code = '';
  53785. var genModifierCode = '';
  53786. var keys = [];
  53787. for (var key in handler.modifiers) {
  53788. if (modifierCode[key]) {
  53789. genModifierCode += modifierCode[key];
  53790. // left/right
  53791. if (keyCodes[key]) {
  53792. keys.push(key);
  53793. }
  53794. } else if (key === 'exact') {
  53795. var modifiers = (handler.modifiers);
  53796. genModifierCode += genGuard(
  53797. ['ctrl', 'shift', 'alt', 'meta']
  53798. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  53799. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  53800. .join('||')
  53801. );
  53802. } else {
  53803. keys.push(key);
  53804. }
  53805. }
  53806. if (keys.length) {
  53807. code += genKeyFilter(keys);
  53808. }
  53809. // Make sure modifiers like prevent and stop get executed after key filtering
  53810. if (genModifierCode) {
  53811. code += genModifierCode;
  53812. }
  53813. var handlerCode = isMethodPath
  53814. ? ("return " + (handler.value) + "($event)")
  53815. : isFunctionExpression
  53816. ? ("return (" + (handler.value) + ")($event)")
  53817. : isFunctionInvocation
  53818. ? ("return " + (handler.value))
  53819. : handler.value;
  53820. return ("function($event){" + code + handlerCode + "}")
  53821. }
  53822. }
  53823. function genKeyFilter (keys) {
  53824. return (
  53825. // make sure the key filters only apply to KeyboardEvents
  53826. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  53827. // key events that do not have keyCode property...
  53828. "if(!$event.type.indexOf('key')&&" +
  53829. (keys.map(genFilterCode).join('&&')) + ")return null;"
  53830. )
  53831. }
  53832. function genFilterCode (key) {
  53833. var keyVal = parseInt(key, 10);
  53834. if (keyVal) {
  53835. return ("$event.keyCode!==" + keyVal)
  53836. }
  53837. var keyCode = keyCodes[key];
  53838. var keyName = keyNames[key];
  53839. return (
  53840. "_k($event.keyCode," +
  53841. (JSON.stringify(key)) + "," +
  53842. (JSON.stringify(keyCode)) + "," +
  53843. "$event.key," +
  53844. "" + (JSON.stringify(keyName)) +
  53845. ")"
  53846. )
  53847. }
  53848. /* */
  53849. function on (el, dir) {
  53850. if (dir.modifiers) {
  53851. warn("v-on without argument does not support modifiers.");
  53852. }
  53853. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  53854. }
  53855. /* */
  53856. function bind$1 (el, dir) {
  53857. el.wrapData = function (code) {
  53858. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  53859. };
  53860. }
  53861. /* */
  53862. var baseDirectives = {
  53863. on: on,
  53864. bind: bind$1,
  53865. cloak: noop
  53866. };
  53867. /* */
  53868. var CodegenState = function CodegenState (options) {
  53869. this.options = options;
  53870. this.warn = options.warn || baseWarn;
  53871. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  53872. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  53873. this.directives = extend(extend({}, baseDirectives), options.directives);
  53874. var isReservedTag = options.isReservedTag || no;
  53875. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53876. this.onceId = 0;
  53877. this.staticRenderFns = [];
  53878. this.pre = false;
  53879. };
  53880. function generate (
  53881. ast,
  53882. options
  53883. ) {
  53884. var state = new CodegenState(options);
  53885. var code = ast ? genElement(ast, state) : '_c("div")';
  53886. return {
  53887. render: ("with(this){return " + code + "}"),
  53888. staticRenderFns: state.staticRenderFns
  53889. }
  53890. }
  53891. function genElement (el, state) {
  53892. if (el.parent) {
  53893. el.pre = el.pre || el.parent.pre;
  53894. }
  53895. if (el.staticRoot && !el.staticProcessed) {
  53896. return genStatic(el, state)
  53897. } else if (el.once && !el.onceProcessed) {
  53898. return genOnce(el, state)
  53899. } else if (el.for && !el.forProcessed) {
  53900. return genFor(el, state)
  53901. } else if (el.if && !el.ifProcessed) {
  53902. return genIf(el, state)
  53903. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  53904. return genChildren(el, state) || 'void 0'
  53905. } else if (el.tag === 'slot') {
  53906. return genSlot(el, state)
  53907. } else {
  53908. // component or element
  53909. var code;
  53910. if (el.component) {
  53911. code = genComponent(el.component, el, state);
  53912. } else {
  53913. var data;
  53914. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  53915. data = genData$2(el, state);
  53916. }
  53917. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  53918. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  53919. }
  53920. // module transforms
  53921. for (var i = 0; i < state.transforms.length; i++) {
  53922. code = state.transforms[i](el, code);
  53923. }
  53924. return code
  53925. }
  53926. }
  53927. // hoist static sub-trees out
  53928. function genStatic (el, state) {
  53929. el.staticProcessed = true;
  53930. // Some elements (templates) need to behave differently inside of a v-pre
  53931. // node. All pre nodes are static roots, so we can use this as a location to
  53932. // wrap a state change and reset it upon exiting the pre node.
  53933. var originalPreState = state.pre;
  53934. if (el.pre) {
  53935. state.pre = el.pre;
  53936. }
  53937. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  53938. state.pre = originalPreState;
  53939. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  53940. }
  53941. // v-once
  53942. function genOnce (el, state) {
  53943. el.onceProcessed = true;
  53944. if (el.if && !el.ifProcessed) {
  53945. return genIf(el, state)
  53946. } else if (el.staticInFor) {
  53947. var key = '';
  53948. var parent = el.parent;
  53949. while (parent) {
  53950. if (parent.for) {
  53951. key = parent.key;
  53952. break
  53953. }
  53954. parent = parent.parent;
  53955. }
  53956. if (!key) {
  53957. state.warn(
  53958. "v-once can only be used inside v-for that is keyed. ",
  53959. el.rawAttrsMap['v-once']
  53960. );
  53961. return genElement(el, state)
  53962. }
  53963. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  53964. } else {
  53965. return genStatic(el, state)
  53966. }
  53967. }
  53968. function genIf (
  53969. el,
  53970. state,
  53971. altGen,
  53972. altEmpty
  53973. ) {
  53974. el.ifProcessed = true; // avoid recursion
  53975. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  53976. }
  53977. function genIfConditions (
  53978. conditions,
  53979. state,
  53980. altGen,
  53981. altEmpty
  53982. ) {
  53983. if (!conditions.length) {
  53984. return altEmpty || '_e()'
  53985. }
  53986. var condition = conditions.shift();
  53987. if (condition.exp) {
  53988. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  53989. } else {
  53990. return ("" + (genTernaryExp(condition.block)))
  53991. }
  53992. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  53993. function genTernaryExp (el) {
  53994. return altGen
  53995. ? altGen(el, state)
  53996. : el.once
  53997. ? genOnce(el, state)
  53998. : genElement(el, state)
  53999. }
  54000. }
  54001. function genFor (
  54002. el,
  54003. state,
  54004. altGen,
  54005. altHelper
  54006. ) {
  54007. var exp = el.for;
  54008. var alias = el.alias;
  54009. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54010. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54011. if (state.maybeComponent(el) &&
  54012. el.tag !== 'slot' &&
  54013. el.tag !== 'template' &&
  54014. !el.key
  54015. ) {
  54016. state.warn(
  54017. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54018. "v-for should have explicit keys. " +
  54019. "See https://vuejs.org/guide/list.html#key for more info.",
  54020. el.rawAttrsMap['v-for'],
  54021. true /* tip */
  54022. );
  54023. }
  54024. el.forProcessed = true; // avoid recursion
  54025. return (altHelper || '_l') + "((" + exp + ")," +
  54026. "function(" + alias + iterator1 + iterator2 + "){" +
  54027. "return " + ((altGen || genElement)(el, state)) +
  54028. '})'
  54029. }
  54030. function genData$2 (el, state) {
  54031. var data = '{';
  54032. // directives first.
  54033. // directives may mutate the el's other properties before they are generated.
  54034. var dirs = genDirectives(el, state);
  54035. if (dirs) { data += dirs + ','; }
  54036. // key
  54037. if (el.key) {
  54038. data += "key:" + (el.key) + ",";
  54039. }
  54040. // ref
  54041. if (el.ref) {
  54042. data += "ref:" + (el.ref) + ",";
  54043. }
  54044. if (el.refInFor) {
  54045. data += "refInFor:true,";
  54046. }
  54047. // pre
  54048. if (el.pre) {
  54049. data += "pre:true,";
  54050. }
  54051. // record original tag name for components using "is" attribute
  54052. if (el.component) {
  54053. data += "tag:\"" + (el.tag) + "\",";
  54054. }
  54055. // module data generation functions
  54056. for (var i = 0; i < state.dataGenFns.length; i++) {
  54057. data += state.dataGenFns[i](el);
  54058. }
  54059. // attributes
  54060. if (el.attrs) {
  54061. data += "attrs:" + (genProps(el.attrs)) + ",";
  54062. }
  54063. // DOM props
  54064. if (el.props) {
  54065. data += "domProps:" + (genProps(el.props)) + ",";
  54066. }
  54067. // event handlers
  54068. if (el.events) {
  54069. data += (genHandlers(el.events, false)) + ",";
  54070. }
  54071. if (el.nativeEvents) {
  54072. data += (genHandlers(el.nativeEvents, true)) + ",";
  54073. }
  54074. // slot target
  54075. // only for non-scoped slots
  54076. if (el.slotTarget && !el.slotScope) {
  54077. data += "slot:" + (el.slotTarget) + ",";
  54078. }
  54079. // scoped slots
  54080. if (el.scopedSlots) {
  54081. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54082. }
  54083. // component v-model
  54084. if (el.model) {
  54085. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54086. }
  54087. // inline-template
  54088. if (el.inlineTemplate) {
  54089. var inlineTemplate = genInlineTemplate(el, state);
  54090. if (inlineTemplate) {
  54091. data += inlineTemplate + ",";
  54092. }
  54093. }
  54094. data = data.replace(/,$/, '') + '}';
  54095. // v-bind dynamic argument wrap
  54096. // v-bind with dynamic arguments must be applied using the same v-bind object
  54097. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54098. if (el.dynamicAttrs) {
  54099. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54100. }
  54101. // v-bind data wrap
  54102. if (el.wrapData) {
  54103. data = el.wrapData(data);
  54104. }
  54105. // v-on data wrap
  54106. if (el.wrapListeners) {
  54107. data = el.wrapListeners(data);
  54108. }
  54109. return data
  54110. }
  54111. function genDirectives (el, state) {
  54112. var dirs = el.directives;
  54113. if (!dirs) { return }
  54114. var res = 'directives:[';
  54115. var hasRuntime = false;
  54116. var i, l, dir, needRuntime;
  54117. for (i = 0, l = dirs.length; i < l; i++) {
  54118. dir = dirs[i];
  54119. needRuntime = true;
  54120. var gen = state.directives[dir.name];
  54121. if (gen) {
  54122. // compile-time directive that manipulates AST.
  54123. // returns true if it also needs a runtime counterpart.
  54124. needRuntime = !!gen(el, dir, state.warn);
  54125. }
  54126. if (needRuntime) {
  54127. hasRuntime = true;
  54128. 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))) : '') + "},";
  54129. }
  54130. }
  54131. if (hasRuntime) {
  54132. return res.slice(0, -1) + ']'
  54133. }
  54134. }
  54135. function genInlineTemplate (el, state) {
  54136. var ast = el.children[0];
  54137. if (el.children.length !== 1 || ast.type !== 1) {
  54138. state.warn(
  54139. 'Inline-template components must have exactly one child element.',
  54140. { start: el.start }
  54141. );
  54142. }
  54143. if (ast && ast.type === 1) {
  54144. var inlineRenderFns = generate(ast, state.options);
  54145. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54146. }
  54147. }
  54148. function genScopedSlots (
  54149. el,
  54150. slots,
  54151. state
  54152. ) {
  54153. // by default scoped slots are considered "stable", this allows child
  54154. // components with only scoped slots to skip forced updates from parent.
  54155. // but in some cases we have to bail-out of this optimization
  54156. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54157. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54158. var slot = slots[key];
  54159. return (
  54160. slot.slotTargetDynamic ||
  54161. slot.if ||
  54162. slot.for ||
  54163. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54164. )
  54165. });
  54166. // #9534: if a component with scoped slots is inside a conditional branch,
  54167. // it's possible for the same component to be reused but with different
  54168. // compiled slot content. To avoid that, we generate a unique key based on
  54169. // the generated code of all the slot contents.
  54170. var needsKey = !!el.if;
  54171. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54172. // disconnected due to the intermediate scope variable)
  54173. // #9438, #9506
  54174. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54175. // and skip force updating ones that do not actually use scope variables.
  54176. if (!needsForceUpdate) {
  54177. var parent = el.parent;
  54178. while (parent) {
  54179. if (
  54180. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54181. parent.for
  54182. ) {
  54183. needsForceUpdate = true;
  54184. break
  54185. }
  54186. if (parent.if) {
  54187. needsKey = true;
  54188. }
  54189. parent = parent.parent;
  54190. }
  54191. }
  54192. var generatedSlots = Object.keys(slots)
  54193. .map(function (key) { return genScopedSlot(slots[key], state); })
  54194. .join(',');
  54195. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54196. }
  54197. function hash(str) {
  54198. var hash = 5381;
  54199. var i = str.length;
  54200. while(i) {
  54201. hash = (hash * 33) ^ str.charCodeAt(--i);
  54202. }
  54203. return hash >>> 0
  54204. }
  54205. function containsSlotChild (el) {
  54206. if (el.type === 1) {
  54207. if (el.tag === 'slot') {
  54208. return true
  54209. }
  54210. return el.children.some(containsSlotChild)
  54211. }
  54212. return false
  54213. }
  54214. function genScopedSlot (
  54215. el,
  54216. state
  54217. ) {
  54218. var isLegacySyntax = el.attrsMap['slot-scope'];
  54219. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54220. return genIf(el, state, genScopedSlot, "null")
  54221. }
  54222. if (el.for && !el.forProcessed) {
  54223. return genFor(el, state, genScopedSlot)
  54224. }
  54225. var slotScope = el.slotScope === emptySlotScopeToken
  54226. ? ""
  54227. : String(el.slotScope);
  54228. var fn = "function(" + slotScope + "){" +
  54229. "return " + (el.tag === 'template'
  54230. ? el.if && isLegacySyntax
  54231. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54232. : genChildren(el, state) || 'undefined'
  54233. : genElement(el, state)) + "}";
  54234. // reverse proxy v-slot without scope on this.$slots
  54235. var reverseProxy = slotScope ? "" : ",proxy:true";
  54236. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54237. }
  54238. function genChildren (
  54239. el,
  54240. state,
  54241. checkSkip,
  54242. altGenElement,
  54243. altGenNode
  54244. ) {
  54245. var children = el.children;
  54246. if (children.length) {
  54247. var el$1 = children[0];
  54248. // optimize single v-for
  54249. if (children.length === 1 &&
  54250. el$1.for &&
  54251. el$1.tag !== 'template' &&
  54252. el$1.tag !== 'slot'
  54253. ) {
  54254. var normalizationType = checkSkip
  54255. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54256. : "";
  54257. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54258. }
  54259. var normalizationType$1 = checkSkip
  54260. ? getNormalizationType(children, state.maybeComponent)
  54261. : 0;
  54262. var gen = altGenNode || genNode;
  54263. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54264. }
  54265. }
  54266. // determine the normalization needed for the children array.
  54267. // 0: no normalization needed
  54268. // 1: simple normalization needed (possible 1-level deep nested array)
  54269. // 2: full normalization needed
  54270. function getNormalizationType (
  54271. children,
  54272. maybeComponent
  54273. ) {
  54274. var res = 0;
  54275. for (var i = 0; i < children.length; i++) {
  54276. var el = children[i];
  54277. if (el.type !== 1) {
  54278. continue
  54279. }
  54280. if (needsNormalization(el) ||
  54281. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54282. res = 2;
  54283. break
  54284. }
  54285. if (maybeComponent(el) ||
  54286. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54287. res = 1;
  54288. }
  54289. }
  54290. return res
  54291. }
  54292. function needsNormalization (el) {
  54293. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54294. }
  54295. function genNode (node, state) {
  54296. if (node.type === 1) {
  54297. return genElement(node, state)
  54298. } else if (node.type === 3 && node.isComment) {
  54299. return genComment(node)
  54300. } else {
  54301. return genText(node)
  54302. }
  54303. }
  54304. function genText (text) {
  54305. return ("_v(" + (text.type === 2
  54306. ? text.expression // no need for () because already wrapped in _s()
  54307. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54308. }
  54309. function genComment (comment) {
  54310. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54311. }
  54312. function genSlot (el, state) {
  54313. var slotName = el.slotName || '"default"';
  54314. var children = genChildren(el, state);
  54315. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54316. var attrs = el.attrs || el.dynamicAttrs
  54317. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54318. // slot props are camelized
  54319. name: camelize(attr.name),
  54320. value: attr.value,
  54321. dynamic: attr.dynamic
  54322. }); }))
  54323. : null;
  54324. var bind$$1 = el.attrsMap['v-bind'];
  54325. if ((attrs || bind$$1) && !children) {
  54326. res += ",null";
  54327. }
  54328. if (attrs) {
  54329. res += "," + attrs;
  54330. }
  54331. if (bind$$1) {
  54332. res += (attrs ? '' : ',null') + "," + bind$$1;
  54333. }
  54334. return res + ')'
  54335. }
  54336. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54337. function genComponent (
  54338. componentName,
  54339. el,
  54340. state
  54341. ) {
  54342. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54343. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54344. }
  54345. function genProps (props) {
  54346. var staticProps = "";
  54347. var dynamicProps = "";
  54348. for (var i = 0; i < props.length; i++) {
  54349. var prop = props[i];
  54350. var value = transformSpecialNewlines(prop.value);
  54351. if (prop.dynamic) {
  54352. dynamicProps += (prop.name) + "," + value + ",";
  54353. } else {
  54354. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54355. }
  54356. }
  54357. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54358. if (dynamicProps) {
  54359. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54360. } else {
  54361. return staticProps
  54362. }
  54363. }
  54364. // #3895, #4268
  54365. function transformSpecialNewlines (text) {
  54366. return text
  54367. .replace(/\u2028/g, '\\u2028')
  54368. .replace(/\u2029/g, '\\u2029')
  54369. }
  54370. /* */
  54371. // these keywords should not appear inside expressions, but operators like
  54372. // typeof, instanceof and in are allowed
  54373. var prohibitedKeywordRE = new RegExp('\\b' + (
  54374. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54375. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54376. 'extends,finally,continue,debugger,function,arguments'
  54377. ).split(',').join('\\b|\\b') + '\\b');
  54378. // these unary operators should not be used as property/method names
  54379. var unaryOperatorsRE = new RegExp('\\b' + (
  54380. 'delete,typeof,void'
  54381. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54382. // strip strings in expressions
  54383. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54384. // detect problematic expressions in a template
  54385. function detectErrors (ast, warn) {
  54386. if (ast) {
  54387. checkNode(ast, warn);
  54388. }
  54389. }
  54390. function checkNode (node, warn) {
  54391. if (node.type === 1) {
  54392. for (var name in node.attrsMap) {
  54393. if (dirRE.test(name)) {
  54394. var value = node.attrsMap[name];
  54395. if (value) {
  54396. var range = node.rawAttrsMap[name];
  54397. if (name === 'v-for') {
  54398. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54399. } else if (name === 'v-slot' || name[0] === '#') {
  54400. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54401. } else if (onRE.test(name)) {
  54402. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54403. } else {
  54404. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54405. }
  54406. }
  54407. }
  54408. }
  54409. if (node.children) {
  54410. for (var i = 0; i < node.children.length; i++) {
  54411. checkNode(node.children[i], warn);
  54412. }
  54413. }
  54414. } else if (node.type === 2) {
  54415. checkExpression(node.expression, node.text, warn, node);
  54416. }
  54417. }
  54418. function checkEvent (exp, text, warn, range) {
  54419. var stripped = exp.replace(stripStringRE, '');
  54420. var keywordMatch = stripped.match(unaryOperatorsRE);
  54421. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54422. warn(
  54423. "avoid using JavaScript unary operator as property name: " +
  54424. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54425. range
  54426. );
  54427. }
  54428. checkExpression(exp, text, warn, range);
  54429. }
  54430. function checkFor (node, text, warn, range) {
  54431. checkExpression(node.for || '', text, warn, range);
  54432. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54433. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54434. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54435. }
  54436. function checkIdentifier (
  54437. ident,
  54438. type,
  54439. text,
  54440. warn,
  54441. range
  54442. ) {
  54443. if (typeof ident === 'string') {
  54444. try {
  54445. new Function(("var " + ident + "=_"));
  54446. } catch (e) {
  54447. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54448. }
  54449. }
  54450. }
  54451. function checkExpression (exp, text, warn, range) {
  54452. try {
  54453. new Function(("return " + exp));
  54454. } catch (e) {
  54455. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54456. if (keywordMatch) {
  54457. warn(
  54458. "avoid using JavaScript keyword as property name: " +
  54459. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54460. range
  54461. );
  54462. } else {
  54463. warn(
  54464. "invalid expression: " + (e.message) + " in\n\n" +
  54465. " " + exp + "\n\n" +
  54466. " Raw expression: " + (text.trim()) + "\n",
  54467. range
  54468. );
  54469. }
  54470. }
  54471. }
  54472. function checkFunctionParameterExpression (exp, text, warn, range) {
  54473. try {
  54474. new Function(exp, '');
  54475. } catch (e) {
  54476. warn(
  54477. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  54478. " " + exp + "\n\n" +
  54479. " Raw expression: " + (text.trim()) + "\n",
  54480. range
  54481. );
  54482. }
  54483. }
  54484. /* */
  54485. var range = 2;
  54486. function generateCodeFrame (
  54487. source,
  54488. start,
  54489. end
  54490. ) {
  54491. if ( start === void 0 ) start = 0;
  54492. if ( end === void 0 ) end = source.length;
  54493. var lines = source.split(/\r?\n/);
  54494. var count = 0;
  54495. var res = [];
  54496. for (var i = 0; i < lines.length; i++) {
  54497. count += lines[i].length + 1;
  54498. if (count >= start) {
  54499. for (var j = i - range; j <= i + range || end > count; j++) {
  54500. if (j < 0 || j >= lines.length) { continue }
  54501. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  54502. var lineLength = lines[j].length;
  54503. if (j === i) {
  54504. // push underline
  54505. var pad = start - (count - lineLength) + 1;
  54506. var length = end > count ? lineLength - pad : end - start;
  54507. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  54508. } else if (j > i) {
  54509. if (end > count) {
  54510. var length$1 = Math.min(end - count, lineLength);
  54511. res.push(" | " + repeat$1("^", length$1));
  54512. }
  54513. count += lineLength + 1;
  54514. }
  54515. }
  54516. break
  54517. }
  54518. }
  54519. return res.join('\n')
  54520. }
  54521. function repeat$1 (str, n) {
  54522. var result = '';
  54523. if (n > 0) {
  54524. while (true) { // eslint-disable-line
  54525. if (n & 1) { result += str; }
  54526. n >>>= 1;
  54527. if (n <= 0) { break }
  54528. str += str;
  54529. }
  54530. }
  54531. return result
  54532. }
  54533. /* */
  54534. function createFunction (code, errors) {
  54535. try {
  54536. return new Function(code)
  54537. } catch (err) {
  54538. errors.push({ err: err, code: code });
  54539. return noop
  54540. }
  54541. }
  54542. function createCompileToFunctionFn (compile) {
  54543. var cache = Object.create(null);
  54544. return function compileToFunctions (
  54545. template,
  54546. options,
  54547. vm
  54548. ) {
  54549. options = extend({}, options);
  54550. var warn$$1 = options.warn || warn;
  54551. delete options.warn;
  54552. /* istanbul ignore if */
  54553. {
  54554. // detect possible CSP restriction
  54555. try {
  54556. new Function('return 1');
  54557. } catch (e) {
  54558. if (e.toString().match(/unsafe-eval|CSP/)) {
  54559. warn$$1(
  54560. 'It seems you are using the standalone build of Vue.js in an ' +
  54561. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  54562. 'The template compiler cannot work in this environment. Consider ' +
  54563. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  54564. 'templates into render functions.'
  54565. );
  54566. }
  54567. }
  54568. }
  54569. // check cache
  54570. var key = options.delimiters
  54571. ? String(options.delimiters) + template
  54572. : template;
  54573. if (cache[key]) {
  54574. return cache[key]
  54575. }
  54576. // compile
  54577. var compiled = compile(template, options);
  54578. // check compilation errors/tips
  54579. {
  54580. if (compiled.errors && compiled.errors.length) {
  54581. if (options.outputSourceRange) {
  54582. compiled.errors.forEach(function (e) {
  54583. warn$$1(
  54584. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  54585. generateCodeFrame(template, e.start, e.end),
  54586. vm
  54587. );
  54588. });
  54589. } else {
  54590. warn$$1(
  54591. "Error compiling template:\n\n" + template + "\n\n" +
  54592. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  54593. vm
  54594. );
  54595. }
  54596. }
  54597. if (compiled.tips && compiled.tips.length) {
  54598. if (options.outputSourceRange) {
  54599. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  54600. } else {
  54601. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  54602. }
  54603. }
  54604. }
  54605. // turn code into functions
  54606. var res = {};
  54607. var fnGenErrors = [];
  54608. res.render = createFunction(compiled.render, fnGenErrors);
  54609. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  54610. return createFunction(code, fnGenErrors)
  54611. });
  54612. // check function generation errors.
  54613. // this should only happen if there is a bug in the compiler itself.
  54614. // mostly for codegen development use
  54615. /* istanbul ignore if */
  54616. {
  54617. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  54618. warn$$1(
  54619. "Failed to generate render function:\n\n" +
  54620. fnGenErrors.map(function (ref) {
  54621. var err = ref.err;
  54622. var code = ref.code;
  54623. return ((err.toString()) + " in\n\n" + code + "\n");
  54624. }).join('\n'),
  54625. vm
  54626. );
  54627. }
  54628. }
  54629. return (cache[key] = res)
  54630. }
  54631. }
  54632. /* */
  54633. function createCompilerCreator (baseCompile) {
  54634. return function createCompiler (baseOptions) {
  54635. function compile (
  54636. template,
  54637. options
  54638. ) {
  54639. var finalOptions = Object.create(baseOptions);
  54640. var errors = [];
  54641. var tips = [];
  54642. var warn = function (msg, range, tip) {
  54643. (tip ? tips : errors).push(msg);
  54644. };
  54645. if (options) {
  54646. if (options.outputSourceRange) {
  54647. // $flow-disable-line
  54648. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  54649. warn = function (msg, range, tip) {
  54650. var data = { msg: msg };
  54651. if (range) {
  54652. if (range.start != null) {
  54653. data.start = range.start + leadingSpaceLength;
  54654. }
  54655. if (range.end != null) {
  54656. data.end = range.end + leadingSpaceLength;
  54657. }
  54658. }
  54659. (tip ? tips : errors).push(data);
  54660. };
  54661. }
  54662. // merge custom modules
  54663. if (options.modules) {
  54664. finalOptions.modules =
  54665. (baseOptions.modules || []).concat(options.modules);
  54666. }
  54667. // merge custom directives
  54668. if (options.directives) {
  54669. finalOptions.directives = extend(
  54670. Object.create(baseOptions.directives || null),
  54671. options.directives
  54672. );
  54673. }
  54674. // copy other options
  54675. for (var key in options) {
  54676. if (key !== 'modules' && key !== 'directives') {
  54677. finalOptions[key] = options[key];
  54678. }
  54679. }
  54680. }
  54681. finalOptions.warn = warn;
  54682. var compiled = baseCompile(template.trim(), finalOptions);
  54683. {
  54684. detectErrors(compiled.ast, warn);
  54685. }
  54686. compiled.errors = errors;
  54687. compiled.tips = tips;
  54688. return compiled
  54689. }
  54690. return {
  54691. compile: compile,
  54692. compileToFunctions: createCompileToFunctionFn(compile)
  54693. }
  54694. }
  54695. }
  54696. /* */
  54697. // `createCompilerCreator` allows creating compilers that use alternative
  54698. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  54699. // Here we just export a default compiler using the default parts.
  54700. var createCompiler = createCompilerCreator(function baseCompile (
  54701. template,
  54702. options
  54703. ) {
  54704. var ast = parse(template.trim(), options);
  54705. if (options.optimize !== false) {
  54706. optimize(ast, options);
  54707. }
  54708. var code = generate(ast, options);
  54709. return {
  54710. ast: ast,
  54711. render: code.render,
  54712. staticRenderFns: code.staticRenderFns
  54713. }
  54714. });
  54715. /* */
  54716. var ref$1 = createCompiler(baseOptions);
  54717. var compile = ref$1.compile;
  54718. var compileToFunctions = ref$1.compileToFunctions;
  54719. /* */
  54720. // check whether current browser encodes a char inside attribute values
  54721. var div;
  54722. function getShouldDecode (href) {
  54723. div = div || document.createElement('div');
  54724. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  54725. return div.innerHTML.indexOf('&#10;') > 0
  54726. }
  54727. // #3663: IE encodes newlines inside attribute values while other browsers don't
  54728. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  54729. // #6828: chrome encodes content in a[href]
  54730. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  54731. /* */
  54732. var idToTemplate = cached(function (id) {
  54733. var el = query(id);
  54734. return el && el.innerHTML
  54735. });
  54736. var mount = Vue.prototype.$mount;
  54737. Vue.prototype.$mount = function (
  54738. el,
  54739. hydrating
  54740. ) {
  54741. el = el && query(el);
  54742. /* istanbul ignore if */
  54743. if (el === document.body || el === document.documentElement) {
  54744. warn(
  54745. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  54746. );
  54747. return this
  54748. }
  54749. var options = this.$options;
  54750. // resolve template/el and convert to render function
  54751. if (!options.render) {
  54752. var template = options.template;
  54753. if (template) {
  54754. if (typeof template === 'string') {
  54755. if (template.charAt(0) === '#') {
  54756. template = idToTemplate(template);
  54757. /* istanbul ignore if */
  54758. if (!template) {
  54759. warn(
  54760. ("Template element not found or is empty: " + (options.template)),
  54761. this
  54762. );
  54763. }
  54764. }
  54765. } else if (template.nodeType) {
  54766. template = template.innerHTML;
  54767. } else {
  54768. {
  54769. warn('invalid template option:' + template, this);
  54770. }
  54771. return this
  54772. }
  54773. } else if (el) {
  54774. template = getOuterHTML(el);
  54775. }
  54776. if (template) {
  54777. /* istanbul ignore if */
  54778. if (config.performance && mark) {
  54779. mark('compile');
  54780. }
  54781. var ref = compileToFunctions(template, {
  54782. outputSourceRange: "development" !== 'production',
  54783. shouldDecodeNewlines: shouldDecodeNewlines,
  54784. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  54785. delimiters: options.delimiters,
  54786. comments: options.comments
  54787. }, this);
  54788. var render = ref.render;
  54789. var staticRenderFns = ref.staticRenderFns;
  54790. options.render = render;
  54791. options.staticRenderFns = staticRenderFns;
  54792. /* istanbul ignore if */
  54793. if (config.performance && mark) {
  54794. mark('compile end');
  54795. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  54796. }
  54797. }
  54798. }
  54799. return mount.call(this, el, hydrating)
  54800. };
  54801. /**
  54802. * Get outerHTML of elements, taking care
  54803. * of SVG elements in IE as well.
  54804. */
  54805. function getOuterHTML (el) {
  54806. if (el.outerHTML) {
  54807. return el.outerHTML
  54808. } else {
  54809. var container = document.createElement('div');
  54810. container.appendChild(el.cloneNode(true));
  54811. return container.innerHTML
  54812. }
  54813. }
  54814. Vue.compile = compileToFunctions;
  54815. module.exports = Vue;
  54816. /* 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))
  54817. /***/ }),
  54818. /***/ "./node_modules/vue/dist/vue.common.js":
  54819. /*!*********************************************!*\
  54820. !*** ./node_modules/vue/dist/vue.common.js ***!
  54821. \*********************************************/
  54822. /*! no static exports found */
  54823. /***/ (function(module, exports, __webpack_require__) {
  54824. if (false) {} else {
  54825. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  54826. }
  54827. /***/ }),
  54828. /***/ "./node_modules/webpack/buildin/global.js":
  54829. /*!***********************************!*\
  54830. !*** (webpack)/buildin/global.js ***!
  54831. \***********************************/
  54832. /*! no static exports found */
  54833. /***/ (function(module, exports) {
  54834. var g;
  54835. // This works in non-strict mode
  54836. g = (function() {
  54837. return this;
  54838. })();
  54839. try {
  54840. // This works if eval is allowed (see CSP)
  54841. g = g || new Function("return this")();
  54842. } catch (e) {
  54843. // This works if the window reference is available
  54844. if (typeof window === "object") g = window;
  54845. }
  54846. // g can still be undefined, but nothing to do about it...
  54847. // We return undefined, instead of nothing here, so it's
  54848. // easier to handle this case. if(!global) { ...}
  54849. module.exports = g;
  54850. /***/ }),
  54851. /***/ "./node_modules/webpack/buildin/module.js":
  54852. /*!***********************************!*\
  54853. !*** (webpack)/buildin/module.js ***!
  54854. \***********************************/
  54855. /*! no static exports found */
  54856. /***/ (function(module, exports) {
  54857. module.exports = function(module) {
  54858. if (!module.webpackPolyfill) {
  54859. module.deprecate = function() {};
  54860. module.paths = [];
  54861. // module.parent = undefined by default
  54862. if (!module.children) module.children = [];
  54863. Object.defineProperty(module, "loaded", {
  54864. enumerable: true,
  54865. get: function() {
  54866. return module.l;
  54867. }
  54868. });
  54869. Object.defineProperty(module, "id", {
  54870. enumerable: true,
  54871. get: function() {
  54872. return module.i;
  54873. }
  54874. });
  54875. module.webpackPolyfill = 1;
  54876. }
  54877. return module;
  54878. };
  54879. /***/ }),
  54880. /***/ "./resources/js/app.js":
  54881. /*!*****************************!*\
  54882. !*** ./resources/js/app.js ***!
  54883. \*****************************/
  54884. /*! no static exports found */
  54885. /***/ (function(module, exports, __webpack_require__) {
  54886. /**
  54887. * First we will load all of this project's JavaScript dependencies which
  54888. * includes Vue and other libraries. It is a great starting point when
  54889. * building robust, powerful web applications using Vue and Laravel.
  54890. */
  54891. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  54892. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  54893. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  54894. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  54895. /**
  54896. * The following block of code may be used to automatically register your
  54897. * Vue components. It will recursively scan this directory for the Vue
  54898. * components and automatically register them with their "basename".
  54899. *
  54900. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  54901. */
  54902. // const files = require.context('./', true, /\.vue$/i)
  54903. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  54904. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  54905. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  54906. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  54907. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  54908. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  54909. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  54910. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  54911. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  54912. /**
  54913. * Next, we will create a fresh Vue application instance and attach it to
  54914. * the page. Then, you may begin adding components to this application
  54915. * or customize the JavaScript scaffolding to fit your unique needs.
  54916. */
  54917. var app = new Vue({
  54918. el: '#app'
  54919. });
  54920. $(function () {
  54921. $('[data-toggle="tooltip"]').tooltip();
  54922. });
  54923. var clipboard = new Clipboard('.btn-clip');
  54924. clipboard.on('success', function (e) {
  54925. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  54926. position: "right",
  54927. className: 'success'
  54928. });
  54929. e.clearSelection();
  54930. });
  54931. /***/ }),
  54932. /***/ "./resources/js/bootstrap.js":
  54933. /*!***********************************!*\
  54934. !*** ./resources/js/bootstrap.js ***!
  54935. \***********************************/
  54936. /*! no exports provided */
  54937. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54938. "use strict";
  54939. __webpack_require__.r(__webpack_exports__);
  54940. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  54941. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  54942. /**
  54943. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  54944. * for JavaScript based Bootstrap features such as modals and tabs. This
  54945. * code may be modified to fit the specific needs of your application.
  54946. */
  54947. try {
  54948. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  54949. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  54950. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  54951. } catch (e) {}
  54952. /**
  54953. * We'll load the axios HTTP library which allows us to easily issue requests
  54954. * to our Laravel back-end. This library automatically handles sending the
  54955. * CSRF token as a header based on the value of the "XSRF" token cookie.
  54956. */
  54957. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  54958. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  54959. /**
  54960. * Echo exposes an expressive API for subscribing to channels and listening
  54961. * for events that are broadcast by Laravel. Echo and event broadcasting
  54962. * allows your team to easily build robust real-time web applications.
  54963. */
  54964. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  54965. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  54966. broadcaster: 'pusher',
  54967. key: "upccrt",
  54968. wsHost: window.location.hostname,
  54969. wsPort: 6001,
  54970. disableStats: true
  54971. });
  54972. /***/ }),
  54973. /***/ "./resources/js/components/ExampleComponent.vue":
  54974. /*!******************************************************!*\
  54975. !*** ./resources/js/components/ExampleComponent.vue ***!
  54976. \******************************************************/
  54977. /*! exports provided: default */
  54978. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54979. "use strict";
  54980. __webpack_require__.r(__webpack_exports__);
  54981. /* 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&");
  54982. /* 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&");
  54983. /* 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");
  54984. /* normalize component */
  54985. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54986. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54987. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  54988. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54989. false,
  54990. null,
  54991. null,
  54992. null
  54993. )
  54994. /* hot reload */
  54995. if (false) { var api; }
  54996. component.options.__file = "resources/js/components/ExampleComponent.vue"
  54997. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54998. /***/ }),
  54999. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55000. /*!*******************************************************************************!*\
  55001. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55002. \*******************************************************************************/
  55003. /*! exports provided: default */
  55004. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55005. "use strict";
  55006. __webpack_require__.r(__webpack_exports__);
  55007. /* 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&");
  55008. /* 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"]);
  55009. /***/ }),
  55010. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55011. /*!*************************************************************************************!*\
  55012. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55013. \*************************************************************************************/
  55014. /*! exports provided: render, staticRenderFns */
  55015. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55016. "use strict";
  55017. __webpack_require__.r(__webpack_exports__);
  55018. /* 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&");
  55019. /* 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"]; });
  55020. /* 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"]; });
  55021. /***/ }),
  55022. /***/ "./resources/js/components/assetinfo.vue":
  55023. /*!***********************************************!*\
  55024. !*** ./resources/js/components/assetinfo.vue ***!
  55025. \***********************************************/
  55026. /*! exports provided: default */
  55027. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55028. "use strict";
  55029. __webpack_require__.r(__webpack_exports__);
  55030. /* 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&");
  55031. /* 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&");
  55032. /* 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");
  55033. /* normalize component */
  55034. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55035. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55036. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55037. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55038. false,
  55039. null,
  55040. null,
  55041. null
  55042. )
  55043. /* hot reload */
  55044. if (false) { var api; }
  55045. component.options.__file = "resources/js/components/assetinfo.vue"
  55046. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55047. /***/ }),
  55048. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55049. /*!************************************************************************!*\
  55050. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55051. \************************************************************************/
  55052. /*! exports provided: default */
  55053. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55054. "use strict";
  55055. __webpack_require__.r(__webpack_exports__);
  55056. /* 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&");
  55057. /* 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"]);
  55058. /***/ }),
  55059. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55060. /*!******************************************************************************!*\
  55061. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55062. \******************************************************************************/
  55063. /*! exports provided: render, staticRenderFns */
  55064. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55065. "use strict";
  55066. __webpack_require__.r(__webpack_exports__);
  55067. /* 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&");
  55068. /* 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"]; });
  55069. /* 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"]; });
  55070. /***/ }),
  55071. /***/ "./resources/js/components/credential.vue":
  55072. /*!************************************************!*\
  55073. !*** ./resources/js/components/credential.vue ***!
  55074. \************************************************/
  55075. /*! exports provided: default */
  55076. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55077. "use strict";
  55078. __webpack_require__.r(__webpack_exports__);
  55079. /* 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&");
  55080. /* 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&");
  55081. /* 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");
  55082. /* normalize component */
  55083. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55084. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55085. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55086. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55087. false,
  55088. null,
  55089. null,
  55090. null
  55091. )
  55092. /* hot reload */
  55093. if (false) { var api; }
  55094. component.options.__file = "resources/js/components/credential.vue"
  55095. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55096. /***/ }),
  55097. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55098. /*!*************************************************************************!*\
  55099. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55100. \*************************************************************************/
  55101. /*! exports provided: default */
  55102. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55103. "use strict";
  55104. __webpack_require__.r(__webpack_exports__);
  55105. /* 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&");
  55106. /* 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"]);
  55107. /***/ }),
  55108. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55109. /*!*******************************************************************************!*\
  55110. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55111. \*******************************************************************************/
  55112. /*! exports provided: render, staticRenderFns */
  55113. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55114. "use strict";
  55115. __webpack_require__.r(__webpack_exports__);
  55116. /* 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&");
  55117. /* 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"]; });
  55118. /* 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"]; });
  55119. /***/ }),
  55120. /***/ "./resources/js/components/errorlist.vue":
  55121. /*!***********************************************!*\
  55122. !*** ./resources/js/components/errorlist.vue ***!
  55123. \***********************************************/
  55124. /*! exports provided: default */
  55125. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55126. "use strict";
  55127. __webpack_require__.r(__webpack_exports__);
  55128. /* 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&");
  55129. /* 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&");
  55130. /* 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");
  55131. /* normalize component */
  55132. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55133. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55134. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55135. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55136. false,
  55137. null,
  55138. null,
  55139. null
  55140. )
  55141. /* hot reload */
  55142. if (false) { var api; }
  55143. component.options.__file = "resources/js/components/errorlist.vue"
  55144. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55145. /***/ }),
  55146. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55147. /*!************************************************************************!*\
  55148. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55149. \************************************************************************/
  55150. /*! exports provided: default */
  55151. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55152. "use strict";
  55153. __webpack_require__.r(__webpack_exports__);
  55154. /* 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&");
  55155. /* 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"]);
  55156. /***/ }),
  55157. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55158. /*!******************************************************************************!*\
  55159. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55160. \******************************************************************************/
  55161. /*! exports provided: render, staticRenderFns */
  55162. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55163. "use strict";
  55164. __webpack_require__.r(__webpack_exports__);
  55165. /* 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&");
  55166. /* 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"]; });
  55167. /* 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"]; });
  55168. /***/ }),
  55169. /***/ "./resources/js/components/modal.vue":
  55170. /*!*******************************************!*\
  55171. !*** ./resources/js/components/modal.vue ***!
  55172. \*******************************************/
  55173. /*! exports provided: default */
  55174. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55175. "use strict";
  55176. __webpack_require__.r(__webpack_exports__);
  55177. /* 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&");
  55178. /* 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");
  55179. var script = {}
  55180. /* normalize component */
  55181. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55182. script,
  55183. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55184. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55185. false,
  55186. null,
  55187. null,
  55188. null
  55189. )
  55190. /* hot reload */
  55191. if (false) { var api; }
  55192. component.options.__file = "resources/js/components/modal.vue"
  55193. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55194. /***/ }),
  55195. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  55196. /*!**************************************************************************!*\
  55197. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  55198. \**************************************************************************/
  55199. /*! exports provided: render, staticRenderFns */
  55200. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55201. "use strict";
  55202. __webpack_require__.r(__webpack_exports__);
  55203. /* 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&");
  55204. /* 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"]; });
  55205. /* 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"]; });
  55206. /***/ }),
  55207. /***/ "./resources/js/components/notes.vue":
  55208. /*!*******************************************!*\
  55209. !*** ./resources/js/components/notes.vue ***!
  55210. \*******************************************/
  55211. /*! exports provided: default */
  55212. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55213. "use strict";
  55214. __webpack_require__.r(__webpack_exports__);
  55215. /* 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&");
  55216. /* 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&");
  55217. /* 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");
  55218. /* normalize component */
  55219. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55220. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55221. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55222. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55223. false,
  55224. null,
  55225. null,
  55226. null
  55227. )
  55228. /* hot reload */
  55229. if (false) { var api; }
  55230. component.options.__file = "resources/js/components/notes.vue"
  55231. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55232. /***/ }),
  55233. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  55234. /*!********************************************************************!*\
  55235. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  55236. \********************************************************************/
  55237. /*! exports provided: default */
  55238. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55239. "use strict";
  55240. __webpack_require__.r(__webpack_exports__);
  55241. /* 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&");
  55242. /* 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"]);
  55243. /***/ }),
  55244. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  55245. /*!**************************************************************************!*\
  55246. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  55247. \**************************************************************************/
  55248. /*! exports provided: render, staticRenderFns */
  55249. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55250. "use strict";
  55251. __webpack_require__.r(__webpack_exports__);
  55252. /* 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&");
  55253. /* 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"]; });
  55254. /* 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"]; });
  55255. /***/ }),
  55256. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  55257. /*!*******************************************************!*\
  55258. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  55259. \*******************************************************/
  55260. /*! exports provided: default */
  55261. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55262. "use strict";
  55263. __webpack_require__.r(__webpack_exports__);
  55264. /* 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&");
  55265. /* 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&");
  55266. /* 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");
  55267. /* normalize component */
  55268. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55269. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55270. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55271. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55272. false,
  55273. null,
  55274. null,
  55275. null
  55276. )
  55277. /* hot reload */
  55278. if (false) { var api; }
  55279. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  55280. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55281. /***/ }),
  55282. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  55283. /*!********************************************************************************!*\
  55284. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  55285. \********************************************************************************/
  55286. /*! exports provided: default */
  55287. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55288. "use strict";
  55289. __webpack_require__.r(__webpack_exports__);
  55290. /* 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&");
  55291. /* 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"]);
  55292. /***/ }),
  55293. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  55294. /*!**************************************************************************************!*\
  55295. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  55296. \**************************************************************************************/
  55297. /*! exports provided: render, staticRenderFns */
  55298. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55299. "use strict";
  55300. __webpack_require__.r(__webpack_exports__);
  55301. /* 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&");
  55302. /* 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"]; });
  55303. /* 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"]; });
  55304. /***/ }),
  55305. /***/ "./resources/js/components/woinfo.vue":
  55306. /*!********************************************!*\
  55307. !*** ./resources/js/components/woinfo.vue ***!
  55308. \********************************************/
  55309. /*! exports provided: default */
  55310. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55311. "use strict";
  55312. __webpack_require__.r(__webpack_exports__);
  55313. /* 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&");
  55314. /* 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&");
  55315. /* 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");
  55316. /* normalize component */
  55317. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55318. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55319. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  55320. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55321. false,
  55322. null,
  55323. null,
  55324. null
  55325. )
  55326. /* hot reload */
  55327. if (false) { var api; }
  55328. component.options.__file = "resources/js/components/woinfo.vue"
  55329. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55330. /***/ }),
  55331. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  55332. /*!*********************************************************************!*\
  55333. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  55334. \*********************************************************************/
  55335. /*! exports provided: default */
  55336. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55337. "use strict";
  55338. __webpack_require__.r(__webpack_exports__);
  55339. /* 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&");
  55340. /* 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"]);
  55341. /***/ }),
  55342. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  55343. /*!***************************************************************************!*\
  55344. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  55345. \***************************************************************************/
  55346. /*! exports provided: render, staticRenderFns */
  55347. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55348. "use strict";
  55349. __webpack_require__.r(__webpack_exports__);
  55350. /* 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&");
  55351. /* 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"]; });
  55352. /* 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"]; });
  55353. /***/ }),
  55354. /***/ "./resources/js/mixins/dateMixin.js":
  55355. /*!******************************************!*\
  55356. !*** ./resources/js/mixins/dateMixin.js ***!
  55357. \******************************************/
  55358. /*! exports provided: default */
  55359. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55360. "use strict";
  55361. __webpack_require__.r(__webpack_exports__);
  55362. /* harmony default export */ __webpack_exports__["default"] = ({
  55363. methods: {
  55364. treatAsUTC: function treatAsUTC(date) {
  55365. var result = new Date(date);
  55366. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  55367. return result;
  55368. },
  55369. daysSinceToday: function daysSinceToday(date) {
  55370. var currentDate = new Date();
  55371. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  55372. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  55373. },
  55374. getHRDate: function getHRDate(dateString) {
  55375. var date = new Date(dateString);
  55376. return date.toLocaleString('default', {
  55377. month: 'short',
  55378. day: 'numeric',
  55379. year: 'numeric',
  55380. hour: 'numeric',
  55381. minute: 'numeric'
  55382. });
  55383. },
  55384. isZero: function isZero(dateString) {
  55385. return dateString === '0000-00-00 00:00:00';
  55386. }
  55387. }
  55388. });
  55389. /***/ }),
  55390. /***/ "./resources/js/notify.min.js":
  55391. /*!************************************!*\
  55392. !*** ./resources/js/notify.min.js ***!
  55393. \************************************/
  55394. /*! no static exports found */
  55395. /***/ (function(module, exports, __webpack_require__) {
  55396. 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); }
  55397. (function (e) {
  55398. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  55399. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  55400. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  55401. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  55402. })(function (e) {
  55403. function A(t, n, i) {
  55404. typeof i == "string" && (i = {
  55405. className: i
  55406. }), 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);
  55407. }
  55408. var t = [].indexOf || function (e) {
  55409. for (var t = 0, n = this.length; t < n; t++) {
  55410. if (t in this && this[t] === e) return t;
  55411. }
  55412. return -1;
  55413. },
  55414. n = "notify",
  55415. r = n + "js",
  55416. i = n + "!blank",
  55417. s = {
  55418. t: "top",
  55419. m: "middle",
  55420. b: "bottom",
  55421. l: "left",
  55422. c: "center",
  55423. r: "right"
  55424. },
  55425. o = ["l", "c", "r"],
  55426. u = ["t", "m", "b"],
  55427. a = ["t", "b", "l", "r"],
  55428. f = {
  55429. t: "b",
  55430. m: null,
  55431. b: "t",
  55432. l: "r",
  55433. c: null,
  55434. r: "l"
  55435. },
  55436. l = function l(t) {
  55437. var n;
  55438. return n = [], e.each(t.split(/\W+/), function (e, t) {
  55439. var r;
  55440. r = t.toLowerCase().charAt(0);
  55441. if (s[r]) return n.push(r);
  55442. }), n;
  55443. },
  55444. c = {},
  55445. h = {
  55446. name: "core",
  55447. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  55448. 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}"
  55449. },
  55450. p = {
  55451. "border-radius": ["-webkit-", "-moz-"]
  55452. },
  55453. d = function d(e) {
  55454. return c[e];
  55455. },
  55456. v = function v(e) {
  55457. if (!e) throw "Missing Style name";
  55458. c[e] && delete c[e];
  55459. },
  55460. m = function m(t, i) {
  55461. if (!t) throw "Missing Style name";
  55462. if (!i) throw "Missing Style definition";
  55463. if (!i.html) throw "Missing Style HTML";
  55464. var s = c[t];
  55465. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  55466. var o = "";
  55467. i.classes && e.each(i.classes, function (t, n) {
  55468. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  55469. return p[t] && e.each(p[t], function (e, r) {
  55470. return o += " " + r + t + ": " + n + ";\n";
  55471. }), o += " " + t + ": " + n + ";\n";
  55472. }), o += "}\n";
  55473. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  55474. var u = {},
  55475. a = e(i.html);
  55476. y("html", a, u), y("text", a, u), i.fields = u;
  55477. },
  55478. g = function g(t) {
  55479. var n, r, i;
  55480. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  55481. try {
  55482. r.html(t);
  55483. } catch (s) {
  55484. r[0].styleSheet.cssText = t;
  55485. }
  55486. return r;
  55487. },
  55488. y = function y(t, n, r) {
  55489. var s;
  55490. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  55491. var n;
  55492. n = e(this).attr(s), n || (n = i), r[n] = t;
  55493. });
  55494. },
  55495. b = function b(e, t) {
  55496. return e.is(t) ? e : e.find(t);
  55497. },
  55498. w = {
  55499. clickToHide: !0,
  55500. autoHide: !0,
  55501. autoHideDelay: 5e3,
  55502. arrowShow: !0,
  55503. arrowSize: 5,
  55504. breakNewLines: !0,
  55505. elementPosition: "bottom",
  55506. globalPosition: "top right",
  55507. style: "bootstrap",
  55508. className: "error",
  55509. showAnimation: "slideDown",
  55510. showDuration: 400,
  55511. hideAnimation: "slideUp",
  55512. hideDuration: 200,
  55513. gap: 5
  55514. },
  55515. E = function E(t, n) {
  55516. var r;
  55517. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  55518. },
  55519. S = function S(t) {
  55520. return e.extend(w, t);
  55521. },
  55522. x = function x(t) {
  55523. return e("<" + t + "></" + t + ">");
  55524. },
  55525. T = {},
  55526. N = function N(t) {
  55527. var n;
  55528. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  55529. return e(r).attr("name") === t.attr("name");
  55530. }), t = n.first()), t;
  55531. },
  55532. C = function C(e, t, n) {
  55533. var r, i;
  55534. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  55535. if (isNaN(n)) return;
  55536. 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;
  55537. },
  55538. k = function k(e, t, n) {
  55539. if (e === "l" || e === "t") return 0;
  55540. if (e === "c" || e === "m") return n / 2 - t / 2;
  55541. if (e === "r" || e === "b") return n - t;
  55542. throw "Invalid alignment";
  55543. },
  55544. L = function L(e) {
  55545. return L.e = L.e || x("div"), L.e.text(e).html();
  55546. };
  55547. A.prototype.loadHTML = function () {
  55548. var t;
  55549. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  55550. }, A.prototype.show = function (e, t) {
  55551. var n, r, i, s, o;
  55552. r = function (n) {
  55553. return function () {
  55554. !e && !n.elem && n.destroy();
  55555. if (t) return t();
  55556. };
  55557. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  55558. 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 {
  55559. if (!!o || !!e) return r();
  55560. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  55561. }
  55562. return n.push(r), i[s].apply(i, n);
  55563. }, A.prototype.setGlobalPosition = function () {
  55564. var t = this.getPosition(),
  55565. n = t[0],
  55566. i = t[1],
  55567. o = s[n],
  55568. u = s[i],
  55569. a = n + "|" + i,
  55570. f = T[a];
  55571. if (!f || !document.body.contains(f[0])) {
  55572. f = T[a] = x("div");
  55573. var l = {};
  55574. 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);
  55575. }
  55576. return f.prepend(this.wrapper);
  55577. }, A.prototype.setElementPosition = function () {
  55578. 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;
  55579. 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"];
  55580. for (w = 0, S = B.length; w < S; w++) {
  55581. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  55582. }
  55583. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  55584. if (!this.options.arrowShow) this.arrow.hide();else {
  55585. 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";
  55586. for (E = 0, x = a.length; E < x; E++) {
  55587. D = a[E], P = s[D];
  55588. if (D === L) continue;
  55589. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  55590. }
  55591. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  55592. }
  55593. 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);
  55594. if (r) return this.arrow.removeAttr("style").css(r);
  55595. }, A.prototype.getPosition = function () {
  55596. var e, n, r, i, s, f, c, h;
  55597. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  55598. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  55599. 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";
  55600. return e.length === 2 && (e[2] = e[1]), e;
  55601. }, A.prototype.getStyle = function (e) {
  55602. var t;
  55603. e || (e = this.options.style), e || (e = "default"), t = c[e];
  55604. if (!t) throw "Missing style: " + e;
  55605. return t;
  55606. }, A.prototype.updateClasses = function () {
  55607. var t, n;
  55608. 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) {
  55609. return r + "-" + n.name + "-" + e;
  55610. }).join(" "), this.userContainer.attr("class", t);
  55611. }, A.prototype.run = function (t, n) {
  55612. var r, s, o, u, a;
  55613. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  55614. if (this.container && !t) {
  55615. this.show(!1);
  55616. return;
  55617. }
  55618. if (!this.container && !t) return;
  55619. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  55620. for (o in s) {
  55621. r = s[o], u = this.userFields[o];
  55622. if (!u) continue;
  55623. 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);
  55624. }
  55625. 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));
  55626. }, A.prototype.destroy = function () {
  55627. this.wrapper.data(r, null), this.wrapper.remove();
  55628. }, e[n] = function (t, r, i) {
  55629. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  55630. }, e.fn[n] = function (t, n) {
  55631. return e(this).each(function () {
  55632. var i = N(e(this)).data(r);
  55633. i && i.destroy();
  55634. var s = new A(e(this), t, n);
  55635. }), this;
  55636. }, e.extend(e[n], {
  55637. defaults: S,
  55638. addStyle: m,
  55639. removeStyle: v,
  55640. pluginOptions: w,
  55641. getStyle: d,
  55642. insertCSS: g
  55643. }), m("bootstrap", {
  55644. html: "<div>\n<span data-notify-text></span>\n</div>",
  55645. classes: {
  55646. base: {
  55647. "font-weight": "bold",
  55648. padding: "8px 15px 8px 14px",
  55649. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  55650. "background-color": "#fcf8e3",
  55651. border: "1px solid #fbeed5",
  55652. "border-radius": "4px",
  55653. "white-space": "nowrap",
  55654. "padding-left": "25px",
  55655. "background-repeat": "no-repeat",
  55656. "background-position": "3px 7px"
  55657. },
  55658. error: {
  55659. color: "#B94A48",
  55660. "background-color": "#F2DEDE",
  55661. "border-color": "#EED3D7",
  55662. "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=)"
  55663. },
  55664. success: {
  55665. color: "#468847",
  55666. "background-color": "#DFF0D8",
  55667. "border-color": "#D6E9C6",
  55668. "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==)"
  55669. },
  55670. info: {
  55671. color: "#3A87AD",
  55672. "background-color": "#D9EDF7",
  55673. "border-color": "#BCE8F1",
  55674. "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=)"
  55675. },
  55676. warn: {
  55677. color: "#C09853",
  55678. "background-color": "#FCF8E3",
  55679. "border-color": "#FBEED5",
  55680. "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)"
  55681. }
  55682. }
  55683. }), e(function () {
  55684. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  55685. e(this).trigger("notify-hide");
  55686. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  55687. var n = e(this).data(r);
  55688. n && n.show(!1);
  55689. });
  55690. });
  55691. });
  55692. /***/ }),
  55693. /***/ "./resources/sass/app.scss":
  55694. /*!*********************************!*\
  55695. !*** ./resources/sass/app.scss ***!
  55696. \*********************************/
  55697. /*! no static exports found */
  55698. /***/ (function(module, exports) {
  55699. // removed by extract-text-webpack-plugin
  55700. /***/ }),
  55701. /***/ 0:
  55702. /*!*************************************************************!*\
  55703. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  55704. \*************************************************************/
  55705. /*! no static exports found */
  55706. /***/ (function(module, exports, __webpack_require__) {
  55707. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  55708. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  55709. /***/ })
  55710. /******/ });